-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBenchmark.hpp
More file actions
39 lines (30 loc) · 1.06 KB
/
Benchmark.hpp
File metadata and controls
39 lines (30 loc) · 1.06 KB
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
#ifndef __BENCHMARK_H
#define __BENCHMARK_H
#define BENCHMARK
#include <mutex>
#include <functional>
// Partial implementation of a Benchmark class
namespace Benchmark {
class Benchmark {
public:
static Benchmark* Instance();
void setLineImpl(auto& f);
void setWordImpl(auto& f);
void setCharImpl(auto& f);
void setBytesImpl(auto& f);
auto &getLineImpl() const;
auto &getWordImpl() const;
auto &getCharImpl() const;
auto &getBytesImpl() const;
constexpr ~Benchmark();
private:
constexpr Benchmark();
static Benchmark *instance;
static std::mutex benchmarkLock;
std::function<size_t(std::char_traits<char> (std::char_traits<char>) )> __line_impl;
std::function<size_t(std::char_traits<char> (std::char_traits<char>) )> __word_impl;
std::function<size_t(std::char_traits<char> (std::char_traits<char>) )> __char_impl;
std::function<size_t(std::char_traits<char> (std::char_traits<char>) )> __bytes_impl;
};
}
#endif