CodeProfiler BeginFrame Method Delta Engine Documentation

Namespace: DeltaEngine.Profiling
Assembly: DeltaEngine.Profiling (in DeltaEngine.Profiling.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public void BeginFrame()

Implements

CodeProfilingProvider BeginFrame 
Remarks

Tests: DeltaEngine.Profiling.Tests.CodeProfilerTests
Examples

3 unit tests call DeltaEngine.Profiling.CodeProfiler.BeginFrame
[Test]
public void DoesNotResetIfTooShortATimeHasPassed()
{
    var profiler = new CodeProfiler(1, 1);
    Thread.Sleep(2);
    profiler.BeginFrame();
    Assert.AreEqual(0.0f, profiler.lastResetTime);
}
[Test]
public void ResetsIfEnoughTimeHasPassed()
{
    var profiler = new CodeProfiler(1, 0.0001f);
    Thread.Sleep(2);
    RunOneFrameOfProfiling(profiler);
    profiler.BeginFrame();
    Assert.IsTrue(profiler.lastResetTime > 0.0f);
}
[Test]
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);
}
See Also