Proc::CPUUsage - measures the percentage of CPU the current process is using
version 1.002
my $cpu = Proc::CPUUsage->new; my $usage1 = $cpu->usage; ## returns usage since new() my $usage2 = $cpu->usage; ## returns usage since last usage() ...
This module allows you to measure how much CPU your perl process is using.
The construction of the object defines the inital values. Each call to "usage()" returns the CPU usage since the last call to "new()" or "usage()".
The value returned is normalised between 0 and 1, the latter being 100% usage.
$cpu = Proc::CPUUsage->new()
Creates a new Proc::CPUUsage object with the current values for CPU usage.
$usage = $cpu->usage()
Returns the CPU usage since the last call to "new()" or "usage()".
The value returned is greater than 0 and lower or equal to 1.
AnyEvent::Monitor::CPU for a more practical use for this module.
Pedro Melo, <melo at cpan.org>
<melo at cpan.org>
Copyright 2009 Pedro Melo.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Proc::CPUUsage, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Proc::CPUUsage
CPAN shell
perl -MCPAN -e shell install Proc::CPUUsage
For more information on module installation, please visit the detailed CPAN module installation guide.