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 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); } }
/// <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); }