View Source Wobserver.Util.Process (Wobserver NG v1.14.0)

Process and pid handling.

Link to this section Summary

Functions

Creates a complete overview of process stats based on the given pid.

Retreives a list of process summaries.

Creates formatted meta information about the process based on the given pid.

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

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

Creates formatted summary about the process based on the given pid.

Link to this section Functions

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

Creates a complete overview of process stats based on the given pid.

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.,
@spec 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.
@spec meta(pid :: pid()) :: map()

Creates formatted meta information about the process based on the given pid.

The information contains:

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

Turns the argument pid 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
@spec pid!(
  pid ::
    pid() | list() | binary() | integer() | {integer(), integer(), integer()}
) :: pid()

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

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

@spec summary(pid :: pid()) :: map()

Creates formatted summary about the process based on the given pid.

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.