Etop.Report (Etop v0.5.2)

Etop Reporting Helpers.

A set of functions to use to parse and process Etop results.

Example output

===========================================================================================================================
nonode@nohost                                                                                                      08:22:56
Load:  cpu     2.9%                      Memory:  total           42812208     binary    197472
       procs     92                               processes       23093664     code    10223211
       runq       0                                atom             512625      ets      791672

Pid                        Name or Initial Func  Percent     Reds    Memory MssQ      State Current Function
---------------------------------------------------------------------------------------------------------------------------
<0.9.0>                         :erlang.apply/2    47.66   901851    284652    0    waiting :erl_prim_loader.loop/3
<0.49.0>                        :erlang.apply/2    12.57   237834    163492    0    waiting :code_server.loop/1
<0.43.0>        :application_controller.start/1     8.13   153862    264396    0    waiting :gen_server.loop/7
<0.1.0>               :erts_code_purger.start/0     7.44   140798     25848    0    waiting :erts_code_purger.wait_for_request/0
<0.2.0>     :erts_literal_area_collector.start/     7.11   134526      2688    0    waiting :erts_literal_area_collector.msg_loop/4
<0.57.0>                    :file_server.init/1     6.18   116917    426596    0    waiting :gen_server.loop/7
<0.64.0>                        :group.server/3     3.46    65443  10784016    0    waiting :group.more_data/6
<0.79.0>                       :disk_log.init/2     1.85    34950    197252    0    waiting :disk_log.loop/1
<0.228.0>                           Etop.init/1     1.77    33584   6781840    0    running Process.info/1
<0.3.0>     :erts_dirty_process_signal_handler.     1.26    23850      2688    0    waiting :erts_dirty_process_signal_handler.msg_loop/0
===========================================================================================================================

Link to this section Summary

Functions

Get the column width of the given column number.

Create a report of the given processes list, and summary stats.

Get the data loaded by compiling the output exs file.

Helper to create and output the report.

Map the given list to the given extract fields.

Map the given list.

List the cpu usage values.

List the memory usage fields.

Load the given exs file.

Get the entry with the max load.

Get the entry with the max load from the given entries list.

Print a chart of the given data.

Print a chart of the cpu usage.

Print a chart of the memory usage.

Print a report with default options.

Print a report with defaults.

Print a report.

Save a report in Elixir terms format.

Get the top n entries.

Link to this section Functions

Link to this function

column_width(n)

Get the column width of the given column number.

Link to this function

create_report(list, total, stats)

Create a report of the given processes list, and summary stats.

Get the data loaded by compiling the output exs file.

Link to this function

handle_report(state)

Helper to create and output the report.

Output options:

  • print to current leader
  • save text format to file
  • save executable format to exs file
Link to this function

list(entries, fields)

Map the given list to the given extract fields.

Examples

iex> Etop.Report.list([%{a: %{x: 1}, b: 2}, %{a: %{x: 2}, b: 3}], [:a, :x])
[1, 2]
Link to this function

list(entries, scope, field)

Map the given list.

Examples

iex> data = [%{summary: %{a: %{x: 1}, b: 2}}, %{summary: %{a: %{x: 2}, b: 3}}]
iex> Etop.Report.list(data, :a, :x)
[1, 2]
Link to this function

list_cpu(entries)

List the cpu usage values.

Examples

iex> data = [%{summary: %{load: %{cpu: 1}}}, %{summary: %{load: %{cpu: 2}}}]
iex> Etop.Report.list_cpu(data)
[1, 2]
Link to this function

list_memory(entries, field \\ :total)

List the memory usage fields.

Examples

iex> data = [
...> %{summary: %{memory: %{total: 2, user: 1}}},
...> %{summary: %{memory: %{total: 4, user: 3}}}]
iex> Etop.Report.list_memory(data)
[2, 4]

iex> data = [
...> %{summary: %{memory: %{total: 2, user: 1}}},
...> %{summary: %{memory: %{total: 4, user: 3}}}]
iex> Etop.Report.list_memory(data, :user)
[1, 3]
Link to this function

load(path \\ "/tmp/etop.exs")

Load the given exs file.

Get the entry with the max load.

Gets the entries from Etop.Agent

Get the entry with the max load from the given entries list.

Link to this function

plot(list, opts \\ [])

Print a chart of the given data.

Link to this function

plot_cpu(entries, opts \\ [])

Print a chart of the cpu usage.

Link to this function

plot_memory(entries, opts \\ [])

Print a chart of the memory usage.

Print a report with default options.

Prints a single top entry or a list of top entries to leader or the given file.

See Etop.Report.print/3 for more details.

Link to this function

print(entry, file)

Print a report with defaults.

See Etop.Report.print/3 for more details.

Link to this function

print(entries, file, opts)

Print a report.

Prints a single top entry or a list of top entries to leader or the given file.

Options:

  • sort - one of [:memory, :msgq, :reds, :reds_diff, :state, :fun, :name, :percent, :pid]
Link to this function

save_exs_report(report, path)

Save a report in Elixir terms format.

Saves the report so that it can be later loaded and analyzed.

Link to this function

top(entries, num)

Get the top n entries.