private static void RunOneFrameOfProfiling(CodeProfiler profiler) { profiler.BeginFrame(); profiler.Start(ProfilingMode.Rendering, Section); profiler.Stop(ProfilingMode.Rendering, Section); profiler.EndFrame(); }
public void DoesNotResetIfTooShortATimeHasPassed() { var profiler = new CodeProfiler(1, 1); Thread.Sleep(2); profiler.BeginFrame(); Assert.AreEqual(0.0f, profiler.lastResetTime); }
public void ResetsIfEnoughTimeHasPassed() { var profiler = new CodeProfiler(1, 0.0001f); Thread.Sleep(2); RunOneFrameOfProfiling(profiler); profiler.BeginFrame(); Assert.IsTrue(profiler.lastResetTime > 0.0f); }
public void ProfilingWhenInactiveDoesNothing() { var profiler = new CodeProfiler { IsActive = false }; profiler.BeginFrame(); profiler.Start(ProfilingMode.Rendering, Section); profiler.Stop(ProfilingMode.Rendering, Section); profiler.EndFrame(); Assert.AreEqual(0, profiler.Sections[(int)ProfilingMode.Rendering].Count); }