Inheritance diagram for lm::LoadMonitor::NetworkStats:
Public Member Functions | |
NetworkStats (void) | |
Constructor. | |
virtual | ~NetworkStats (void) |
Destructor. | |
virtual bool | QueryData (LoadSample &target) |
Collect data and store them in the sample. | |
virtual bool | QueryData (HardwareDescription &target) |
Collect data and store their descriptions. | |
Private Attributes | |
unsigned long long | last_time |
Timestamp of the last measurement. | |
std::vector< std::pair< long long, long long > > | data |
List of pairs of read-write bytes for each interface. | |
Data Structures | |
class | OneInterfaceStats |
Stores data read from /proc/net/dev file for one interface. More... |
lm::LoadMonitor::NetworkStats::NetworkStats | ( | void | ) |
Constructor.
lm::LoadMonitor::NetworkStats::~NetworkStats | ( | void | ) | [virtual] |
Destructor.
bool lm::LoadMonitor::NetworkStats::QueryData | ( | HardwareDescription & | description | ) | [virtual] |
Collect data and store their descriptions.
This will parse /proc/dev/net file and extract name of each interface mentioned in the file.
description | Structure which will receive data collected by this provider. |
Implements lm::LoadMonitor::StatsProvider.
bool lm::LoadMonitor::NetworkStats::QueryData | ( | LoadSample & | sample | ) | [virtual] |
Collect data and store them in the sample.
This methods read /proc/net/dev file and extracts data from the "read bytes" and "write bytes" columns. If at least one sample has been taken prior call, statistics for the time between two samples is calculated. Otherwise result is set to all zeroes for all interfaces.
sample | Structure which will receive data collected by this provider. |
Implements lm::LoadMonitor::StatsProvider.
std::vector< std::pair< long long, long long > > lm::LoadMonitor::NetworkStats::data [private] |
List of pairs of read-write bytes for each interface.
unsigned long long lm::LoadMonitor::NetworkStats::last_time [private] |
Timestamp of the last measurement.