| Extracted from Pike v7.8 release 866 at 2016-04-05.

[Top]
7.4::

# Method rusage()

Method rusage

  `array(int) rusage()`

Description

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

Returns

  Returns an array of ints describing how much resources the interpreter process has used so far. This array will have at least 29 elements, of which those values not available on this system will be zero.

  The elements are as follows:

  Array
  `int user_time` | Time in milliseconds spent in user code.
  `int system_time` | Time in milliseconds spent in system calls.
  `int maxrss` | Maximum used resident size in kilobytes.
  `int ixrss` | 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.
  `int idrss` | Quote from GNU libc: An integral value expressed the same way, which is the amount of unshared memory used for data.
  `int isrss` | Quote from GNU libc: An integral value expressed the same way, which is the amount of unshared memory used for stack space.
  `int minor_page_faults` | Minor page faults, i.e. TLB misses which required no disk I/O.
  `int major_page_faults` | Major page faults, i.e. paging with disk I/O required.
  `int swaps` | Number of times the process has been swapped out entirely.
  `int block_input_op` | Number of block input operations.
  `int block_output_op` | Number of block output operations.
  `int messages_sent` | Number of IPC messsages sent.
  `int messages_received` | Number of IPC messsages received.
  `int signals_received` | Number of signals received.
  `int voluntary_context_switches` | Number of voluntary context switches (usually to wait for some service).
  `int involuntary_context_switches` | Number of preemptions, i.e. context switches due to expired time slices, or when processes with higher priority were scheduled.
  `int sysc` | Number of system calls.
  `int ioch` | Number of characters read and written.
  `int rtime` | Elapsed real time (ms).
  `int ttime` | Elapsed system trap (system call) time (ms).
  `int tftime` | Text page fault sleep time (ms).
  `int dftime` | Data page fault sleep time (ms).
  `int kftime` | Kernel page fault sleep time (ms).
  `int ltime` | User lock wait sleep time (ms).
  `int slptime` | Other sleep time (ms).
  `int wtime` | Wait CPU (latency) time (ms).
  `int stoptime` | Time spent in stopped (suspended) state.
  `int brksize` | Heap size.
  `int stksize` | Stack size.

  The values will not be further explained here; read your system manual for more information.

Note

  All values may not be present on all systems.

Deprecated
See also

  time() , System.getrusage()