1//===-- Timer.h -------------------------------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef __PerfTestDriver__Timer__
11#define __PerfTestDriver__Timer__
12
13#include "Gauge.h"
14
15#include <chrono>
16
17using namespace std::chrono;
18
19namespace lldb_perf
20{
21class TimeGauge : public Gauge<double>
22{
23public:
24    TimeGauge ();
25
26    virtual
27    ~TimeGauge ()
28    {
29    }
30
31    void
32    Start ();
33
34    double
35    Stop ();
36
37    virtual double
38    GetStartValue () const;
39
40    virtual double
41    GetStopValue () const;
42
43    virtual double
44    GetDeltaValue () const;
45
46private:
47    enum class State
48    {
49        eNeverUsed,
50        eCounting,
51        eStopped
52    };
53
54    typedef high_resolution_clock::time_point TimeType;
55    TimeType m_start;
56    TimeType m_stop;
57    double m_delta;
58    State m_state;
59
60    TimeType
61    Now ();
62
63};
64}
65
66#endif /* defined(__PerfTestDriver__Timer__) */
67