/// <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); }
static Profile() { TimeUpdatePhysics = RequestCounter <TimeCounter>(@"Duality\Frame\Update\Physics"); TimeFrame = RequestCounter <TimeCounter>(@"Duality\Frame"); TimeUpdatePhysicsContacts = RequestCounter <TimeCounter>(@"Duality\Frame\Update\Physics\Contacts"); TimeUpdate = RequestCounter <TimeCounter>(@"Duality\Frame\Update"); TimeUpdatePhysicsController = RequestCounter <TimeCounter>(@"Duality\Frame\Update\Physics\Controller"); TimeUpdateScene = RequestCounter <TimeCounter>(@"Duality\Frame\Update\Scene"); TimeUpdatePhysicsContinous = RequestCounter <TimeCounter>(@"Duality\Frame\Update\Physics\Continous"); TimeUpdateAudio = RequestCounter <TimeCounter>(@"Duality\Frame\Update\Audio"); TimeUpdatePhysicsAddRemove = RequestCounter <TimeCounter>(@"Duality\Frame\Update\Physics\AddRemove"); TimeUpdatePhysicsSolve = RequestCounter <TimeCounter>(@"Duality\Frame\Update\Physics\Solve"); TimeRender = RequestCounter <TimeCounter>(@"Duality\Frame\Render"); TimeSwapBuffers = RequestCounter <TimeCounter>(@"Duality\Frame\Render\SwapBuffers"); TimeCollectDrawcalls = RequestCounter <TimeCounter>(@"Duality\Frame\Render\CollectDrawcalls"); TimeOptimizeDrawcalls = RequestCounter <TimeCounter>(@"Duality\Frame\Render\OptimizeDrawcalls"); TimeProcessDrawcalls = RequestCounter <TimeCounter>(@"Duality\Frame\Render\ProcessDrawcalls"); TimePostProcessing = RequestCounter <TimeCounter>(@"Duality\Frame\Render\PostProcessing"); TimeLog = RequestCounter <TimeCounter>(@"Duality\Frame\Log"); TimeVisualPicking = RequestCounter <TimeCounter>(@"Duality\VisualPicking"); 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> /// 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); } }
/// <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(); }