Aria  2.8.0
ArSystemStatus Class Reference

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

#include <ArSystemStatus.h>

Static Public Member Functions

static double getCPU ()
 Get CPU work to idle ratio since last refresh. More...
 
static double getCPUPercent ()
 Get CPU usage as percentage since last refresh. More...
 
static std::string getCPUPercentAsString ()
 Get CPU percentage in a string.
 
static ArRetFunctor< double > * getCPUPercentFunctor ()
 
static unsigned long getProgramUptime ()
 Get program's uptime (seconds)
 
static ArRetFunctor< unsigned long > * getProgramUptimeFunctor ()
 
static unsigned long getUptime ()
 Get total system uptime (seconds)
 
static ArRetFunctor< unsigned long > * getUptimeFunctor ()
 
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 ()
 Get wireless network total discarded packets (for first configured wireless device). More...
 
static int getWirelessDiscardedPacketsBecauseNetConflict ()
 Get wireless network packets discarded because of a conflict with another network (for first configured wireless device). More...
 
static int getWirelessLinkNoise ()
 Get wireless network noise level (for first configured wireless device). More...
 
static ArRetFunctor< int > * getWirelessLinkNoiseFunctor ()
 
static int getWirelessLinkQuality ()
 Get wireless network general link quality heuristic (for first configured wireless device). More...
 
static ArRetFunctor< int > * getWirelessLinkQualityFunctor ()
 
static int getWirelessLinkSignal ()
 Get wireless netork signal level (for first configured wireless device). More...
 
static ArRetFunctor< int > * getWirelessLinkSignalFunctor ()
 
static void invalidate ()
 
static void refresh ()
 
static void runRefreshThread (int refreshFrequency=5000)
 
static void startPeriodicUpdate (int refreshFrequency=5000, ArLog::LogLevel logLevel=ArLog::Verbose)
 Create a new thread which periodically invalidates cached data, causing it to be recalculated when next accessed. More...
 
static void stopPeriodicUpdate ()
 Stop periodic update thread. More...
 

Detailed Description

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

Normally, calling any accessor to read a value will query the operating system to get the most recent value. However, if you will be accessing data very frequently and want those calls to be faster, you can start a thread by calling startPeriodicUpdate() which will periodically query new values from the operating system and cache them for accessors to return.

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

Member Function Documentation

◆ getCPU()

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

◆ getCPUPercent()

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

◆ getCPUPercentFunctor()

ArRetFunctor< double > * ArSystemStatus::getCPUPercentFunctor ( )
static
Returns
Pointer to a functor which can be used to retrieve the current CPU percentage

◆ getProgramUptimeFunctor()

ArRetFunctor< unsigned long > * ArSystemStatus::getProgramUptimeFunctor ( )
static
Returns
Pointer to a functor which can be used to retrieve the current uptime (hours)

◆ getUptimeFunctor()

ArRetFunctor< unsigned long > * ArSystemStatus::getUptimeFunctor ( )
static
Returns
Pointer to a functor which can be used to retrieve the current uptime (hours)

◆ getUptimeHoursFunctor()

ArRetFunctor< double > * ArSystemStatus::getUptimeHoursFunctor ( )
static
Returns
Pointer to a functor which can be used to retrieve the current uptime (hours)

◆ getWirelessDiscardedPackets()

int ArSystemStatus::getWirelessDiscardedPackets ( )
static

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

◆ getWirelessDiscardedPacketsBecauseNetConflict()

int ArSystemStatus::getWirelessDiscardedPacketsBecauseNetConflict ( )
static

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

◆ getWirelessLinkNoise()

int ArSystemStatus::getWirelessLinkNoise ( )
static

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

◆ getWirelessLinkQuality()

int ArSystemStatus::getWirelessLinkQuality ( )
static

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

◆ getWirelessLinkSignal()

int ArSystemStatus::getWirelessLinkSignal ( )
static

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

◆ refresh()

static void ArSystemStatus::refresh ( )
inlinestatic
Deprecated:
Calling this function is no longer neccesary.

◆ runRefreshThread()

static void ArSystemStatus::runRefreshThread ( int  refreshFrequency = 5000)
inlinestatic
Deprecated:
use startPeriodicUpdate() which has a better name.

◆ startPeriodicUpdate()

void ArSystemStatus::startPeriodicUpdate ( int  refreshFrequency = 5000,
ArLog::LogLevel  logLevel = ArLog::Verbose 
)
static

Create a new thread which periodically invalidates cached data, causing it to be recalculated when next accessed.

INTERNAL_CLASSES.

Starting this thread is optional; start it if you will be accessing the data frequently, so that is doesn't need to be re-read and re-calculated on each access. If you will only be accessing the data occasionally, you do not need to start the update thread, it will be updated each time you read a value.

◆ stopPeriodicUpdate()

void ArSystemStatus::stopPeriodicUpdate ( )
static

Stop periodic update thread.

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


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