Class CpuStat

Description

Class to wrap a single cpu line as contained in the '/proc/stat'.

This class is a wrapper around the counts found in a single cpu line in the /proc/stat entry. Typically, there will be one line representing ALL CPUs ('cpu') followed by a separate line for each individual CPU (or core) ('cpu0', 'cpu1', ...).

See: man 5 proc for details about: /proc/stat.

Typically, this class is not used by itself, but indirectly via the ProcStat class.


 NOTE: Starting with the 2.6.24 series of kernels, a 9th value  was added to the CPU lines in /proc/stat. From my quick google, it  appears to be a Guest CPU accounting value.

NOTE: Starting with the 2.6.33 series of kernels, a 10th value was added to the CPU lines in /proc/stat. From searching stat.c in the kernel source Ron identified it as Guest Nice CPU accounting value.

Located in /lib/ProcStat.php (line 51)


	
			
Method Summary
static CpuStat add (CpuStat $a, CpuStat $b)
static CpuStat newInstance (array $a)
static CpuStat subtract (CpuStat $a, CpuStat $b)
Integer getGuestCount ()
Integer getGuestNiceCount ()
Integer getHardIrqCount ()
Integer getIdleCount ()
Integer getIoWaitCount ()
String getLabel ()
Real getRatioBusy ()
Real getRatioNotBusy ()
Integer getSoftIrqCount ()
Integer getStolenCount ()
Integer getSystemCount ()
Integer getTotalBusy ()
Integer getTotalCount ()
Integer getTotalNotBusy ()
Integer getUserCount ()
Integer getUserNiceCount ()
Methods
static method add (line 263)

Takes two CpuStat objects (adding B to A) and return new results.

This method is used to create a new instance of a CpuStat object which is the result of adding one instance from another. This is useful if you have multiple delta CpuStat objects which you want to combine.

  • return: object which is the results of: ($a + $b).
  • access: public
static CpuStat add (CpuStat $a, CpuStat $b)
  • CpuStat $a: The CpuStat object to add to ($a + $b).
  • CpuStat $b: What to add to $a.
static method newInstance (line 227)

Takes two CpuStat objects (adding B to A) and return new results.

This method is used to create a new instance of a CpuStat object which is the result of adding one instance from another. This is useful if you have multiple delta CpuStat objects which you want to combine.

  • return: object if $a was OK, or false if not.
  • access: public
static CpuStat newInstance (array $a)
  • array $a: Array of values from single cpu line out of /proc/stat.
static method subtract (line 295)

Takes two CpuStat objects (subtracting B from A) and return new results.

This method is used to create a new instance of a CpuStat object which is the result of subtractng one instance from another. This is useful to compute the delta between two different CpuStat readings.

  • return: object which is the results of: ($a - $b).
  • access: public
static CpuStat subtract (CpuStat $a, CpuStat $b)
  • CpuStat $a: The CpuStat object to be subtracted from ($a - $b).
  • CpuStat $b: What to subtract from $a.
getGuestCount (line 151)

Count of time accounted for by Guest CPU (starting in 2.6.24)?

  • return: count of time (not shown by top at time of this writing).
  • access: public
Integer getGuestCount ()
getGuestNiceCount (line 159)

Count of time accounted for by Guest Nice CPU (starting in 2.6.33)?

  • return: count of time (not shown by top at time of this writing).
  • access: public
Integer getGuestNiceCount ()
getHardIrqCount (line 127)

Count of time CPU spent servicing IRQ.

  • return: count of time servicing IRQs.
  • access: public
Integer getHardIrqCount ()
getIdleCount (line 111)

Count of time CPU spent in doing nothing.

  • return: count of time the CPU was idle.
  • access: public
Integer getIdleCount ()
getIoWaitCount (line 119)

Count of time CPU spent in I/O wait mode.

  • return: count of time in I/O wait mode.
  • access: public
Integer getIoWaitCount ()
getLabel (line 75)

Access label ('cpu' for summary, or 'cpuN' for individual core).

  • return: identifying which CPU (or core), or 'cpu' if summary.
  • access: public
String getLabel ()
getRatioBusy (line 208)

Ratio of time the CPU was busy (in range of [0, 1.0]).

  • return: number in range of [0, 1.0] that the CPU was working.
  • access: public
Real getRatioBusy ()
getRatioNotBusy (line 187)

Ratio of time the CPU was NOT busy (in range of [0, 1.0]).

  • return: number in range of [0, 1.0] that the CPU was waiting for something to do.
  • access: public
Real getRatioNotBusy ()
getSoftIrqCount (line 135)

Count of time CPU spent servicing soft IRQ.

  • return: count of time servicing soft IRQs.
  • access: public
Integer getSoftIrqCount ()
getStolenCount (line 143)

Count of time stolen from CPU (by virtualization?).

  • return: count of time stolen from CPU (%st in top).
  • access: public
Integer getStolenCount ()
getSystemCount (line 102)

Count of time CPU spent in system mode.

  • return: count of time in system code.
  • access: public
Integer getSystemCount ()
getTotalBusy (line 199)

Total of all of the counts related to the CPU being busy.

  • return: count of time the CPU was busy doing something.
  • access: public
Integer getTotalBusy ()
getTotalCount (line 168)

Total of ALL counts in the CPU usage array.

  • return: count of time in user code.
  • access: public
Integer getTotalCount ()
getTotalNotBusy (line 177)

Total of getIdleCount() and getIoWaitCount().

  • return: count of time spent waiting for something to do.
  • access: public
Integer getTotalNotBusy ()
getUserCount (line 84)

Count of time CPU spent in user mode.

  • return: count of time in user code.
  • access: public
Integer getUserCount ()
getUserNiceCount (line 93)

Count of time CPU spent in user nice mode.

  • return: count of time in user nice code.
  • access: public
Integer getUserNiceCount ()

Documentation generated on Sun, 11 Feb 2018 07:41:02 -0500 by phpDocumentor 1.4.4