#ifndef _PERF_TIMER_H_
#define _PERF_TIMER_H_

#ifdef _WIN32
#include 
<windows.h>
#else
#include 
<sys/time.h>
#endif

class PerfTimer
{
public:
    PerfTimer();
    
~PerfTimer();

    
void reset();
    
void start();
    
void stop();
    
const double duration()const;
    
const double duration_milli_seconds()const;
    
const double duration_micro_seconds()const;

private:
#ifdef _WIN32
    __int64 m_start_time;
    __int64 m_stop_time;
    __int64 m_freq;
#else
    
struct timeval m_start_time;
    
struct timeval m_stop_time;
#endif
};

#endif

相关文章:

  • 2022-12-23
  • 2021-11-27
  • 2021-11-20
  • 2021-09-21
  • 2021-07-10
  • 2022-12-23
  • 2021-04-03
猜你喜欢
  • 2022-12-23
  • 2022-01-01
  • 2021-04-21
  • 2021-04-26
  • 2021-04-20
  • 2021-12-16
  • 2021-09-12
相关资源
相似解决方案