CpuUsage Class Reference
#include <CpuUsage.hpp>
Collaboration diagram for CpuUsage:
[legend]List of all members.
Detailed Description
CpuUsage - Utility class to measure Cpu Usage.
This class was designed to constantly measure CPU utilization on Linux systems. Basically, it starts a thread that periodically gathers information from the OS (via /proc), and reports the last average CPU utilization when queried.
CpuUsage is a singleton, since ther is no reason to have more than one CPU measurer in our system.
- Author:
- Andrei Goldchleger
Constructor & Destructor Documentation
CpuUsage::CpuUsage |
( |
|
) |
[private] |
|
Member Function Documentation
void CpuUsage::cpuLoop |
( |
|
) |
[private] |
|
|
CPU Measurement function (an infinite loop). |
void * CpuUsage::cpuLoopWrapper |
( |
void * |
ptr |
) |
[static, private] |
|
|
cpuLoop wrapper. Needed because pthreads require a function pointer |
CpuUsage & CpuUsage::getInstance |
( |
|
) |
[static] |
|
|
Returns a reference to CpuUsage's singleton. |
float CpuUsage::utilization |
( |
|
) |
|
|
|
Returns average CPU utilization.
Returns a float in the range [0..100] representing the average CPU utilization since last call. |
Member Data Documentation
|
time between CPU usage measurements |
|
protects CPU utilization from race conditions |
|
thread that keeps collecting CPU availability |
|
CPU utilization in current interval |
|
diference bettween current and last measurement |
The documentation for this class was generated from the following files:
Generated on Mon Sep 6 16:13:10 2004 by
1.3.3