diff options
| author | Per Larsson <[email protected]> | 2021-09-23 17:24:56 +0200 |
|---|---|---|
| committer | Per Larsson <[email protected]> | 2021-09-23 17:24:56 +0200 |
| commit | cbf8832318cd47d6379884d622dbceca8dea3e8c (patch) | |
| tree | 62310fd3b33f40cc9bbb9e454a05eb85a5fe1ca2 /zenserver/upstream/upstreamcache.h | |
| parent | Merge branch 'main' of https://github.com/EpicGames/zen (diff) | |
| download | zen-cbf8832318cd47d6379884d622dbceca8dea3e8c.tar.xz zen-cbf8832318cd47d6379884d622dbceca8dea3e8c.zip | |
Simpler upstream stats. Enabled with --upstream-stats.
Diffstat (limited to 'zenserver/upstream/upstreamcache.h')
| -rw-r--r-- | zenserver/upstream/upstreamcache.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/zenserver/upstream/upstreamcache.h b/zenserver/upstream/upstreamcache.h index 96ee8bddc..0e736480b 100644 --- a/zenserver/upstream/upstreamcache.h +++ b/zenserver/upstream/upstreamcache.h @@ -6,6 +6,7 @@ #include <zencore/iohash.h> #include <zencore/zencore.h> +#include <atomic> #include <chrono> #include <memory> @@ -40,6 +41,7 @@ struct UpstreamCacheOptions uint32_t ThreadCount = 4; bool ReadUpstream = true; bool WriteUpstream = true; + bool StatsEnabled = false; }; enum class UpstreamStatusCode : uint8_t @@ -79,6 +81,17 @@ struct UpstreamEndpointHealth bool Ok = false; }; +struct UpstreamEndpointStats +{ + std::atomic_uint64_t HitCount = {}; + std::atomic_uint64_t MissCount = {}; + std::atomic_uint64_t UpCount = {}; + std::atomic<double> UpBytes = {}; + std::atomic<double> DownBytes = {}; + std::atomic<double> SecondsUp = {}; + std::atomic<double> SecondsDown = {}; +}; + /** * The upstream endpont is responsible for handling upload/downloading of cache records. */ @@ -100,6 +113,8 @@ public: virtual PutUpstreamCacheResult PutCacheRecord(const UpstreamCacheRecord& CacheRecord, IoBuffer RecordValue, std::span<IoBuffer const> Payloads) = 0; + + virtual UpstreamEndpointStats& Stats() = 0; }; /** |