public static new void Run() { PerfManager perf = PerfManager.Instance; for (int count = 0; count < MAXCOUNT; count++) { if (count == 0) { perf.WriteLine("Warm-UP"); } else { perf.WriteLine("Count({0}/{1})", count, MAXCOUNT - 1); } perf.Run(RunManagedAdd); perf.Run(RunManagedAddInlined); perf.Run(RunInteropAdd); perf.Run(RunInteropNoSecurityAdd); perf.Run(RunMixedAdd); perf.Run(RunNetAsmAdd); if (count == 0) { // First count is not taken into account perf.Reset(); } perf.WriteLine(); } perf.DisplayAverage(); perf.WriteLine("End SimpleAdd Benchmark"); perf.WriteLine(); }
public static void Run() { perf = PerfManager.Instance; Random random = new Random(); for (int i = 0; i < 16; i++) { m1[i] = (float)random.NextDouble(); om1[i] = m1[i]; m2[i] = (float)random.NextDouble(); m3[i] = 0.0f; } fixed(float *pm1F = &m1[0], pm2F = &m2[0], pm3F = &m3[0]) { pm1 = pm1F; pm2 = pm2F; pm3 = pm3F; perf.WriteLine("Start Benchmark of MatrixMul : Interop, Managed, NetAsm"); for (int count = 0; count < MAXCOUNT; count++) { if (count == 0) { perf.WriteLine("Warm-UP"); } else { perf.WriteLine("Count({0}/{1})", count, MAXCOUNT - 1); } perf.Run(RunNetAsmStd); perf.Run(RunNetAsmSSE2); perf.Run(RunInteropStd); perf.Run(RunInteropSSE2); perf.Run(RunInteropNoSecuritySSE2); perf.Run(RunManagedStd); perf.Run(RunManagedUnsafe); perf.Run(RunMixedCppCli); if (count == 0) { // First count is not taken into account perf.Reset(); } perf.WriteLine(); } perf.DisplayAverage(); perf.WriteLine("End Benchmark"); perf.WriteLine(); } }