zoukankan      html  css  js  c++  java
  • erlang调试技术之etop

    etop是erlang进程信息查看工具,类似于UNIX的top.

    一、配置参数

    node
    The measured node.
    Value: atom()
    Mandatory
    setcookie
    Cookie to use for the etop node - must be the same as the cookie on the measured node.
    Value: atom()
    lines
    Number of lines (processes) to display.
    Value: integer()
    Default: 10
    interval
    The time interval (in seconds) between each update of the display.
    Value: integer()
    Default: 5
    accumulate
    If true the execution time and reductions are accumulated.
    Value: boolean()
    Default: false
    sort
    Identifies what information to sort by.
    Value: runtime | reductions | memory | msg_q
    Default: runtime (reductions if tracing=off)
    tracing
    etop uses the erlang trace facility, and thus no other tracing is possible on the measured node while etop is running, unless this option is set to off. Also helpful if the etop tracing causes too high load on the measured node. With tracing off, runtime is not measured.
    Value: on | off
    Default: on

    二、EXPORTS

    start() -> ok

    This function starts etop. Note that etop is preferably started with the etop and getop scripts

    start(Options) -> ok

    Types:

    Options = [Option]
    Option = {Key, Value}
    Key = atom()
    Value = term()

    This function starts etop. Use help/0 to see a description of the possible options.

    help() -> ok

    This function prints the help of etop and its options.

    config(Key,Value) -> Result

    Types:

    Result = ok | {error,Reason}
    Key = lines | interval | accumulate | sort
    Value = term()

    This function is used to change the tool's configuration parameters during runtime. The table above indicates the allowed values for each parameter.

    dump(File) -> Result

    Types:

    Result = ok | {error,Reason}
    File = string()

    This function dumps the current display to a text file.

    stop() -> stop

    This function terminates etop.

    三、实例

    1、启动etop监控远程节点

    erl -sname aa -remsh remote@domain

    etop:start([{output,text},{lines,10},{sort,reductions},{accumulations,true},{interval,10}]).

    或者etop -sname local@domain -lines 10 -sort reductions -accumulations true -interval 10 -setcookie remotecookie -remsh remote@domain(系统shell下执行)

    ========================================================================================
     tiger@durin                                                               13:40:32
     Load:  cpu         0               Memory:  total        1997    binary         33
            procs     197                        processes       0    code          173
            runq      135                        atom         1002    ets            95
    
    Pid            Name or Initial Func    Time    Reds  Memory    MsgQ Current Function
    ----------------------------------------------------------------------------------------
    <127.23.0>     code_server                0   59585   78064       0 gen_server:loop/6   
    <127.21.0>     file_server_2              0   36380   44276       0 gen_server:loop/6   
    <127.2.0>      erl_prim_loader            0   27962    3740       0 erl_prim_loader:loop
    <127.9.0>      kernel_sup                 0    6998    4676       0 gen_server:loop/6   
    <127.17.0>     net_kernel                62    6018    3136       0 gen_server:loop/6   
    <127.0.0>      init                       0    4156    4352       0 init:loop/1         
    <127.16.0>     auth                       0    1765    1264       0 gen_server:loop/6   
    <127.18.0>     inet_tcp_dist:accept       0     660    1416       0 prim_inet:accept0/2 
    <127.5.0>      application_controll       0     569    6756       0 gen_server:loop/6   
    <127.137.0>    net_kernel:do_spawn_       0     553    5840       0 dbg:do_relay_1/1    
    ========================================================================================

    2、修改配置参数


    etop:config(lines, 5)
    (etop@durin)2> 
    ========================================================================================
     tiger@durin                                                               10:12:44
     Load:  cpu         0               Memory:  total        1859    binary         33
            procs     192                        processes       0    code          173
            runq        2                        atom         1002    ets            95
    
    Pid            Name or Initial Func    Time    Reds  Memory    MsgQ Current Function
    ----------------------------------------------------------------------------------------
    <127.17.0>     net_kernel               183      70    4092       0 gen_server:loop/6   
    <127.335.0>    inet_tcp_dist:do_acc     141      22    1856       0 dist_util:con_loop/9
    <127.19.0>     net_kernel:ticker/2      155       6    1244       0 net_kernel:ticker1/2
    <127.341.0>    net_kernel:do_spawn_       0       0    5840       0 dbg:do_relay_1/1    
    <127.43.0>     ddll_server                0       0    3744       0 gen_server:loop/6   
    ========================================================================================
  • 相关阅读:
    Java基础算法--排序
    Java基础之String类的细节问题
    Java数据结构四之——二叉树的前、中、后序遍历
    动态规划之----最长公共子序列(LCS)
    最长公共子串问题
    makefile学习笔记
    使用正则表达式,去除C++的注释
    gbk字库音序对照表
    Fsharp 类中的空字段
    使用FSharp 探索Dotnet图像处理功能2--均衡灰度
  • 原文地址:https://www.cnblogs.com/yanwei-wang/p/4192999.html
Copyright © 2011-2022 走看看