diff options
| author | Julian Blake Kongslie | 2022-10-15 15:01:25 -0700 |
|---|---|---|
| committer | Julian Blake Kongslie | 2022-10-15 15:01:25 -0700 |
| commit | bcf2314f15d68d7a0b94445f99962342b9d4130d (patch) | |
| tree | 89302b2669e6141ebfc86afc4bd9e19eac0c80bf /infra/stat.h | |
| parent | Stop cycle after accepting restart in fetch. (diff) | |
| download | procmodel-bcf2314f15d68d7a0b94445f99962342b9d4130d.tar.xz | |
Diffstat (limited to 'infra/stat.h')
| -rw-r--r-- | infra/stat.h | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/infra/stat.h b/infra/stat.h deleted file mode 100644 index f1ca75a..0000000 --- a/infra/stat.h +++ /dev/null | |||
| @@ -1,35 +0,0 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include <fmt/format.h> | ||
| 4 | #include <utility> | ||
| 5 | |||
| 6 | #include "infra/sim.h" | ||
| 7 | |||
| 8 | namespace infra { | ||
| 9 | struct stat : public sim { | ||
| 10 | std::string name; | ||
| 11 | std::uint64_t numerator = 0; | ||
| 12 | std::uint64_t denominator = 0; | ||
| 13 | |||
| 14 | stat(std::string name) | ||
| 15 | : name(std::move(name)) | ||
| 16 | { } | ||
| 17 | |||
| 18 | ~stat() { | ||
| 19 | fmt::print("# {} {}\n", name, (double)numerator/(double)denominator); | ||
| 20 | } | ||
| 21 | |||
| 22 | void unclock() { | ||
| 23 | ++denominator; | ||
| 24 | } | ||
| 25 | |||
| 26 | stat & operator++() { | ||
| 27 | ++numerator; | ||
| 28 | return *this; | ||
| 29 | } | ||
| 30 | |||
| 31 | stat & operator++(int) { | ||
| 32 | return operator++(); | ||
| 33 | } | ||
| 34 | }; | ||
| 35 | } | ||
