chronon::observe::DerivedFormula
Convenience formulas for common derived-counter patterns. More...
Attributes
| Name | |
|---|---|
| auto | Ratio a / (a + b) — hit rate, miss rate, etc. |
| auto | PerKilo a * 1000 / b — MPKI and similar per-kilo-instruction metrics. |
| auto | Divide a / b — IPC, throughput, etc. |
Detailed Description
Convenience formulas for common derived-counter patterns.
Example:
DerivedCounter hit_rate_{this, "hit_rate", "Hit rate",
{hits_, misses_}, DerivedFormula::Ratio};
Attributes Documentation
variable Ratio
auto Ratio = [](std::span<const uint64_t> v) -> double {
uint64_t d = v[0] + v[1];
return d > 0 ? static_cast<double>(v[0]) / d : 0.0;
};
a / (a + b) — hit rate, miss rate, etc.
variable PerKilo
auto PerKilo = [](std::span<const uint64_t> v) -> double {
return v[1] > 0 ? static_cast<double>(v[0]) * 1000.0 / v[1] : 0.0;
};
a * 1000 / b — MPKI and similar per-kilo-instruction metrics.
variable Divide
auto Divide = [](std::span<const uint64_t> v) -> double {
return v[1] > 0 ? static_cast<double>(v[0]) / v[1] : 0.0;
};
a / b — IPC, throughput, etc.
Updated on 2026-05-26 at 05:42:32 +0000