public override void Collect(PerfCounter aCounter) { base.Collect(aCounter); Console.WriteLine("{0,-15}: {1,6:n0}ms ({2,10:n0} ticks)." + (ShowMemory ?" Mem: {3,4:n0}B, AC {4,4}B." : ""), aCounter.Name, aCounter.ElapsedMilliseconds, aCounter.ElapsedTicks, aCounter.UncollectedMemory, aCounter.CollectedMemory); }
private static void RunLoop(RunConfig runConfig) { var runners = runConfig.GetRunners(); object preRunState = null; object preLoopState = null; if (runConfig.PreRuns != null) preRunState = runConfig.PreRuns(); Action<ILocator, int, object, object> run = runConfig.Run; Func<ILocator, int, object, object> preLoopRun = runConfig.PreLoops; Action<ILocator, object, object> postLoopRun = runConfig.PostLoops; for (var l=0; l < RUNS; l++) { p().BeginGroup((l+1).ToString()); foreach (var r in runners) { if (preLoopRun != null) preLoopState = preLoopRun(r, l, preRunState); var k = new PerfCounter(r.Name); k.Begin(); for (var i = 0; i < LOOPS; i++) { run(r, i, preRunState, preLoopState); } k.End(); p().Collect(k); if (postLoopRun != null) postLoopRun(r, preRunState, preLoopState); } p().EndGroup(); } p().Flush(); if (runConfig.PostRuns != null) runConfig.PostRuns(preRunState); }
public virtual void Collect(PerfCounter aCounter) { collection.Last().Value.Add(aCounter); }