2020-03-25 04:29:09 +01:00
|
|
|
/*
|
|
|
|
* IXBench.h
|
|
|
|
* Author: Benjamin Sergeant
|
|
|
|
* Copyright (c) 2017-2020 Machine Zone, Inc. All rights reserved.
|
|
|
|
*/
|
2020-08-16 03:58:46 +02:00
|
|
|
#pragma once
|
2020-03-25 04:29:09 +01:00
|
|
|
|
|
|
|
#include <chrono>
|
|
|
|
#include <stdint.h>
|
2020-03-25 04:37:55 +01:00
|
|
|
#include <string>
|
2020-03-25 04:29:09 +01:00
|
|
|
|
|
|
|
namespace ix
|
|
|
|
{
|
|
|
|
class Bench
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Bench(const std::string& description);
|
|
|
|
~Bench();
|
|
|
|
|
2020-09-03 18:13:23 +02:00
|
|
|
void reset();
|
2020-09-30 23:25:41 +02:00
|
|
|
void record();
|
2020-03-25 04:29:09 +01:00
|
|
|
void report();
|
2020-09-30 23:25:41 +02:00
|
|
|
void setReported();
|
2020-03-25 04:29:09 +01:00
|
|
|
uint64_t getDuration() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::string _description;
|
2020-03-25 04:53:25 +01:00
|
|
|
std::chrono::time_point<std::chrono::high_resolution_clock> _start;
|
2020-09-30 23:25:41 +02:00
|
|
|
uint64_t _duration;
|
2020-03-25 04:29:09 +01:00
|
|
|
bool _reported;
|
|
|
|
};
|
2020-03-25 04:37:55 +01:00
|
|
|
} // namespace ix
|