Wobserver v0.1.3 Wobserver.Util.Process

Process and pid handling.

Summary

Functions

Retreives a complete overview of process stats

Retreives a list of process summaries

Retreives formatted meta information about the process

Turns the argument into a pid or if not possible returns nil

Turns the argument into a pid or if not possible raises error

Retreives formatted summary information about the process

Functions

info(pid)
info(pid :: pid | list | binary | integer | {integer, integer, integer}) ::
  :error |
  map

Retreives a complete overview of process stats.

Including but not limited to:

  • id, the process pid
  • name, the registered name or nil.
  • init, initial function or name.
  • current, current function.
  • memory, the total amount of memory used by the process.
  • reductions, the amount of reductions.
  • message_queue_length, the amount of unprocessed messages for the process.,
list()
list() :: [map]

Retreives a list of process summaries.

Every summary contains:

  • id, the process pid.
  • name, the registered name or nil.
  • init, initial function or name.
  • current, current function.
  • memory, the total amount of memory used by the process.
  • reductions, the amount of reductions.
  • message_queue_length, the amount of unprocessed messages for the process.
meta(pid)
meta(pid :: pid) :: map

Retreives formatted meta information about the process.

The information contains:

  • init, initial function or name.
  • current, current function.
  • status, process status.
pid(pid)
pid(pid :: pid | atom | list | binary | integer | {integer, integer, integer}) ::
  pid |
  nil

Turns the argument into a pid or if not possible returns nil.

It will accept:

  • pids
  • atoms / module names (registered processes)
  • single integers
  • a list of 3 integers
  • a tuple of 3 integers
  • a charlist in the format: '<0.0.0>'
  • a String in the following formats:

    • "#PID<0.0.0>"
    • "<0.0.0>"
    • atom / module name

Example:

iex> Wobserver.Util.Process.pid pid(0, 33, 0)
#PID<0.33.0>
iex> Wobserver.Util.Process.pid :cowboy_sup
#PID<0.253.0>
iex> Wobserver.Util.Process.pid Logger
#PID<0.213.0>
iex> Wobserver.Util.Process.pid 33
#PID<0.33.0>
iex> Wobserver.Util.Process.pid [0, 33, 0]
#PID<0.33.0>
iex> Wobserver.Util.Process.pid '<0.33.0>'
#PID<0.33.0>
iex> Wobserver.Util.Process.pid {0, 33, 0}
#PID<0.33.0>
iex> Wobserver.Util.Process.pid "#PID<0.33.0>"
#PID<0.33.0>
iex> Wobserver.Util.Process.pid "<0.33.0>"
#PID<0.33.0>
iex> Wobserver.Util.Process.pid "cowboy_sup"
#PID<0.253.0>
iex> Wobserver.Util.Process.pid "Logger"
#PID<0.213.0>
iex> Wobserver.Util.Process.pid 4.5
nil
pid!(pid)
pid!(pid :: pid | list | binary | integer | {integer, integer, integer}) :: pid

Turns the argument into a pid or if not possible raises error.

For example see: Wobserver.Util.Process.pid/1.

summary(pid)
summary(pid :: pid) :: map

Retreives formatted summary information about the process.

Every summary contains:

  • id, the process pid.
  • name, the registered name or nil.
  • init, initial function or name.
  • current, current function.
  • memory, the total amount of memory used by the process.
  • reductions, the amount of reductions.
  • message_queue_length, the amount of unprocessed messages for the process.