ArSystemStatus Class Reference

#include <ArSystemStatus.h>

List of all members.


Detailed Description

Utility to get statistics about the host operating system (CPU usage, wireless link data, etc).

This class is only implemented for Linux; on Windows you will get invalid information.

Todo:
Add a function and functor that formats uptime like "X years, X months, X days, X hours, X min, X sec." (omitting 0 values).

Definition at line 42 of file ArSystemStatus.h.

Static Public Member Functions

static double getCPU ()
static double getCPUPercent ()
static std::string getCPUPercentAsString ()
 Get CPU percentage in a string.
static ArRetFunctor< double > * getCPUPercentFunctor ()
static unsigned long getUptime ()
 Get total system uptime (seconds).
static double getUptimeHours ()
 Get total system uptime (hours).
static std::string getUptimeHoursAsString ()
 Get total system uptime in a string (hours).
static ArRetFunctor< double > * getUptimeHoursFunctor ()
static int getWirelessDiscardedPackets ()
static int getWirelessDiscardedPacketsBecauseNetConflict ()
static int getWirelessLinkNoise ()
static ArRetFunctor< int > * getWirelessLinkNoiseFunctor ()
static int getWirelessLinkQuality ()
static ArRetFunctor< int > * getWirelessLinkQualityFunctor ()
static int getWirelessLinkSignal ()
static ArRetFunctor< int > * getWirelessLinkSignalFunctor ()
static void invalidate ()
static void refresh ()
static void runRefreshThread (int refreshFrequency=5000)
static void startPeriodicUpdate (int refreshFrequency=5000)
static void stopPeriodicUpdate ()


Member Function Documentation

double ArSystemStatus::getCPU (  )  [static]

Get CPU work to idle ratio since last refresh. This is a value ranging from (0 .. 1) X (Num. CPUs). (Therefore if you have two CPUs, the maximum value will be 2.0, or 200%.) This value is calculated as the percentage of time the CPU spent doing work (not in "idle" state) since the previous calculation.

Returns:
CPU usage value, or -1 if unable to determine

Definition at line 161 of file ArSystemStatus.cpp.

double ArSystemStatus::getCPUPercent (  )  [static]

Get CPU usage as percentage since last refresh. This is a value ranging from (0..100) X (Num. CPUs). (Therefore if you have two CPUs, the maximum value will be 200%).

See also:
getCPU()
Returns:
CPU usage as percentage, or -1 if not able to determine

Definition at line 167 of file ArSystemStatus.cpp.

ArRetFunctor< double > * ArSystemStatus::getCPUPercentFunctor (  )  [static]

Returns:
Pointer to a functor which can be used to retrieve the current CPU percentage

Definition at line 214 of file ArSystemStatus.cpp.

ArRetFunctor< double > * ArSystemStatus::getUptimeHoursFunctor (  )  [static]

Returns:
Pointer to a functor which can be used to retrieve the current uptime (hours)

Definition at line 219 of file ArSystemStatus.cpp.

int ArSystemStatus::getWirelessDiscardedPackets (  )  [static]

Get wireless network total discarded packets (for first configured wireless device).

Definition at line 300 of file ArSystemStatus.cpp.

int ArSystemStatus::getWirelessDiscardedPacketsBecauseNetConflict (  )  [static]

Get wireless network packets discarded because of a conflict with another network (for first configured wireless device).

Definition at line 306 of file ArSystemStatus.cpp.

int ArSystemStatus::getWirelessLinkNoise (  )  [static]

Get wireless network noise level (for first configured wireless device).

Definition at line 294 of file ArSystemStatus.cpp.

int ArSystemStatus::getWirelessLinkQuality (  )  [static]

Get wireless network general link quality heuristic (for first configured wireless device).

Definition at line 282 of file ArSystemStatus.cpp.

int ArSystemStatus::getWirelessLinkSignal (  )  [static]

Get wireless network signal level (for first configured wireless device).

Definition at line 288 of file ArSystemStatus.cpp.

static void ArSystemStatus::refresh (  )  [inline, static]

Deprecated:
Calling this function is no longer neccesary.

Definition at line 128 of file ArSystemStatus.h.

static void ArSystemStatus::runRefreshThread ( int  refreshFrequency = 5000  )  [inline, static]

Deprecated:
use startPeriodicUpdate() which has a better name.

Definition at line 57 of file ArSystemStatus.h.

void ArSystemStatus::startPeriodicUpdate ( int  refreshFrequency = 5000  )  [static]

Create a new thread which periodically invalidates cached data, causing it to be recalculated when next accessed. Use this if you will be accessing the data too frequently to require it to be recacluted on each access.

Definition at line 140 of file ArSystemStatus.cpp.

void ArSystemStatus::stopPeriodicUpdate (  )  [static]

Stop periodic update thread. Henceforth any access of data will cause it to be re-read and recalculated.

Definition at line 151 of file ArSystemStatus.cpp.


The documentation for this class was generated from the following files:
Generated on Fri Dec 1 10:55:19 2006 for Aria by  doxygen 1.4.7