Timer.h revision af222500aa2ce2b18149277e561cdf75f2115df2
1// 2// Timer.h 3// PerfTestDriver 4// 5// Created by Enrico Granata on 3/6/13. 6// Copyright (c) 2013 Apple Inc. All rights reserved. 7// 8 9#ifndef __PerfTestDriver__Timer__ 10#define __PerfTestDriver__Timer__ 11 12#include "Gauge.h" 13 14#include <chrono> 15 16using namespace std::chrono; 17 18namespace lldb_perf 19{ 20class TimeGauge : public Gauge<double> 21{ 22private: 23 enum class State 24 { 25 eTSNeverUsed, 26 eTSCounting, 27 eTSStopped 28 }; 29 30 typedef high_resolution_clock::time_point HPTime; 31 HPTime m_start; 32 double m_value; 33 State m_state; 34 35 HPTime 36 now (); 37 38public: 39 TimeGauge (); 40 41 virtual 42 ~TimeGauge () 43 {} 44 45 void 46 start (); 47 48 double 49 stop (); 50 51 double 52 value (); 53}; 54} 55 56#endif /* defined(__PerfTestDriver__Timer__) */ 57