Changeset 383 for trunk/nv/core/profiler.hh
- Timestamp:
- 06/02/15 20:56:15 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/core/profiler.hh
r371 r383 21 21 #if NV_PROFILER 22 22 #define NV_PROFILE( tag ) nv::profiler_guard __profile( tag ) 23 #define NV_PROFILE_IF( tag, condition ) nv::profiler_condition_guard __profile( tag, condition ) 23 24 #else 24 25 #define NV_PROFILE( tag ) 26 #define NV_PROFILE_IF( tag, condition ) 25 27 #endif 28 26 29 27 30 namespace nv … … 68 71 friend class auto_singleton< profiler >; 69 72 friend class profiler_guard; 73 friend class profiler_condition_guard; 70 74 void log_report(); 71 75 private: … … 89 93 }; 90 94 95 class profiler_condition_guard 96 { 97 public: 98 profiler_condition_guard( string_ref tag, bool condition ) 99 : m_active( condition ) 100 { 101 if ( m_active ) profiler::pointer()->start_profile( tag ); 102 } 103 104 ~profiler_condition_guard() 105 { 106 if ( m_active ) profiler::pointer()->stop_profile(); 107 } 108 private: 109 bool m_active; 110 }; 111 91 112 } // namespace nv 92 113
Note: See TracChangeset
for help on using the changeset viewer.