/// <summary> /// Queries a statistical information 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> /// <param name="value"></param> public static int GetStat(string counter) { StatCounter sc = RequestCounter <StatCounter>(counter); if (sc != null) { return(sc.LastValue); } else { return(0); } }
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> /// Accumulates a statistical information value to 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> /// <param name="value"></param> public static void AddToStat(string counter, int value) { StatCounter sc = RequestCounter <StatCounter>(counter); sc.Add(value); }