檢視原始碼 etop (觀察器 v2.17)

Erlang Top 是一個用來呈現 Erlang 處理程序資訊的工具,類似於 UNIX 中的 "top" 指令所呈現的資訊。

使用提供的腳本 etop 來啟動 Erlang Top。這會啟動一個隱藏的 Erlang 節點,該節點會連線到要測量的節點。要測量的節點使用 -node 選項指定。如果被測量節點的 cookie 與調用腳本的使用者預設 cookie 不同,則必須使用 -setcookie 選項明確指定 cookie。

在 Windows 下,可以使用批次檔 etop.bat

執行 etop 腳本時,可以將組態參數指定為命令行選項,例如,etop -node testnode@myhost -setcookie MyCookie。此工具存在以下組態參數

  • node - 要測量的節點。

    值: atom/0

    強制性

  • setcookie - etop 節點要使用的 cookie。必須與被測量節點上的 cookie 相同。

    值: atom/0

  • lines - 要顯示的行數(處理程序)。

    值: integer/0

    預設值: 10

  • interval - 顯示畫面每次更新之間的時間間隔(以秒為單位)。

    值: integer/0

    預設值: 5

  • accumulate - 如果為 true,則會累積執行時間和歸約次數。

    值: boolean/0

    預設值: false

  • sort - 識別要依據哪個資訊進行排序。

    值: runtime | reductions | memory | msg_q

    預設值: runtime (如果 tracing=off,則為 reductions)

  • tracing - etop 使用 Erlang 追蹤功能,因此當 etop 正在執行時,除非此選項設定為 off,否則無法在被測量節點上進行其他追蹤。如果 etop 追蹤導致被測量節點上的負載過高,此選項也很有用。關閉追蹤後,不會測量執行時間。

    值: on | off

    預設值: on

有關 Erlang Top 的詳細資訊,請參閱使用者指南

摘要

函式

在執行時更改工具的組態參數。允許的參數為 linesintervalaccumulatesort

將目前的顯示畫面傾印到文字檔。

顯示 etop 及其選項的說明。

啟動 etop。請注意,最好使用 etop 腳本啟動 etop

啟動 etop。若要檢視可用的選項,請使用 help/0

終止 etop

函式

-spec config(Key, Value) -> ok | {error, Reason}
                when Key :: lines | interval | accumulate | sort, Value :: term(), Reason :: term().

在執行時更改工具的組態參數。允許的參數為 linesintervalaccumulatesort

-spec dump(File) -> ok | {error, Reason} when File :: file:filename_all(), Reason :: term().

將目前的顯示畫面傾印到文字檔。

此函式的連結

help()

檢視原始碼 (自 OTP R15B01 起)
-spec help() -> ok.

顯示 etop 及其選項的說明。

此函式的連結

start()

檢視原始碼 (自 OTP R15B01 起)
-spec start() -> ok.

啟動 etop。請注意,最好使用 etop 腳本啟動 etop

此函式的連結

start(Options)

檢視原始碼 (自 OTP R15B01 起)
-spec start(Options) -> ok when Options :: [{Key, Value}], Key :: atom(), Value :: term().

啟動 etop。若要檢視可用的選項,請使用 help/0

-spec stop() -> stop | not_started.

終止 etop