The last seconds of the network statistics, for the graphs of the lagometer.
More...
#include </__w/project-rtype/project-rtype/client/network/include/rtype/lagometer.hpp>
|
| using | Clock = std::chrono::steady_clock |
| | Clock of the samples.
|
| |
|
| void | update (const aegis2d::net::RttEstimator &rtt, const aegis2d::net::TrafficCounters &traffic, const NetworkStats &stats, Clock::time_point now, std::uint64_t corrections=0) |
| | Takes a sample of the statistics if sample_interval went by since the last one.
|
| |
| void | add (const LagSample &sample) |
| | Adds a sample, forgetting the oldest beyond length.
|
| |
| void | clear () noexcept |
| | Forgets every sample, for a new session.
|
| |
| const std::deque< LagSample > & | samples () const noexcept |
| | The samples kept.
|
| |
| LagSample | latest () const noexcept |
| | The last sample.
|
| |
| double | scale (LagGraph graph) const noexcept |
| | Top of a graph: its largest value kept, but never below a floor (100 ms for the RTT, 10 % for the loss...), so that a sound link draws low bars.
|
| |
|
| static constexpr std::chrono::milliseconds | sample_interval {100} |
| | Time between two samples.
|
| |
| static constexpr std::size_t | length = 100 |
| | Samples kept: the last 10 seconds.
|
| |
The last seconds of the network statistics, for the graphs of the lagometer.
update() takes a sample every sample_interval and keeps the last length ones, oldest first: a graph draws one bar per sample, on the scale() of its graph.
◆ Clock
◆ add()
| void rtype::Lagometer::add |
( |
const LagSample & |
sample | ) |
|
Adds a sample, forgetting the oldest beyond length.
- Parameters
-
◆ clear()
| void rtype::Lagometer::clear |
( |
| ) |
|
|
noexcept |
Forgets every sample, for a new session.
◆ latest()
The last sample.
- Returns
- It, or a sample of zeros before the first one.
◆ samples()
| const std::deque< LagSample > & rtype::Lagometer::samples |
( |
| ) |
const |
|
noexcept |
The samples kept.
- Returns
- At most length samples, oldest first.
◆ scale()
| double rtype::Lagometer::scale |
( |
LagGraph |
graph | ) |
const |
|
noexcept |
Top of a graph: its largest value kept, but never below a floor (100 ms for the RTT, 10 % for the loss...), so that a sound link draws low bars.
- Parameters
-
- Returns
- The value drawn at the full height of the graph.
◆ update()
| void rtype::Lagometer::update |
( |
const aegis2d::net::RttEstimator & |
rtt, |
|
|
const aegis2d::net::TrafficCounters & |
traffic, |
|
|
const NetworkStats & |
stats, |
|
|
Clock::time_point |
now, |
|
|
std::uint64_t |
corrections = 0 |
|
) |
| |
Takes a sample of the statistics if sample_interval went by since the last one.
- Parameters
-
| rtt | Round trip time to the server. |
| traffic | Datagrams exchanged with the server. |
| stats | Loss and snapshots of the server's datagrams. |
| now | Current time. |
| corrections | Corrections of the predicted ship so far (ShipPrediction::corrections()): the sample gives those since the last one, per second. |
◆ length
| constexpr std::size_t rtype::Lagometer::length = 100 |
|
staticconstexpr |
Samples kept: the last 10 seconds.
◆ sample_interval
| constexpr std::chrono::milliseconds rtype::Lagometer::sample_interval {100} |
|
staticconstexpr |
Time between two samples.
The documentation for this class was generated from the following file:
- /__w/project-rtype/project-rtype/client/network/include/rtype/lagometer.hpp