lm::LoadMonitor::NetworkStats Class Reference

Collects data about network traffic on the computer. More...

Inheritance diagram for lm::LoadMonitor::NetworkStats:

lm::LoadMonitor::StatsProvider

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...

Detailed Description

Collects data about network traffic on the computer.


Constructor & Destructor Documentation

lm::LoadMonitor::NetworkStats::NetworkStats ( void   ) 

Constructor.

lm::LoadMonitor::NetworkStats::~NetworkStats ( void   )  [virtual]

Destructor.


Member Function Documentation

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.

Parameters:
description Structure which will receive data collected by this provider.
Returns:
true on success, false otherwise.

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.

Parameters:
sample Structure which will receive data collected by this provider.
Returns:
true on success, false otherwise.

Implements lm::LoadMonitor::StatsProvider.


Field Documentation

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.


The documentation for this class was generated from the following files:
Generated on Tue Dec 19 17:43:49 2006 for Load Monitor for Linux by  doxygen 1.4.7