NAME

Proc::CPUUsage - measures the percentage of CPU the current process is using

VERSION

version 1.002

SYNOPSIS

    my $cpu = Proc::CPUUsage->new;
    my $usage1 = $cpu->usage; ## returns usage since new()
    my $usage2 = $cpu->usage; ## returns usage since last usage()
    ...

DESCRIPTION

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.

METHODS

new()

    $cpu = Proc::CPUUsage->new()

Creates a new Proc::CPUUsage object with the current values for CPU usage.

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.

SEE ALSO

AnyEvent::Monitor::CPU for a more practical use for this module.

AUTHOR

Pedro Melo, <melo at cpan.org>

COPYRIGHT & LICENSE

Copyright 2009 Pedro Melo.

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