Pike v8.1 release 6

Method System.getrusage()


Method getrusage

mapping(string:int) getrusage()

Description

Return resource usage about the current process. An error is thrown if it isn't supported or if the system fails to return any information.

Returns

Returns a mapping describing the current resource usage:

"utime" : int

Time in milliseconds spent in user code.

"stime" : int

Time in milliseconds spent in system calls.

"maxrss" : int

Maximum used resident size in kilobytes. [1]

"ixrss" : int

Quote from GNU libc: An integral value expressed in kilobytes times ticks of execution, which indicates the amount of memory used by text that was shared with other processes. [1]

"idrss" : int

Quote from GNU libc: An integral value expressed the same way, which is the amount of unshared memory used for data. [1]

"isrss" : int

Quote from GNU libc: An integral value expressed the same way, which is the amount of unshared memory used for stack space. [1]

"minflt" : int

Minor page faults, i.e. TLB misses which required no disk I/O.

"majflt" : int

Major page faults, i.e. paging with disk I/O required.

"nswap" : int

Number of times the process has been swapped out entirely.

"inblock" : int

Number of block input operations.

"oublock" : int

Number of block output operations.

"msgsnd" : int

Number of IPC messsages sent.

"msgrcv" : int

Number of IPC messsages received.

"nsignals" : int

Number of signals received.

"nvcsw" : int

Number of voluntary context switches (usually to wait for some service).

"nivcsw" : int

Number of preemptions, i.e. context switches due to expired time slices, or when processes with higher priority were scheduled.

"sysc" : int

Number of system calls. [2]

"ioch" : int

Number of characters read and written. [2]

"rtime" : int

Elapsed real time (ms). [2]

"ttime" : int

Elapsed system trap (system call) time (ms). [2]

"tftime" : int

Text page fault sleep time (ms). [2]

"dftime" : int

Data page fault sleep time (ms). [2]

"kftime" : int

Kernel page fault sleep time (ms). [2]

"ltime" : int

User lock wait sleep time (ms). [2]

"slptime" : int

Other sleep time (ms). [2]

"wtime" : int

Wait CPU (latency) time (ms). [2]

"stoptime" : int

Time spent in stopped (suspended) state. [2]

"brksize" : int

Heap size. [3]

"stksize" : int

Stack size. [3]

Note

[1] Not if /proc rusage is used.

[2] Only from (Solaris?) /proc rusage.

[3] Only from /proc PRS usage.

On some systems, only utime will be filled in.

See also

gethrvtime()