代码改变世界

获取Erlang系统信息的代码片段

2012-05-14 00:57  rhinovirus  阅读(625)  评论(0编辑  收藏  举报
    SchedId      = erlang:system_info(scheduler_id),
    SchedNum     = erlang:system_info(schedulers),
    ProcCount    = erlang:system_info(process_count),
    ProcLimit    = erlang:system_info(process_limit),
    ProcMemUsed  = erlang:memory(processes_used),
    ProcMemAlloc = erlang:memory(processes),
    MemTot       = erlang:memory(total),
    io:format("abormal termination: "
          "~n   Scheduler id:                         ~p"
          "~n   Num scheduler:                        ~p"
          "~n   Process count:                        ~p"
          "~n   Process limit:                        ~p"
          "~n   Memory used by erlang processes:      ~p"
          "~n   Memory allocated by erlang processes: ~p"
          "~n   The total amount of memory allocated: ~p"
          "~n", 
          [SchedId, SchedNum, ProcCount, ProcLimit, 
           ProcMemUsed, ProcMemAlloc, MemTot]),
    ok.

转载自Erlang非业余研究 地址:http://blog.yufeng.info/archives/452