Inca::Process::Profiler - Reports a process's resource usage
use Inca::Process::Profiler; my $profiler = new Inca::Process::Profiler(); $profiler->addProcess( $$ ); $profiler->getUsage(); # returns object of type Inca::Process::Usage
Will query the system's ps command for current resource usage for a process or process group. This code is based on a code sample from Jim Hayes'.
Class constructor which returns a new Inca::Process::Profiler object.
Add any number of pgids (process group ids) to gather usage data from.
Arguments:
- pgids
An array of pgids that will used to collect usage data from.
Add any number of pids to gather usage data from.
Arguments:
- pids
An array of pids that will used to collect usage data from.
Return the pgids being monitored for usage.
Returns:
An array of pgids that is being used to collect usage data from.
Return the pids being monitored for usage.
Returns:
An array of pids that is being used to collect usage data from.
Get the current resource usage of all of the pids and pgids that have been added to the object.
Options:
- cumulative
If true, getUsage() will return the cumulative resource usage of all monitored pids and pgids. Otherwise, getUsage() will return a reference to a hash array where the keys are the pids and the values are Inca::Process::Usage objects. [default: 1]
Returns:
Returns an object of type Inca::Process::Usage if the cumulative option is set. Otherwise, returns a reference to a hash array where the keys are pids and the values are Inca::Process::Usage objects.
Shava Smallen <ssmallen@sdsc.edu>
Only works on unix variants where ps option -o is supported.