SatCat5
satcat5::cfg::NetworkStats Class Reference

Detailed Description

Traffic statistics polling.

Define a memory-mapped interface to the "config_stats" block. It can be refreshed manually, or instructed to refresh automatically at a fixed interval (e.g., once per second).

Definition at line 49 of file cfgbus_stats.h.

#include <cfgbus_stats.h>

Collaboration diagram for satcat5::cfg::NetworkStats:
[legend]

Public Member Functions

 NetworkStats (satcat5::cfg::ConfigBus *cfg, unsigned devaddr)
 Construct a memory-map for the designated ConfigBus device.
 
void refresh_now ()
 Immediately refresh statistics for every port. More...
 
satcat5::cfg::TrafficStats get_port (unsigned idx)
 Read most recent statistics for the Nth port. More...
 

Private Attributes

satcat5::cfg::Register m_traffic
 

Member Function Documentation

◆ get_port()

cfg::TrafficStats satcat5::cfg::NetworkStats::get_port ( unsigned  idx)

Read most recent statistics for the Nth port.

(Call "refresh_now()" at regular intervals to update statistics.)

Definition at line 36 of file cfgbus_stats.cc.

◆ refresh_now()

void satcat5::cfg::NetworkStats::refresh_now ( )

Immediately refresh statistics for every port.

Each call to refresh_now() executes the following atomically:

  • Copies the value of each internal counter to a separate read-only register that is accessible through get_port().
  • Resets all internal counters to zero. As a result, read-only registers indicate the amount of new traffic between the two preceding calls to refresh_now(). Implementations MUST call this function regularly.

Definition at line 31 of file cfgbus_stats.cc.


The documentation for this class was generated from the following files: