/// <summary> /// Begins time measurement using a new or existing <see cref="ProfileCounter"/> with the specified name. /// </summary> /// <param name="counter">The <see cref="ProfileCounter"/> name to use for this measurement. For nested measurements, use path strings, e.g. "ParentCounter\ChildCounter"</param> /// <returns></returns> public static TimeCounter BeginMeasure(string counter) { TimeCounter tc = RequestCounter <TimeCounter>(counter); tc.BeginMeasure(); return(tc); }
/// <summary> /// Queries this frames time measurement value from an existing <see cref="ProfileCounter"/> with the specified name. /// </summary> /// <param name="counter">The <see cref="ProfileCounter"/> name to use for this measurement. For nested measurements, use path strings, e.g. "ParentCounter\ChildCounter"</param> /// <returns></returns> public static float GetMeasure(string counter) { TimeCounter tc = GetCounter <TimeCounter>(counter); if (tc != null) { return(tc.LastValue); } else { return(0.0f); } }
static Profile() { TimeFrame = RequestCounter <TimeCounter>(@"Duality\Frame"); TimeUpdate = RequestCounter <TimeCounter>(@"Duality\Frame\Update"); TimeUpdatePhysics = RequestCounter <TimeCounter>(@"Duality\Frame\Update\Physics"); TimeUpdatePhysicsContacts = RequestCounter <TimeCounter>(@"Duality\Frame\Update\Physics\Contacts"); TimeUpdatePhysicsController = RequestCounter <TimeCounter>(@"Duality\Frame\Update\Physics\Controller"); TimeUpdatePhysicsContinous = RequestCounter <TimeCounter>(@"Duality\Frame\Update\Physics\Continous"); TimeUpdatePhysicsAddRemove = RequestCounter <TimeCounter>(@"Duality\Frame\Update\Physics\AddRemove"); TimeUpdatePhysicsSolve = RequestCounter <TimeCounter>(@"Duality\Frame\Update\Physics\Solve"); TimeUpdateScene = RequestCounter <TimeCounter>(@"Duality\Frame\Update\Scene"); TimeUpdateSceneComponents = RequestCounter <TimeCounter>(@"Duality\Frame\Update\Scene\All Components"); TimeUpdateAudio = RequestCounter <TimeCounter>(@"Duality\Frame\Update\Audio"); TimeRender = RequestCounter <TimeCounter>(@"Duality\Frame\Render"); TimeSwapBuffers = RequestCounter <TimeCounter>(@"Duality\Frame\Render\SwapBuffers"); TimeQueryVisibleRenderers = RequestCounter <TimeCounter>(@"Duality\Frame\Render\QueryVisibleRenderers"); TimeCollectDrawcalls = RequestCounter <TimeCounter>(@"Duality\Frame\Render\CollectDrawcalls"); TimeOptimizeDrawcalls = RequestCounter <TimeCounter>(@"Duality\Frame\Render\OptimizeDrawcalls"); TimeProcessDrawcalls = RequestCounter <TimeCounter>(@"Duality\Frame\Render\ProcessDrawcalls"); TimeLog = RequestCounter <TimeCounter>(@"Duality\Frame\Log"); TimeVisualPicking = RequestCounter <TimeCounter>(@"Duality\Frame\VisualPicking"); TimeUnaccounted = RequestCounter <TimeCounter>(@"Duality\Frame\Unaccounted"); StatNumPlaying2D = RequestCounter <StatCounter>(@"Duality\Stats\Audio\NumPlaying2D"); StatNumPlaying3D = RequestCounter <StatCounter>(@"Duality\Stats\Audio\NumPlaying3D"); StatNumDrawcalls = RequestCounter <StatCounter>(@"Duality\Stats\Render\NumDrawcalls"); StatNumRawBatches = RequestCounter <StatCounter>(@"Duality\Stats\Render\NumRawBatches"); StatNumMergedBatches = RequestCounter <StatCounter>(@"Duality\Stats\Render\NumMergedBatches"); StatNumOptimizedBatches = RequestCounter <StatCounter>(@"Duality\Stats\Render\NumOptimizedBatches"); StatMemoryTotalUsage = RequestCounter <StatCounter>(@"Duality\Stats\Memory\TotalUsage"); StatMemoryGarbageCollect0 = RequestCounter <StatCounter>(@"Duality\Stats\Memory\GarbageCollect0"); StatMemoryGarbageCollect1 = RequestCounter <StatCounter>(@"Duality\Stats\Memory\GarbageCollect1"); StatMemoryGarbageCollect2 = RequestCounter <StatCounter>(@"Duality\Stats\Memory\GarbageCollect2"); StatMemoryGarbageCollect0.IsSingleValue = true; StatMemoryGarbageCollect1.IsSingleValue = true; StatMemoryGarbageCollect2.IsSingleValue = true; }
/// <summary> /// Ends time measurement using an existing <see cref="ProfileCounter"/> with the specified name. /// </summary> /// <param name="counter">The <see cref="ProfileCounter"/> name to use for this measurement. For nested measurements, use path strings, e.g. "ParentCounter\ChildCounter"</param> public static void EndMeasure(string counter) { TimeCounter tc = RequestCounter <TimeCounter>(counter); tc.EndMeasure(); }