VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtProfileManager.h
Go to the documentation of this file.
1 /*********************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************************/
5 
10 
11 #pragma once
12 
13 #include <vrvUtil/vrvUtil.h>
14 
15 #include <string>
16 
17 namespace makVrv
18 {
20  typedef unsigned long long DtUInt64;
21 
23  struct DtThreadProfileData;
24  class DtProfileIterator;
25  class DtProfileNode;
26 
30  {
31  public:
33  {
34  F3_STATS_OVERLAY = 0x00000001,
35  IMGUI_OVERLAY = 0x00000010,
36  };
37 
39  static void init();
40 
48  static void addClientFlag(int flag);
49  static void removeClientFlag(int flag);
50  static int clientFlags();
52 
54  static void startProfile(const char* name);
56  static void stopProfile();
57 
59  static void startPerformanceStat(const char* name);
61  static void stopPerformanceStat();
62 
64  static void getTime(DtUInt64& time);
65 
67  static void reset();
70  static void incrementFrameCounter();
72  static int frameCountSinceReset() {
73  return theFrameCounter;
74  }
76  static DtUInt64 timeSinceReset();
78  static DtUInt64 ticksPerSecond();
79 
81  static double averageFps();
83  static double instantFps();
85  static double lowestFps();
86 
88  static double instantFrameTime();
89  static double averageFrameTime();
90  static double highestFrameTime();
91 
93  static DtProfileIterator* profileIterator();
94 
97  {
98  return &theRoot;
99  }
100 
102  static DtProfileIterator* statIterator();
103 
105  static void releaseIterator(DtProfileIterator* iterator);
106 
108  static bool collectTracyStats()
109  {
110  return theCollectTracyStats;
111  }
112  static bool collectTracyGpuStats()
113  {
114  return theCollectGpuTracyStats;
115  }
117  static void setCollectTracyStats(bool val)
118  {
119  theCollectTracyStats = val;
120  if (!theCollectTracyStats)
121  {
122  theCollectGpuTracyStats = false;
123  }
124  }
125  static void setCollectTracyGpuStats(bool val)
126  {
127  theCollectGpuTracyStats = val;
128  }
129  static void setTracyProfilerInitialized(bool val)
130  {
131  theTracyProfilerInitialized = val;
132  }
134  {
135  return theTracyProfilerInitialized;
136  }
137 
138  // For callstack implementation
139  static void setTracyCallstackDepth(int depth)
140  {
141  theCallstackDepth = depth;
142  }
143  static int tracyCallstackDepth()
144  {
145  return theCallstackDepth;
146  }
147 
148  static int threadCount();
149  static DtThreadProfileData* threadData(int i);
150 
151  private:
156  {
157  public:
158  Initializer();
159  };
160  friend class Initializer;
162 
164  static DtThreadProfileData* getCurrentProfileNode();
165  static DtThreadProfileData* getCurrentPerformanceStatNode();
166 
169 
170  static bool theShouldReset;
171  static int theFrameCounter;
174 
177  static int theFrameTimeIndex;
178 
181  static int theClientFlags;
182  static int theCallstackDepth;
183  static bool theCollectTracyStats;
186  };
187 }
188 
189 
Profile node class stores timing data for a profiled section.
Definition: DtProfileNode.h:22
DT_DLL_EXAMPLESCENEROOTPLUGIN void init(DtDe &anIG)
static int theFrameCounter
Definition: DtProfileManager.h:171
this is a static constructor used to create and initialize this class and the clock at startup by cal...
Definition: DtProfileManager.h:155
#define DT_DLL_VRVUTIL
Definition: vrvUtil.h:34
static bool theCollectGpuTracyStats
Definition: DtProfileManager.h:184
static Initializer theInitializer
Definition: DtProfileManager.h:161
An Iterator for navigating through the function call tree.
Definition: DtProfileIterator.h:23
ClientFlags
Definition: DtProfileManager.h:32
static void setTracyProfilerInitialized(bool val)
Definition: DtProfileManager.h:129
static bool collectTracyGpuStats()
Definition: DtProfileManager.h:112
static int tracyCallstackDepth()
Definition: DtProfileManager.h:143
static bool theCollectTracyStats
Definition: DtProfileManager.h:183
static DtUInt64 * theFrameTimes
Definition: DtProfileManager.h:175
static DtProfileNode thePerformanceStatRoot
Definition: DtProfileManager.h:168
Contains DLL export macros.
static int theFrameTimeIndex
Definition: DtProfileManager.h:177
static void setCollectTracyGpuStats(bool val)
Definition: DtProfileManager.h:125
static bool theShouldReset
Definition: DtProfileManager.h:170
static bool theTracyProfilerInitialized
Definition: DtProfileManager.h:185
static int theClientFlags
Definition: DtProfileManager.h:181
static DtProfileNode theRoot
Definition: DtProfileManager.h:167
static DtUInt64 thePreviousFrame
Definition: DtProfileManager.h:173
static bool tracyProfilerInitialized()
Definition: DtProfileManager.h:133
static DtUInt64 theMaxFrameTime
Definition: DtProfileManager.h:176
static bool theInitializationDone
Definition: DtProfileManager.h:179
The profile manager responsible for all profiling.
Definition: DtProfileManager.h:29
static DtProfileNode * theRootNode()
tree root access for imgui
Definition: DtProfileManager.h:96
static void setCollectTracyStats(bool val)
set if stats are active
Definition: DtProfileManager.h:117
static void setTracyCallstackDepth(int depth)
Definition: DtProfileManager.h:139
static int thePreInitClientFlags
Definition: DtProfileManager.h:180
static DtUInt64 theResetTime
Definition: DtProfileManager.h:172
static bool collectTracyStats()
are tracy stats active
Definition: DtProfileManager.h:108
static int frameCountSinceReset()
get the number of frames since reset
Definition: DtProfileManager.h:72
unsigned long long DtUInt64
unsigned 64 bit integer
Definition: DtProfileIterator.h:18
static int theCallstackDepth
Definition: DtProfileManager.h:182

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)