diff options
| author | Stefan Boberg <[email protected]> | 2021-10-11 13:26:02 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-10-11 13:26:02 +0200 |
| commit | eab4a19e846df1696c1fac5b25ec0e7327e8d32b (patch) | |
| tree | 37a6ea15fd48e9dfef3705b18852a8de1ef78c54 | |
| parent | stats: Added support for handler unregistration (diff) | |
| download | zen-eab4a19e846df1696c1fac5b25ec0e7327e8d32b.tar.xz zen-eab4a19e846df1696c1fac5b25ec0e7327e8d32b.zip | |
Ratios should not be percentages (this should be done in presentation)
| -rw-r--r-- | zenserver/cache/structuredcache.cpp | 4 | ||||
| -rw-r--r-- | zenserver/upstream/upstreamcache.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/zenserver/cache/structuredcache.cpp b/zenserver/cache/structuredcache.cpp index 5166bee42..35cb02cbb 100644 --- a/zenserver/cache/structuredcache.cpp +++ b/zenserver/cache/structuredcache.cpp @@ -887,9 +887,9 @@ HttpStructuredCacheService::HandleStatsRequest(zen::HttpServerRequest& Request) Cbo.BeginObject("cache"); Cbo << "hits" << HitCount << "misses" << MissCount; - Cbo << "hit_ratio" << (TotalCount > 0 ? (double(HitCount) / double(TotalCount) * 100.0) : 0.0); + Cbo << "hit_ratio" << (TotalCount > 0 ? (double(HitCount) / double(TotalCount)) : 0.0); Cbo << "upstream_hits" << m_CacheStats.UpstreamHitCount; - Cbo << "upstream_ratio" << (HitCount > 0 ? (double(UpstreamHitCount) / double(HitCount)) * 100.0 : 0.0); + Cbo << "upstream_ratio" << (HitCount > 0 ? (double(UpstreamHitCount) / double(HitCount)) : 0.0); Cbo.EndObject(); if (m_UpstreamCache) diff --git a/zenserver/upstream/upstreamcache.cpp b/zenserver/upstream/upstreamcache.cpp index 5b2629f72..168449d05 100644 --- a/zenserver/upstream/upstreamcache.cpp +++ b/zenserver/upstream/upstreamcache.cpp @@ -697,7 +697,7 @@ struct UpstreamStats const double UpSpeed = UpBytes > 0 ? UpBytes / SecondsUp : 0.0; const double DownSpeed = DownBytes > 0 ? DownBytes / SecondsDown : 0.0; const uint64_t TotalCount = HitCount + MissCount; - const double HitRate = TotalCount > 0 ? (double(HitCount) / double(TotalCount)) * 100.0 : 0.0; + const double HitRate = TotalCount > 0 ? (double(HitCount) / double(TotalCount)) : 0.0; Logger.debug("STATS - '{}', Hit rate: {:.2f}%, DOWN: '{:.2f} MiB {:.2f} MiB/s', UP: '{:.2f} MiB {:.2f} MiB/s'", Ep->DisplayName(), @@ -842,7 +842,7 @@ public: const uint64_t HitCount = Stats.HitCount; const uint64_t MissCount = Stats.MissCount; const uint64_t TotalCount = HitCount + MissCount; - const double HitRate = TotalCount > 0 ? (double(HitCount) / double(TotalCount)) * 100.0 : 0.0; + const double HitRate = TotalCount > 0 ? (double(HitCount) / double(TotalCount)) : 0.0; Status << "hit_ratio" << HitRate; Status << "downloaded_mb" << Stats.DownBytes; |