Gauge.h revision af222500aa2ce2b18149277e561cdf75f2115df2
1//
2//  Gauge.h
3//  PerfTestDriver
4//
5//  Created by Enrico Granata on 3/7/13.
6//  Copyright (c) 2013 Apple Inc. All rights reserved.
7//
8
9#ifndef PerfTestDriver_Gauge_h
10#define PerfTestDriver_Gauge_h
11
12#include <functional>
13
14namespace lldb_perf
15{
16template <class TASizeType>
17class Gauge
18{
19public:
20    typedef TASizeType SizeType;
21public:
22    Gauge ()
23    {}
24
25    virtual
26    ~Gauge ()
27    {}
28
29    virtual void
30    start () = 0;
31
32    virtual SizeType
33    stop () = 0;
34
35    virtual  SizeType
36    value () = 0;
37
38    template <typename F, typename... Args>
39    SizeType
40    gauge (F f,Args... args)
41    {
42        start();
43        f(args...);
44        return stop();
45    }
46
47};
48}
49
50#endif
51