blob: f1ca75a6f16e67b7c4e54f1a55ac347fc74a9109 (
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
|
#pragma once
#include <fmt/format.h>
#include <utility>
#include "infra/sim.h"
namespace infra {
struct stat : public sim {
std::string name;
std::uint64_t numerator = 0;
std::uint64_t denominator = 0;
stat(std::string name)
: name(std::move(name))
{ }
~stat() {
fmt::print("# {} {}\n", name, (double)numerator/(double)denominator);
}
void unclock() {
++denominator;
}
stat & operator++() {
++numerator;
return *this;
}
stat & operator++(int) {
return operator++();
}
};
}
|