13 #ifndef __UT_Performance__
14 #define __UT_Performance__
30 #include <tbb/spin_rw_mutex.h>
32 #define UT_PERFMON_INVALID_ID -1
33 #define UT_PERFMON_INTERNAL_TASKS_LABEL "Internal Tasks"
61 class ut_PerfMonProfileInterest;
62 class ut_PerfMonEventInterest;
87 bool auto_nest_events=
true);
90 bool auto_nest_events=
true);
95 int startTimedCookEvent(
97 const char *cook_event_name=NULL);
98 int startMemoryCookEvent(
100 const char *cook_event_name=NULL);
106 void addTimedCookEvent(
109 const char *cook_event_name=NULL);
114 int startTimedPDGEvent(
116 const char *pdg_event_name=NULL);
117 int startMemoryPDGEvent(
119 const char *pdg_event_name=NULL);
125 void addTimedPDGEvent(
128 const char *pdg_event_name=NULL);
134 int startTimedSolveEvent(
136 const char *solver_event_name=NULL);
137 int startMemorySolveEvent(
139 const char *solver_event_name=NULL);
145 int startTimedDrawEvent(
147 const char *draw_event_name,
148 bool is_gpu_draw=
false);
149 int startMemoryDrawEvent(
151 const char *draw_event_name,
152 bool is_gpu_draw=
false);
158 int startTimedViewportDrawEvent(
159 const char *viewport_name,
160 const char *draw_event_name,
162 bool is_gpu_draw=
false);
163 int startMemoryViewportDrawEvent(
164 const char *viewport_name,
165 const char *draw_event_name,
167 bool is_gpu_draw=
false);
173 void addTimedDrawEvent(
175 const char *draw_event_name,
177 bool is_gpu_draw=
false);
183 void addTimedViewportDrawEvent(
185 const char *draw_event_name,
188 bool is_gpu_draw=
false);
193 int startTimedScriptEvent(
194 const char *code_description,
196 bool auto_nest_events=
true);
197 int startMemoryScriptEvent(
198 const char *code_description,
200 bool auto_nest_events=
true);
204 int startTimedNodeScriptEvent(
206 const char *code_description,
208 int startMemoryNodeScriptEvent(
210 const char *code_description,
216 int startTimedRenderEvent(
217 const char *renderer,
218 const char *operation,
219 bool is_renderer_a_node,
221 const char *
object=NULL);
222 int startMemoryRenderEvent(
223 const char *renderer,
224 const char *operation,
225 bool is_renderer_a_node,
227 const char *
object=NULL);
233 void addTimedRenderEvent(
235 bool is_renderer_a_node,
238 void addMemoryRenderEvent(
240 bool is_renderer_a_node,
247 int startTimedFrameEvent(
fpreal frame);
248 int startMemoryFrameEvent(
fpreal frame);
252 int startTimedNodeCreationEvent();
253 int startMemoryNodeCreationEvent();
254 void stopNodeCreationEvent(
int event_id,
int node_id);
257 int startTimedPaneEvent(
const char *pane,
258 const char *operation);
259 int startMemoryPaneEvent(
const char *pane,
260 const char *operation);
267 fpreal stopEvent(
int event_id,
bool return_value=
false);
272 void cancelEvent(
int event_id);
275 void logMessage(
const char *
message);
290 virtual int startTaskScope(
const UT_TaskScope* task_scope);
294 virtual void stopTaskScope(
300 void setEventExtraInfo(
301 int event_id,
const char *extra_info)
const;
343 const char *file_path,
352 const char *file_path);
359 void removeAllProfiles();
364 const char *profile_name);
367 void changeProfileRecordOptions(
381 {
return myActiveProfileId; }
389 int numCompletedProfiles()
const;
398 int getProfileByFilePath(
399 const char *file_path)
const;
403 void addProfileInterest(
409 void removeProfileInterest(
415 bool hasProfileInterest(
422 void addEventInterest(
428 void changeEventInterestRecordOptions(
434 void removeEventInterest(
440 bool hasEventInterest(
446 int createDiffProfile(
int id1,
int id2);
457 return myIsRecordingCount.load() > 0 ||
458 (!profile_only && getDisplayNodeInfo());
463 return myRecordCookStatsCount.load() > 0 ||
464 (!profile_only && getDisplayNodeInfo());
469 return myRecordPDGCookStatsCount.load() > 0;
474 return myRecordSolveStatsCount.load() > 0;
480 myRecordObjectDrawStatsCount.load() > 0;
486 myRecordObjectGPUDrawStatsCount.load() > 0;
491 return myRecordViewportStatsCount.load() > 0;
496 return myRecordPaneStatsCount.load() > 0;
501 return myRecordScriptStatsCount.load() > 0;
506 return myRecordRenderStatsCount.load() > 0;
511 return myRecordThreadStatsCount.load() > 0;
516 return myRecordFrameStatsCount.load() > 0;
521 return myRecordMemoryStatsCount.load() > 0;
526 return myRecordErrorsCount.load() > 0;
533 virtual bool isRecordingAllowedFor(
OP_Node* node)
const;
542 {
return myTimedFrameEventCounter; }
547 {
return myMemoryFrameEventCounter; }
552 {
return myTotalFrameTime; }
557 {
return myTotalFrameMemory; }
560 void resetCumulativeFrameStats();
578 void setDisplayNodeInfo(
bool display);
580 {
return myDisplayNodeInfo; }
587 const UT_Ramp &getRampColorScheme()
const;
590 void setRampColorScheme(
const UT_Ramp &src_ramp);
593 void loadRampColorScheme(
const char *str_color_scheme);
596 void saveRampColorScheme(
UT_String &str_color_scheme);
599 const UT_Ramp &getDefaultColorRampScheme();
612 virtual int getCurrentFrameSubclass_();
615 virtual OP_Node *getNodeSubclass_(
int node_id)
const;
618 virtual OP_Node *getNodeFromSolverSubclass_(
623 virtual void getObjectPathFromNodeSubclass_(
624 OP_Node *node,
const char *event_name,
629 virtual void getObjectPathFromSolverAndNodeSubclass_(
636 virtual void getExtraInfoFromNodeSubclass_(
662 bool auto_nest_events,
673 int node_id,
const char *cook_event_name);
679 const char *pdg_event_name);
682 int startSolveEvent_(
685 const char *solver_event_name);
691 const char *draw_event_name,
695 int startViewportDrawEvent_(
697 const char *viewport_name,
698 const char *draw_event_name,
703 int startGenericDrawEvent_(
706 const char *draw_event_name,
708 const char *object_icon,
712 int startScriptEvent_(
714 const char *code_description,
716 bool auto_nest_events,
720 int startRenderEvent_(
722 const char *renderer,
723 const char *operation,
724 bool is_renderer_a_node,
739 void incrementRecordingCounters_(
743 void decrementRecordingCounters_(
755 int getProfileByFilePath_(
const char *file_path)
const;
759 void addFilePathToLoadedProfileMapping_(
760 const char *file_path,
766 void removeFilePathToLoadedProfileMapping_(
int profile_id);
770 void clearFilePathToLoadedProfileMappings_();
774 UT_String convertFilePathToCanonicalForm_(
781 bool is_cancelled=
false);
785 void findAndLinkToRunningParentEvent_(
790 bool for_memory_event,
791 bool require_auto_nest);
793 void addChildToRunningParentEvent_(
796 bool for_memory_event,
797 bool require_auto_nest);
804 bool for_memory_event);
811 bool for_memory_event)
const;
816 void removeFromRunningEventList_(
822 void addToRunningEventList_(
827 void resetRunningEventLists_();
834 int findProfileInterest_(
void *callee,
838 void notifyProfileInterests_(
844 int findEventInterest_(
void *callee,
848 void notifyEventInterests_(
851 using RWLock = tbb::spin_rw_mutex;
854 RWLock &getRunningEventsLock_(
856 bool for_memory_event);
860 bool areOptionsInterestedInEvent_(
865 fpreal stopEvent_(
int event_id,
bool return_value);
869 void addToCumulativeFrameStats_(
870 fpreal frame_value,
bool is_memory_value);
873 void initDefaultColorRampScheme_();
876 int myActiveProfileId;
880 bool myDisplayNodeInfo;
899 mutable RWLock myEventsLock;
900 mutable RWLock myProfilesLock;
901 mutable RWLock myProfileInterestsLock;
902 mutable RWLock myEventInterestsLock;
937 fpreal myTotalFrameMemory;
938 int myTimedFrameEventCounter;
939 int myMemoryFrameEventCounter;
GLuint GLsizei const GLchar * message
UT_PerfMonEventType
Event types.
GT_API const UT_StringHolder time
GLsizei const GLchar *const * path
UT_PerfMonObjectType
Object types.
static const UT_StringHolder theEmptyString
UT_PerfMonCategory
Categories.
UT_PerfMonViewportType
Viewport types recognized by the performance monitor.
A collection of statistics for a particular object (i.e. node, viewport).
Utility class for containing a color ramp.
GT_API const UT_StringHolder profile_id
UT_PerfMonScriptType
Script types recognized by the performance monitor.