aboutsummaryrefslogtreecommitdiff
path: root/tools/lldb-perf/lib/Gauge.h
blob: fc5c444a38b8325a58a027bd1a1a548efd084aa1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//===-- Gauge.h -------------------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef PerfTestDriver_Gauge_h
#define PerfTestDriver_Gauge_h

#include <functional>
#include <string>

#include "Results.h"

namespace lldb_perf {

template <class T>
class Gauge
{
public:
    typedef T ValueType;

    Gauge ()
    {}
    
    virtual
    ~Gauge ()
    {}
    
    virtual void
    Start () = 0;
    
    virtual ValueType
    Stop () = 0;

    virtual ValueType
    GetStartValue () const = 0;

    virtual ValueType
    GetStopValue () const = 0;

    virtual ValueType
    GetDeltaValue () const = 0;

};

template <class T>
Results::ResultSP GetResult (const char *description, T value);

template <>
Results::ResultSP GetResult (const char *description, double value);

template <>
Results::ResultSP GetResult (const char *description, uint64_t value);

template <>
Results::ResultSP GetResult (const char *description, std::string value);

}

#endif