Rise
The Vieneo Province
Loading...
Searching...
No Matches
TelemetryUploadCadence.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4
5namespace Telemetry
6{
7 constexpr double ClientUploadIntervalSeconds = 0.05;
8 constexpr double DiscordPresenceIntervalSeconds = 15.0;
9
10 // A coalescing periodic gate: elapsed time is retained to avoid cadence drift,
11 // but a long frame can produce at most one event and never a catch-up burst.
13 {
14 public:
15 explicit PeriodicGate(double intervalSeconds);
16
17 bool Advance(double elapsedSeconds);
18 void Reset();
19 double IntervalSeconds() const;
20 double AccumulatedSeconds() const;
21
22 private:
24 double accumulatedSeconds_ = 0.0;
25 };
26
28 {
29 double packetsPerSecond = 0.0;
32 std::uint64_t totalPackets = 0;
33 bool hasPacket = false;
34 };
35
37 {
38 public:
39 void Reset();
40 void RecordPacket(double nowSeconds);
41 UploadMetrics GetMetrics(double nowSeconds) const;
42
43 private:
46 double lastPacketSeconds_ = 0.0;
47 std::uint32_t packetWindowCount_ = 0;
48 };
49
51}
PeriodicGate(double intervalSeconds)
bool Advance(double elapsedSeconds)
UploadMetrics GetMetrics(double nowSeconds) const
UploadDiagnostics gUploadDiagnostics
constexpr double ClientUploadIntervalSeconds
constexpr double DiscordPresenceIntervalSeconds