25std::map<std::string , std::pair<uint64_t,uint64_t> > TimeUtils::m_cumulatedTime =
26 std::map<std::string , std::pair<uint64_t,uint64_t> >();
27QMutex TimeUtils::m_mutex;
33 return QDateTime::currentMSecsSinceEpoch();
37 QMutexLocker locker(&m_mutex);
38 m_cumulatedTime[taskCategory].first = QDateTime::currentMSecsSinceEpoch();
47 QMutexLocker locker(&m_mutex);
48 m_cumulatedTime[taskCategory].first=time;
52 const uint64_t& end) {
57 uint64_t newTime = QDateTime::currentMSecsSinceEpoch();
58 uint64_t delta =
diffTime(m_cumulatedTime[taskCategory].first,newTime);
59 m_cumulatedTime[taskCategory].second += delta;
60 m_cumulatedTime[taskCategory].first = newTime;
68 const std::string& taskCategory) {
77 const std::string& taskCategory) {
79 LINFO << mess <<
": " << m_cumulatedTime[taskCategory].second <<
" ms";
84 LINFO << mess <<
": ";
85 for( std::map<std::string , std::pair<uint64_t,uint64_t> >::const_iterator it = m_cumulatedTime.begin() ;
86 it != m_cumulatedTime.end() ; it++ ) {
87 LINFO << it->first <<
":" << it->second.second <<
" ms" ;
static void setCurrentTime(uint64_t time, const std::string &taskCategory=std::string(""))
static void logAllCumulatedTime(const std::string &mess)
log the number of microseconds cumulated for all categories
static uint64_t diffTime(const uint64_t &begin, const uint64_t &end)
return the difference between two times in microseconds
static void logElapsedTime(const std::string &mess, const std::string &taskCategory=std::string(""))
log the number of microseconds since last UpdateCurrentTime
static void updateCurrentTime(const std::string &taskCategory=std::string(""))
store current time for new elapsed time computation
static uint64_t elapsedTime(const std::string &taskCategory=std::string(""))
static uint64_t getCurrentTime()
get the current time (real current time, not last time stored)
static void logCumulatedTime(const std::string &mess, const std::string &taskCategory=std::string(""))
log the number of microseconds cumulated for the category sum of elapsed time between consecutive cal...