【问题标题】:Profiling Erlang/OTP release initialization分析 Erlang/OTP 版本初始化
【发布时间】:2014-03-19 23:10:40
【问题描述】:

我想知道我的 Erlang/OTP 发布启动脚本(.script 和 .boot 文件)的运行时间。 Programming Erlang 2nd Edition,附录 3 说加载 OTP 需要一秒钟,加载 67 个模块并启动 25 个进程。这被用作在没有 OTP 的情况下运行 VM 的动机。我想量化 OTP 和我的模块在我的设置中的加载时间。有没有简单的方法可以做到这一点?

【问题讨论】:

    标签: erlang initialization profile


    【解决方案1】:

    如果您通过ts 管道调试打印,-init_debug 选项会提供一些信息。这是一个例子。每个时间戳是自上一行打印以来的秒数。

    $ erl -init_debug | ts -i '%.s'
    0.008446 {progress,preloaded}
    0.001501 {progress,kernel_load_completed}
    0.000576 {progress,modules_loaded}
    0.000352 {start,heart}
    0.001627 {start,error_logger}
    0.011464 {start,application_controller}
    0.024965 {progress,init_kernel_started}
    0.000147 {apply,{application,load,[{application,stdlib,[{description,"ERTS  CXC 138 10"},{vsn,"1.19.4"},{id,[]},{modules,[array,base64,beam_lib,binary,c,calendar,dets,dets_server,dets_sup,dets_utils,dets_v8,dets_v9,dict,digraph,digraph_utils,edlin,edlin_expand,epp,eval_bits,erl_bits,erl_compile,erl_eval,erl_expand_records,erl_internal,erl_lint,erl_parse,erl_posix_msg,erl_pp,erl_scan,erl_tar,error_logger_file_h,error_logger_tty_h,escript,ets,file_sorter,filelib,filename,gb_trees,gb_sets,gen,gen_event,gen_fsm,gen_server,io,io_lib,io_lib_format,io_lib_fread,io_lib_pretty,lib,lists,log_mf_h,math,ms_transform,orddict,ordsets,otp_internal,pg,pool,proc_lib,proplists,qlc,qlc_pt,queue,random,re,sets,shell,shell_default,slave,sofs,string,supervisor,supervisor_bridge,sys,timer,unicode,win32reg,zip]},{registered,[timer_server,rsh_starter,take_over_monitor,pool_master,dets]},{applications,[kernel]},{included_applications,[]},{env,[]},{maxT,infinity},{maxP,infinity}]}]}}
    0.004207 {progress,applications_loaded}
    0.000136 {apply,{application,start_boot,[kernel,permanent]}}
    0.302955 {apply,{application,start_boot,[stdlib,permanent]}}
    0.000171 {apply,{c,erlangrc,[]}}
    0.021488 {progress,started}
    0.051776 Eshell V5.10.4  (abort with ^G)
    

    在这个例子中,看起来application:start_boot(kernel, permanent) 是一个缓慢的步骤,因为它需要大约 300 毫秒。

    【讨论】:

      猜你喜欢
      • 2016-09-16
      • 2023-04-02
      • 2011-12-23
      • 1970-01-01
      • 2017-11-24
      • 2011-08-13
      • 2019-04-24
      • 2016-05-08
      • 1970-01-01
      相关资源
      最近更新 更多