1 -module(beam_stats_process).
3 -include("include/beam_stats_process.hrl").
29 %% ============================================================================
31 %% ============================================================================
33 -spec of_pid(pid()) ->
36 Dict = pid_info_exn(Pid, dictionary),
39 , registered_name = pid_info_opt(Pid, registered_name)
40 , raw_initial_call = pid_info_exn(Pid, initial_call)
41 , otp_initial_call = hope_kv_list:get(Dict, '$initial_call')
42 , otp_ancestors = hope_kv_list:get(Dict, '$ancestors')
43 , status = pid_info_exn(Pid, status)
44 , memory = pid_info_exn(Pid, memory)
45 , total_heap_size = pid_info_exn(Pid, total_heap_size)
46 , stack_size = pid_info_exn(Pid, stack_size)
47 , message_queue_len = pid_info_exn(Pid, message_queue_len)
55 , registered_name = RegisteredNameOpt
56 , raw_initial_call = InitialCallRaw
57 , otp_initial_call = InitialCallOTPOpt
58 , otp_ancestors = AncestorsOpt
61 , total_heap_size = TotalHeapSize
62 , stack_size = StackSize
63 , message_queue_len = MsgQueueLen
66 io:format("--------------------------------------------------~n"),
69 "RegisteredNameOpt : ~p~n"
70 "InitialCallRaw : ~p~n"
71 "InitialCallOTPOpt : ~p~n"
75 "TotalHeapSize : ~p~n"
92 %% ============================================================================
94 %% ============================================================================
96 pid_info_exn(Pid, Key) ->
97 {some, Value} = pid_info_opt(Pid, Key),
100 pid_info_opt(Pid, Key) ->
101 case {Key, erlang:process_info(Pid, Key)}
102 of {registered_name, []} -> none
103 ; {_ , {Key, Value}} -> {some, Value}