aboutsummaryrefslogtreecommitdiffstats
path: root/vbench/src/vbench/core/timer.h
blob: 6fd45f52764b37d48a58898e672c9c3afcaf95d3 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <chrono>

namespace vbench {

/**
 * Simple utility class used to handle low-level time sampling.
 **/
class Timer
{
private:
    using clock = std::chrono::steady_clock;
    clock::time_point _zero;
public:
    Timer();
    void reset();
    double sample() const;
};

} // namespace vbench