NAME

Sys::Statistics::Linux::CpuStats - Collect linux cpu statistics.

SYNOPSIS

use Sys::Statistics::Linux::CpuStats;

my $lxs = new Sys::Statistics::Linux::CpuStats;
$lxs->init;
sleep 1;
my $stats = $lxs->get;

DESCRIPTION

Sys::Statistics::Linux::CpuStats gathers cpu statistics from the virtual /proc filesystem (procfs).

For more informations read the documentation of the front-end module Sys::Statistics::Linux.

CPU STATISTICS

Generated by /proc/stat for each cpu (cpu0, cpu1 ...). cpu without a number is the summary.

user    -  Percentage of CPU utilization at the user level.
nice    -  Percentage of CPU utilization at the user level with nice priority.
system  -  Percentage of CPU utilization at the system level.
idle    -  Percentage of time the CPU is in idle state.
iowait  -  Percentage of time the CPU is in idle state because an i/o operation is waiting for a disk.
           This statistic is only available by kernel versions higher than 2.4. Otherwise this statistic
           exists but will be ever 0.
total   -  Total percentage of CPU utilization (user + nice + system).

METHODS

new()

Call new() to create a new object.

my $lxs = new Sys::Statistics::Linux::CpuStats;

init()

Call init() to initialize the statistics.

$lxs->init;

get()

Call get() to get the statistics. get() returns the statistics as a hash reference.

my $stats = $lxs->get;

EXPORTS

No exports.

SEE ALSO

proc(5)

REPORTING BUGS

Please report all bugs to <jschulz.cpan(at)bloonix.de>.

AUTHOR

Jonny Schulz <jschulz.cpan(at)bloonix.de>.

COPYRIGHT

Copyright (c) 2006, 2007 by Jonny Schulz. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.