package tally

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Tally_rusageSource

Sourceval v : int -> Tally.t

v pid measures the resource usage (via sysctl ctl_kern.kern_proc.kern_proc_pid on FreeBSD, /proc/<pid>/stat and /proc/<pid>/status on Linux) and reports the counters.

Sourcetype ru = {
  1. utime : int;
    (*

    user time in microseconds

    *)
  2. stime : int;
    (*

    system time in microseconds

    *)
  3. maxrss : int;
    (*

    maximum resident set size in kilobytes

    *)
  4. ixrss : int;
    (*

    integral shared text memory size in kilobytes * ticks-of-execution, only implemented on FreeBSD

    *)
  5. idrss : int;
    (*

    integral unshared data size in kilobytes * ticks-of-execution, only implemented on FreeBSD

    *)
  6. isrss : int;
    (*

    integral unshared stack size in kilobytes * ticks-of-execution, only implemented on FreeBSD

    *)
  7. minflt : int;
    (*

    page reclaims

    *)
  8. majflt : int;
    (*

    page faults

    *)
  9. nswap : int;
    (*

    number of times the process was swapped in

    *)
  10. inblock : int;
    (*

    amount of block input operations, only implemented on FreeBSD

    *)
  11. outblock : int;
    (*

    amount of block output operations, only implemented on FreeBSD

    *)
  12. msgsnd : int;
    (*

    number of IPC messages sent, only implemented on FreeBSD

    *)
  13. msgrcv : int;
    (*

    number of IPC messages received, only implemented on FreeBSD

    *)
  14. nsignals : int;
    (*

    number of signals delivered, only implemented on FreeBSD

    *)
  15. nvcsw : int;
    (*

    number of voluntary context switches

    *)
  16. nivcsw : int;
    (*

    number of involuntary context switches

    *)
  17. vsize : int;
    (*

    virtual size in bytes

    *)
  18. rss : int;
    (*

    resident set size before last swap

    *)
  19. tsize : int;
    (*

    text size in pages

    *)
  20. dsize : int;
    (*

    data size in pages

    *)
  21. ssize : int;
    (*

    stack size in pages

    *)
  22. runtime : int;
    (*

    real time in microseconds

    *)
  23. cow : int;
    (*

    number of copy-on-write faults, only implemented on FreeBSD

    *)
  24. start : int;
    (*

    starting time in microseconds

    *)
}

The type of memory usage.

Sourceval rusage : int -> (ru, [> `Msg of string ]) result

rusage pid is the resource usage of pid or an error.

Sourceval to_fields : ru -> (string * int) list

to_fields ru transforms the data into a list of fields.