7 #ifndef __FWCORE_PROFILING_HPP__ 8 #define __FWCORE_PROFILING_HPP__ 10 #include "fwCore/HiResTimer.hpp" 34 std::stringstream log;
36 ::fwCore::log::SpyLogger::getSpyLogger().info(log.str(), __FILE__, __LINE__);
67 m_average = (m_average * m_count + time) / (m_count + 1);
97 m_frameTimer(frameTimer)
108 std::stringstream log;
109 log <<
"TIMER (avg over " << m_frameTimer.m_interval <<
"s) : " <<
m_label <<
110 " = " << m_frameTimer.m_average <<
" ms.";
111 ::fwCore::log::SpyLogger::getSpyLogger().info(log.str(), __FILE__, __LINE__);
112 m_frameTimer.reset();
132 m_frameTimer(frameTimer)
134 std::stringstream log;
135 log <<
"FRAME : " <<
m_label <<
" = " << m_frameTimer.m_timer.getElapsedTimeInMilliSec() <<
" ms.";
136 ::fwCore::log::SpyLogger::getSpyLogger().info(log.str(), __FILE__, __LINE__);
137 m_frameTimer.reset();
158 m_frameTimer(frameTimer)
160 if( m_frameTimer.tick() )
162 std::stringstream log;
163 log <<
"FRAME (avg over " << m_frameTimer.m_interval <<
"s) : " <<
m_label <<
164 " = " << m_frameTimer.m_average <<
" ms.";
165 ::fwCore::log::SpyLogger::getSpyLogger().info(log.str(), __FILE__, __LINE__);
166 m_frameTimer.reset();
180 #ifndef FW_PROFILING_DISABLED 183 #define FW_PROFILE(_label) \ 184 ::fwCore::fwProfileScope BOOST_PP_CAT( profiler, __LINE__ ) (_label); 187 #define FW_PROFILE_AVG(_label, interval) \ 188 static ::fwCore::fwProfileFrameTimer BOOST_PP_CAT( frameTimer, __LINE__ ) (interval); \ 189 ::fwCore::fwProfileScopeAvg BOOST_PP_CAT( profiler, __LINE__ ) (_label, BOOST_PP_CAT( frameTimer, __LINE__ )); 192 #define FW_PROFILE_FRAME(_label) \ 193 static ::fwCore::fwProfileFrameTimer BOOST_PP_CAT( frameTimer, __LINE__ ) (0); \ 194 ::fwCore::fwProfileFrame BOOST_PP_CAT( profiler, __LINE__ ) (_label, BOOST_PP_CAT( frameTimer, __LINE__ )); 197 #define FW_PROFILE_FRAME_AVG(_label, interval) \ 198 static ::fwCore::fwProfileFrameTimer BOOST_PP_CAT( frameTimer, __LINE__ ) (interval); \ 199 ::fwCore::fwProfileFrameAvg BOOST_PP_CAT( profiler, __LINE__ ) (_label, BOOST_PP_CAT( frameTimer, __LINE__ )); 201 #else // FW_PROFILING_DISABLED 203 #define FW_PROFILE(_label) 204 #define FW_PROFILE_AVG(_label, interval) 205 #define FW_PROFILE_FRAME(_label) 206 #define FW_PROFILE_FRAME_AVG(_label, interval) 208 #endif // FW_PROFILING_DISABLED 213 #endif // __FWCORE_PROFILING_HPP__ This class provide a timer (stopwatch). HiResTimer is able to measure the elapsed time with a few mic...
fwProfileFrameTimer & m_frameTimer
Timer used to get the elapsed time between two profiling scopes.
double m_interval
Timer label.
const char * m_label
Timer label.
FWCORE_API void stop()
Stop the timer. stop() will not reset the timer.
fwProfileFrameTimer & m_frameTimer
Timer used to get the elapsed time between two profiling scopes.
This class holds a timer. It displays elapsed time at destruction.
This namespace fwCore provides common foundations for FW4SPL.
fwProfileFrameTimer & m_frameTimer
Timer used to get the elapsed time between two profiling scopes.
double HiResClockType
Type returned by HiResClock Functions.
FWCORE_API::fwCore::HiResClock::HiResClockType getElapsedTimeInMilliSec()
const char * m_label
Timer label.
This class is used to compute the elapsed time between two profiling scopes every N seconds...
This class is used to compute the elapsed time between two profiling scopes.
This class holds a timer. It displays elapsed time at destruction every N seconds.
::fwCore::HiResTimer m_timer
Timer.
::fwCore::HiResTimer m_timer
Timer.
const char * m_label
Timer label.
const char * m_label
Timer label.
FWCORE_API void reset(::fwCore::HiResClock::HiResClockType initial_value=0.)
Reset the timer and leave it in the same state it was (started or stopped).
FWCORE_API void start()
Start the timer.
unsigned int m_count
Number of calls, used to compute the average.
This class holds a timer. It allows to compute the elapsed time between two profiling scopes...
::fwCore::HiResTimer m_timer
Timer.
This file defines SpyLog macros. These macros are used to log messages to a file or to the console du...
double m_average
Actual elapsed time average.