Package DE_EPAGES::Core::API::Process
API functions for working with processes
@EXPORT_OK |
Functions
- GetCurrentProcessID
- GetProcessMemory
- GetProcessStat
- PurgeBackgroundProcesses
- RunningProcessExists
- SetProcessPriority
- ShowBackgroundProcesses
- WaitForBackgroundProcesses
GetCurrentProcessID
Returns the process id of the current process.
Syntax |
$ProcessID = GetCurrentProcessID(); |
Return |
|
GetProcessMemory
Returns the amount of memory used by a process.
Syntax |
$MemSize = GetProcessMemory( $ProcessID ); |
Example |
print GetProcessMemory( GetCurrentProcessID() ) . " bytes used by this process"; |
Input |
|
Return |
|
GetProcessStat
Returns information retrieved from /proc/<PID>/stat as hash.
Syntax |
$hStat = GetProcessStat( $ProcessID ); |
Input |
|
Return |
|
PurgeBackgroundProcesses
Checks if process created by Proc::Background->new() are still alive. Processes older than $Timeout seconds are killed. The returned $aProcesses list does not contain dead processes.
Syntax |
$aProcesses = PurgeBackgroundProcesses($aProcessList, $ProcessParam) |
Example |
PurgeBackgroundProcesses([Proc::Background->new("sleep 5")]) |
Input |
|
Return |
|
RunningProcessExists
Returns true if the process with giving process id exists.
Syntax |
$IsRunning = RunningProcessExists($ProcessID); |
Input |
|
Return |
|
SetProcessPriority
Sets the Priority of a process.
Syntax |
SetProcessPriority( $ProcessID, $Priority ) |
Example |
SetProcessPriority( GetCurrentProcessID(), 'ABOVE_NORMAL' ); |
Input |
|
ShowBackgroundProcesses
Shows processes in $ProcessList created by Proc::Background->new().
Syntax |
ShowBackgroundProcesses($ProcessList, $StartTime) |
Example |
ShowBackgroundProcesses([Proc::Background->new("sleep 5")], time) |
Input |
|
Return |
|
WaitForBackgroundProcesses
Waits until processes in $ProcessList created by Proc::Background->new() have finished.
Syntax |
WaitForBackgroundProcesses($ProcessList, $ProcessParam) |
Example |
WaitForBackgroundProcesses([Proc::Background->new("sleep 5")]) |
Input |
|
Return |
|