论坛首页 综合技术论坛

求助erlang进程通信效率问题

浏览 15569 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2008-02-16  
没发现什么问题但是我测试发送1w消息和2w消息时都非常快,cpu会有到94%的情况,设置发送5w消息开始就非常的慢了,3w,4w没测试。
有2组fprof的数据1W和5W 看着没感觉哪里不对,有一个{error_handler,undefined_function,3}没见过是哪里的,调整了recv的顺序,把使用最多的send放前面,加了 true的默认项也没效果:
1w消息的fprof
4> 
fprof:analyse().
Processing data...
Creating output...
%% Analysis results:
{  analysis_options,
 [{callers, true},
  {sort, acc},
  {totals, false},
  {details, true}]}.

%                                               CNT       ACC       OWN        
[{ totals,                                      235,    3.638,    2.131}].  %%%


%                                               CNT       ACC       OWN        
[{ "<0.31.0>",                                  215,undefined,    1.746}].   %%

{[{undefined,                                     0,    3.638,    0.035}],     
 { {fprof,apply_start_stop,4},                    0,    3.638,    0.035},     %
 [{{emssserver,init,0},                           1,    3.225,    0.035},      
  {suspend,                                       1,    0.378,    0.000}]}.    

{[{{fprof,apply_start_stop,4},                    1,    3.225,    0.035}],     
 { {emssserver,init,0},                           1,    3.225,    0.035},     %
 [{{error_handler,undefined_function,3},          1,    2.946,    0.017},      
  {{io,format,2},                                 1,    0.163,    0.015},      
  {{erlang,spawn,1},                              2,    0.053,    0.017},      
  {{erlang,register,2},                           2,    0.022,    0.022},      
  {{erlang,now,0},                                1,    0.006,    0.006}]}.    

{[{{emssserver,init,0},                           1,    2.946,    0.017},      
  {{gen_tcp,listen,2},                            1,    0.000,    0.017}],     
 { {error_handler,undefined_function,3},          2,    2.946,    0.034},     %
 [{{gen_tcp,listen,2},                            1,    1.974,    0.016},      
  {{error_handler,ensure_loaded,1},               2,    1.517,    0.017},      
  {{inet_tcp,getserv,1},                          1,    0.010,    0.010},      
  {{erlang,function_exported,3},                  2,    0.010,    0.010}]}.    

{[{{error_handler,undefined_function,3},          1,    1.974,    0.016}],     
 { {gen_tcp,listen,2},                            1,    1.974,    0.016},     %
 [{{inet_tcp,listen,2},                           1,    1.294,    0.029},      
  {{gen_tcp,mod,1},                               1,    0.065,    0.005},      
  {{error_handler,undefined_function,3},          1,    0.000,    0.017}]}.    

{[{{code_server,call,2},                          2,    1.445,    0.000},      
  {{fprof,apply_start_stop,4},                    1,    0.378,    0.000},      
  {{io,wait_io_mon_reply,2},                      1,    0.069,    0.000}],     
 { suspend,                                       4,    1.892,    0.000},     %
 [ ]}.

{[{{error_handler,undefined_function,3},          2,    1.517,    0.017}],     
 { {error_handler,ensure_loaded,1},               2,    1.517,    0.017},     %
 [{{code,ensure_loaded,1},                        2,    1.492,    0.008},      
  {{erlang,whereis,1},                            2,    0.008,    0.008}]}.    

{[{{error_handler,ensure_loaded,1},               2,    1.492,    0.008}],     
 { {code,ensure_loaded,1},                        2,    1.492,    0.008},     %
 [{{code,call,1},                                 2,    1.484,    0.007}]}.    

{[{{code,ensure_loaded,1},                        2,    1.484,    0.007}],     
 { {code,call,1},                                 2,    1.484,    0.007},     %
 [{{code_server,call,2},                          2,    1.477,    0.032}]}.    

{[{{code,call,1},                                 2,    1.477,    0.032}],     
 { {code_server,call,2},                          2,    1.477,    0.032},     %
 [{suspend,                                       2,    1.445,    0.000}]}.    

{[{{gen_tcp,listen,2},                            1,    1.294,    0.029}],     
 { {inet_tcp,listen,2},                           1,    1.294,    0.029},     %
 [{{inet,open,7},                                 1,    0.640,    0.022},      
  {{inet,listen_options,2},                       1,    0.570,    0.033},      
  {{prim_inet,listen,2},                          1,    0.055,    0.010}]}.    

{[{{inet_tcp,listen,2},                           1,    0.640,    0.022}],     
 { {inet,open,7},                                 1,    0.640,    0.022},     %
 [{{prim_inet,setopts,2},                         1,    0.468,    0.012},      
  {{prim_inet,open,2},                            1,    0.084,    0.004},      
  {{prim_inet,bind,3},                            1,    0.055,    0.022},      
  {{inet_db,register_socket,2},                   1,    0.011,    0.007}]}.    

{[{{inet_tcp,listen,2},                           1,    0.570,    0.033}],     
 { {inet,listen_options,2},                       1,    0.570,    0.033},     %
 [{{inet,list_opt,3},                             1,    0.501,    0.010},      
  {{application,get_env,2},                       1,    0.020,    0.004},      
  {{inet,translate_ip,2},                         1,    0.007,    0.007},      
  {{erlang,setelement,3},                         1,    0.006,    0.006},      
  {{inet,listen_options,0},                       1,    0.003,    0.003}]}.    

{[{{inet,listen_options,2},                       1,    0.501,    0.010},      
  {{inet,list_opt,3},                             1,    0.000,    0.004},      
  {{inet,list_add,5},                             4,    0.000,    0.034}],     
 { {inet,list_opt,3},                             6,    0.501,    0.048},     %
 [{{inet,list_add,5},                             4,    0.483,    0.074},      
  {{erlang,setelement,3},                         1,    0.004,    0.004},      
  {{inet,list_opt,3},                             1,    0.000,    0.004}]}.    

{[{{inet,list_opt,3},                             4,    0.483,    0.074}],     
 { {inet,list_add,5},                             4,    0.483,    0.074},     %
 [{{inet,add_opt,4},                              4,    0.351,    0.066},      
  {{erlang,setelement,3},                         4,    0.024,    0.024},      
  {{inet,list_opt,3},                             4,    0.000,    0.034}]}.    

{[{{inet,open,7},                                 1,    0.468,    0.012}],     
 { {prim_inet,setopts,2},                         1,    0.468,    0.012},     %
 [{{prim_inet,encode_opt_val,1},                  1,    0.428,    0.009},      
  {{prim_inet,ctl_cmd,3},                         1,    0.028,    0.009}]}.    

{[{{prim_inet,setopts,2},                         1,    0.428,    0.009}],     
 { {prim_inet,encode_opt_val,1},                  1,    0.428,    0.009},     %
 [{{prim_inet,enc_opt_val,2},                     1,    0.419,    0.004}]}.    

{[{{prim_inet,encode_opt_val,1},                  1,    0.419,    0.004},      
  {{prim_inet,enc_opt_val,4},                     4,    0.000,    0.019}],     
 { {prim_inet,enc_opt_val,2},                     5,    0.419,    0.023},     %
 [{{prim_inet,enc_opt_val,4},                     4,    0.415,    0.102}]}.    

{[{{prim_inet,enc_opt_val,2},                     4,    0.415,    0.102}],     
 { {prim_inet,enc_opt_val,4},                     4,    0.415,    0.102},     %
 [{{prim_inet,enc_value,3},                       4,    0.124,    0.020},      
  {{prim_inet,type_value,3},                      4,    0.115,    0.018},      
  {{prim_inet,type_opt,2},                        4,    0.038,    0.019},      
  {{prim_inet,enc_opt,1},                         4,    0.017,    0.017},      
  {{prim_inet,enc_opt_val,2},                     4,    0.000,    0.019}]}.    

{[{{inet,list_add,5},                             4,    0.351,    0.066}],     
 { {inet,add_opt,4},                              4,    0.351,    0.066},     %
 [{{prim_inet,is_sockopt_val,2},                  4,    0.177,    0.045},      
  {{lists,keydelete,3},                           4,    0.095,    0.017},      
  {{lists,member,2},                              4,    0.013,    0.013}]}.    

{[{{prim_inet,enc_opt_val,4},                     4,    0.115,    0.018},      
  {{prim_inet,is_sockopt_val,2},                  4,    0.103,    0.018}],     
 { {prim_inet,type_value,3},                      8,    0.218,    0.036},     %
 [{{prim_inet,type_value_default,3},              8,    0.182,    0.039}]}.    

{[{{prim_inet,type_value,3},                      8,    0.182,    0.039}],     
 { {prim_inet,type_value_default,3},              8,    0.182,    0.039},     %
 [{{prim_inet,type_value_1,3},                    8,    0.143,    0.037}]}.    

{[{{inet,add_opt,4},                              4,    0.177,    0.045}],     
 { {prim_inet,is_sockopt_val,2},                  4,    0.177,    0.045},     %
 [{{prim_inet,type_value,3},                      4,    0.103,    0.018},      
  {{prim_inet,type_opt,2},                        4,    0.029,    0.014}]}.    

{[{{emssserver,init,0},                           1,    0.163,    0.015}],     
 { {io,format,2},                                 1,    0.163,    0.015},     %
 [{{io,format,3},                                 1,    0.137,    0.004},      
  {{io,default_output,0},                         1,    0.011,    0.008}]}.    

{[{{prim_inet,type_value_default,3},              8,    0.143,    0.037}],     
 { {prim_inet,type_value_1,3},                    8,    0.143,    0.037},     %
 [{{prim_inet,type_value_2,2},                    8,    0.106,    0.058}]}.    

{[{{prim_inet,listen,2},                          1,    0.045,    0.009},      
  {{prim_inet,open1,2},                           1,    0.041,    0.010},      
  {{prim_inet,setopts,2},                         1,    0.028,    0.009},      
  {{prim_inet,bind,3},                            1,    0.023,    0.010}],     
 { {prim_inet,ctl_cmd,3},                         4,    0.137,    0.038},     %
 [{{erlang,port_control,3},                       4,    0.099,    0.099}]}.    

{[{{io,format,2},                                 1,    0.137,    0.004}],     
 { {io,format,3},                                 1,    0.137,    0.004},     %
 [{{io,o_request,2},                              1,    0.133,    0.009}]}.    

{[{{io,format,3},                                 1,    0.133,    0.009}],     
 { {io,o_request,2},                              1,    0.133,    0.009},     %
 [{{io,request,2},                                1,    0.124,    0.018}]}.    

{[{{prim_inet,enc_opt_val,4},                     4,    0.124,    0.020}],     
 { {prim_inet,enc_value,3},                       4,    0.124,    0.020},     %
 [{{prim_inet,enc_value_default,3},               4,    0.104,    0.018}]}.    

{[{{io,o_request,2},                              1,    0.124,    0.018}],     
 { {io,request,2},                                1,    0.124,    0.018},     %
 [{{io,wait_io_mon_reply,2},                      1,    0.095,    0.021},      
  {{erlang,monitor,2},                            1,    0.007,    0.007},      
  {{io,io_request,2},                             1,    0.004,    0.004}]}.    

{[{{prim_inet,type_value_1,3},                    8,    0.106,    0.058}],     
 { {prim_inet,type_value_2,2},                    8,    0.106,    0.058},     %
 [{{prim_inet,enum_val,2},                        6,    0.048,    0.024}]}.    

{[{{prim_inet,enc_value,3},                       4,    0.104,    0.018}],     
 { {prim_inet,enc_value_default,3},               4,    0.104,    0.018},     %
 [{{prim_inet,enc_value_1,3},                     4,    0.086,    0.019}]}.    

{[{{prim_inet,ctl_cmd,3},                         4,    0.099,    0.099}],     
 { {erlang,port_control,3},                       4,    0.099,    0.099},     %
 [ ]}.

{[{{inet,add_opt,4},                              4,    0.095,    0.017}],     
 { {lists,keydelete,3},                           4,    0.095,    0.017},     %
 [{{lists,keydelete3,3},                          4,    0.078,    0.037}]}.    

{[{{io,request,2},                                1,    0.095,    0.021}],     
 { {io,wait_io_mon_reply,2},                      1,    0.095,    0.021},     %
 [{suspend,                                       1,    0.069,    0.000},      
  {{erlang,demonitor,1},                          1,    0.005,    0.005}]}.    

{[{{prim_inet,enc_value_default,3},               4,    0.086,    0.019}],     
 { {prim_inet,enc_value_1,3},                     4,    0.086,    0.019},     %
 [{{prim_inet,enc_value_2,2},                     4,    0.067,    0.031}]}.    

{[{{inet,open,7},                                 1,    0.084,    0.004}],     
 { {prim_inet,open,2},                            1,    0.084,    0.004},     %
 [{{prim_inet,open1,2},                           1,    0.080,    0.013}]}.    

{[{{prim_inet,type_value_2,2},                    6,    0.048,    0.024},      
  {{prim_inet,enc_value_2,2},                     3,    0.036,    0.012},      
  {{prim_inet,enum_val,2},                        9,    0.000,    0.048}],     
 { {prim_inet,enum_val,2},                       18,    0.084,    0.084},     %
 [{{prim_inet,enum_val,2},                        9,    0.000,    0.048}]}.    

{[{{prim_inet,open,2},                            1,    0.080,    0.013}],     
 { {prim_inet,open1,2},                           1,    0.080,    0.013},     %
 [{{prim_inet,ctl_cmd,3},                         1,    0.041,    0.010},      
  {{prim_inet,open0,1},                           1,    0.026,    0.012}]}.    

{[{{lists,keydelete,3},                           4,    0.078,    0.037},      
  {{lists,keydelete3,3},                          8,    0.000,    0.041}],     
 { {lists,keydelete3,3},                         12,    0.078,    0.078},     %
 [{{lists,keydelete3,3},                          8,    0.000,    0.041}]}.    

{[{{prim_inet,enc_opt_val,4},                     4,    0.038,    0.019},      
  {{prim_inet,is_sockopt_val,2},                  4,    0.029,    0.014}],     
 { {prim_inet,type_opt,2},                        8,    0.067,    0.033},     %
 [{{prim_inet,type_opt_1,1},                      8,    0.034,    0.034}]}.    

{[{{prim_inet,enc_value_1,3},                     4,    0.067,    0.031}],     
 { {prim_inet,enc_value_2,2},                     4,    0.067,    0.031},     %
 [{{prim_inet,enum_val,2},                        3,    0.036,    0.012}]}.    

{[{{gen_tcp,listen,2},                            1,    0.065,    0.005},      
  {{gen_tcp,mod,1},                               4,    0.000,    0.026}],     
 { {gen_tcp,mod,1},                               5,    0.065,    0.031},     %
 [{{gen_tcp,mod,0},                               1,    0.034,    0.006},      
  {{gen_tcp,mod,1},                               4,    0.000,    0.026}]}.    

{[{{inet_tcp,listen,2},                           1,    0.055,    0.010}],     
 { {prim_inet,listen,2},                          1,    0.055,    0.010},     %
 [{{prim_inet,ctl_cmd,3},                         1,    0.045,    0.009}]}.    

{[{{inet,open,7},                                 1,    0.055,    0.022}],     
 { {prim_inet,bind,3},                            1,    0.055,    0.022},     %
 [{{prim_inet,ctl_cmd,3},                         1,    0.023,    0.010},      
  {{prim_inet,ip_to_bytes,1},                     1,    0.010,    0.006}]}.    

{[{{emssserver,init,0},                           2,    0.053,    0.017}],     
 { {erlang,spawn,1},                              2,    0.053,    0.017},     %
 [{{erlang,spawn,3},                              2,    0.036,    0.036}]}.    

{[{{erlang,spawn,1},                              2,    0.036,    0.036}],     
 { {erlang,spawn,3},                              2,    0.036,    0.036},     %
 [ ]}.

{[{{prim_inet,type_opt,2},                        8,    0.034,    0.034}],     
 { {prim_inet,type_opt_1,1},                      8,    0.034,    0.034},     %
 [ ]}.

{[{{gen_tcp,mod,1},                               1,    0.034,    0.006}],     
 { {gen_tcp,mod,0},                               1,    0.034,    0.006},     %
 [{{inet_db,tcp_module,0},                        1,    0.028,    0.006}]}.    

{[{{inet,list_add,5},                             4,    0.024,    0.024},      
  {{inet,listen_options,2},                       1,    0.006,    0.006},      
  {{inet,list_opt,3},                             1,    0.004,    0.004}],     
 { {erlang,setelement,3},                         6,    0.034,    0.034},     %
 [ ]}.

{[{{gen_tcp,mod,0},                               1,    0.028,    0.006}],     
 { {inet_db,tcp_module,0},                        1,    0.028,    0.006},     %
 [{{inet_db,db_get,1},                            1,    0.022,    0.014}]}.    

{[{{prim_inet,open1,2},                           1,    0.026,    0.012}],     
 { {prim_inet,open0,1},                           1,    0.026,    0.012},     %
 [{{erlang,open_port,2},                          1,    0.011,    0.011},      
  {{prim_inet,protocol2drv,1},                    1,    0.003,    0.003}]}.    

{[{{inet_db,tcp_module,0},                        1,    0.022,    0.014}],     
 { {inet_db,db_get,1},                            1,    0.022,    0.014},     %
 [{{ets,lookup,2},                                1,    0.008,    0.008}]}.    

{[{{emssserver,init,0},                           2,    0.022,    0.022}],     
 { {erlang,register,2},                           2,    0.022,    0.022},     %
 [ ]}.

{[{{inet,listen_options,2},                       1,    0.020,    0.004}],     
 { {application,get_env,2},                       1,    0.020,    0.004},     %
 [{{application_controller,get_env,2},            1,    0.016,    0.009}]}.    

{[{{prim_inet,enc_opt_val,4},                     4,    0.017,    0.017}],     
 { {prim_inet,enc_opt,1},                         4,    0.017,    0.017},     %
 [ ]}.

{[{{application,get_env,2},                       1,    0.016,    0.009}],     
 { {application_controller,get_env,2},            1,    0.016,    0.009},     %
 [{{ets,lookup,2},                                1,    0.007,    0.007}]}.    

{[{{inet_db,db_get,1},                            1,    0.008,    0.008},      
  {{application_controller,get_env,2},            1,    0.007,    0.007}],     
 { {ets,lookup,2},                                2,    0.015,    0.015},     %
 [ ]}.

{[{{inet,add_opt,4},                              4,    0.013,    0.013}],     
 { {lists,member,2},                              4,    0.013,    0.013},     %
 [ ]}.

{[{{io,format,2},                                 1,    0.011,    0.008}],     
 { {io,default_output,0},                         1,    0.011,    0.008},     %
 [{{erlang,group_leader,0},                       1,    0.003,    0.003}]}.    

{[{{inet,open,7},                                 1,    0.011,    0.007}],     
 { {inet_db,register_socket,2},                   1,    0.011,    0.007},     %
 [{{erlang,port_set_data,2},                      1,    0.004,    0.004}]}.    

{[{{prim_inet,open0,1},                           1,    0.011,    0.011}],     
 { {erlang,open_port,2},                          1,    0.011,    0.011},     %
 [ ]}.

{[{{prim_inet,bind,3},                            1,    0.010,    0.006}],     
 { {prim_inet,ip_to_bytes,1},                     1,    0.010,    0.006},     %
 [{{prim_inet,ip4_to_bytes,1},                    1,    0.004,    0.004}]}.    

{[{{error_handler,undefined_function,3},          1,    0.010,    0.010}],     
 { {inet_tcp,getserv,1},                          1,    0.010,    0.010},     %
 [ ]}.

{[{{error_handler,undefined_function,3},          2,    0.010,    0.010}],     
 { {erlang,function_exported,3},                  2,    0.010,    0.010},     %
 [ ]}.

{[{{error_handler,ensure_loaded,1},               2,    0.008,    0.008}],     
 { {erlang,whereis,1},                            2,    0.008,    0.008},     %
 [ ]}.

{[{{inet,listen_options,2},                       1,    0.007,    0.007}],     
 { {inet,translate_ip,2},                         1,    0.007,    0.007},     %
 [ ]}.

{[{{io,request,2},                                1,    0.007,    0.007}],     
 { {erlang,monitor,2},                            1,    0.007,    0.007},     %
 [ ]}.

{[{{emssserver,init,0},                           1,    0.006,    0.006}],     
 { {erlang,now,0},                                1,    0.006,    0.006},     %
 [ ]}.

{[{{io,wait_io_mon_reply,2},                      1,    0.005,    0.005}],     
 { {erlang,demonitor,1},                          1,    0.005,    0.005},     %
 [ ]}.

{[{{prim_inet,ip_to_bytes,1},                     1,    0.004,    0.004}],     
 { {prim_inet,ip4_to_bytes,1},                    1,    0.004,    0.004},     %
 [ ]}.

{[{{io,request,2},                                1,    0.004,    0.004}],     
 { {io,io_request,2},                             1,    0.004,    0.004},     %
 [ ]}.

{[{{inet_db,register_socket,2},                   1,    0.004,    0.004}],     
 { {erlang,port_set_data,2},                      1,    0.004,    0.004},     %
 [ ]}.

{[{{prim_inet,open0,1},                           1,    0.003,    0.003}],     
 { {prim_inet,protocol2drv,1},                    1,    0.003,    0.003},     %
 [ ]}.

{[{{inet,listen_options,2},                       1,    0.003,    0.003}],     
 { {inet,listen_options,0},                       1,    0.003,    0.003},     %
 [ ]}.

{[{{io,default_output,0},                         1,    0.003,    0.003}],     
 { {erlang,group_leader,0},                       1,    0.003,    0.003},     %
 [ ]}.

{[ ],
 { undefined,                                     0,    0.000,    0.000},     %
 [{{fprof,apply_start_stop,4},                    0,    3.638,    0.035}]}.    


%                                               CNT       ACC       OWN        
[{ "<0.40.0>",                                   15,undefined,    0.368},    %%
 { spawned_by, "<0.31.0>"},
 { spawned_as, {erlang,apply,["#Fun<emssserver.0.29990721>",[]]}},
 { initial_calls, [{erlang,apply,2},{emssserver,'-init/0-fun-0-',1}]}].

{[{undefined,                                     1,    0.453,    0.260}],     
 { {erlang,apply,2},                              1,    0.453,    0.260},     %
 [{{emssserver,'-init/0-fun-0-',1},               1,    0.108,    0.004},      
  {suspend,                                       1,    0.085,    0.000}]}.    

{[{{erlang,apply,2},                              1,    0.108,    0.004}],     
 { {emssserver,'-init/0-fun-0-',1},               1,    0.108,    0.004},     %
 [{{emssserver,accept_connection,1},              1,    0.104,    0.007}]}.    

{[{{emssserver,'-init/0-fun-0-',1},               1,    0.104,    0.007}],     
 { {emssserver,accept_connection,1},              1,    0.104,    0.007},     %
 [{{gen_tcp,accept,1},                            1,    0.097,    0.008}]}.    

{[{{emssserver,accept_connection,1},              1,    0.097,    0.008}],     
 { {gen_tcp,accept,1},                            1,    0.097,    0.008},     %
 [{{inet_tcp,accept,1},                           1,    0.072,    0.004},      
  {{inet_db,lookup_socket,1},                     1,    0.017,    0.009}]}.    

{[{{erlang,apply,2},                              1,    0.085,    0.000},      
  {{prim_inet,accept0,2},                         1,    0.000,    0.000}],     
 { suspend,                                       2,    0.085,    0.000},     %
 [ ]}.

{[{{gen_tcp,accept,1},                            1,    0.072,    0.004}],     
 { {inet_tcp,accept,1},                           1,    0.072,    0.004},     %
 [{{prim_inet,accept,1},                          1,    0.068,    0.004}]}.    

{[{{inet_tcp,accept,1},                           1,    0.068,    0.004}],     
 { {prim_inet,accept,1},                          1,    0.068,    0.004},     %
 [{{prim_inet,accept0,2},                         1,    0.064,    0.010}]}.    

{[{{prim_inet,accept,1},                          1,    0.064,    0.010}],     
 { {prim_inet,accept0,2},                         1,    0.064,    0.010},     %
 [{{prim_inet,async_accept,2},                    1,    0.054,    0.015},      
  {suspend,                                       1,    0.000,    0.000}]}.    

{[{{prim_inet,accept0,2},                         1,    0.054,    0.015}],     
 { {prim_inet,async_accept,2},                    1,    0.054,    0.015},     %
 [{{prim_inet,ctl_cmd,3},                         1,    0.035,    0.009},      
  {{prim_inet,enc_time,1},                        1,    0.004,    0.004}]}.    

{[{{prim_inet,async_accept,2},                    1,    0.035,    0.009}],     
 { {prim_inet,ctl_cmd,3},                         1,    0.035,    0.009},     %
 [{{erlang,port_control,3},                       1,    0.026,    0.026}]}.    

{[{{prim_inet,ctl_cmd,3},                         1,    0.026,    0.026}],     
 { {erlang,port_control,3},                       1,    0.026,    0.026},     %
 [ ]}.

{[{{gen_tcp,accept,1},                            1,    0.017,    0.009}],     
 { {inet_db,lookup_socket,1},                     1,    0.017,    0.009},     %
 [{{erlang,port_get_data,1},                      1,    0.008,    0.008}]}.    

{[{{inet_db,lookup_socket,1},                     1,    0.008,    0.008}],     
 { {erlang,port_get_data,1},                      1,    0.008,    0.008},     %
 [ ]}.

{[{{prim_inet,async_accept,2},                    1,    0.004,    0.004}],     
 { {prim_inet,enc_time,1},                        1,    0.004,    0.004},     %
 [ ]}.

{[ ],
 { undefined,                                     0,    0.000,    0.000},     %
 [{{erlang,apply,2},                              1,    0.453,    0.260}]}.    


%                                               CNT       ACC       OWN        
[{ "<0.41.0>",                                    5,undefined,    0.017},    %%
 { spawned_by, "<0.31.0>"},
 { spawned_as, {erlang,apply,["#Fun<emssserver.1.46281872>",[]]}},
 { initial_calls, [{erlang,apply,2},{emssserver,'-init/0-fun-1-',0}]}].

{[{undefined,                                     1,    0.409,    0.010}],     
 { {erlang,apply,2},                              1,    0.409,    0.010},     %
 [{{emssserver,'-init/0-fun-1-',0},               1,    0.338,    0.003},      
  {suspend,                                       1,    0.061,    0.000}]}.    

{[{{emssserver,group_manage,1},                   1,    0.331,    0.000},      
  {{erlang,apply,2},                              1,    0.061,    0.000}],     
 { suspend,                                       2,    0.392,    0.000},     %
 [ ]}.

{[{{erlang,apply,2},                              1,    0.338,    0.003}],     
 { {emssserver,'-init/0-fun-1-',0},               1,    0.338,    0.003},     %
 [{{emssserver,group_manage,1},                   1,    0.335,    0.004}]}.    

{[{{emssserver,'-init/0-fun-1-',0},               1,    0.335,    0.004}],     
 { {emssserver,group_manage,1},                   1,    0.335,    0.004},     %
 [{suspend,                                       1,    0.331,    0.000}]}.    

{[ ],
 { undefined,                                     0,    0.000,    0.000},     %
 [{{erlang,apply,2},                              1,    0.409,    0.010}]}.    


Done!
ok

5w:
3>
fprof:analyse().
Processing data...
Creating output...
%% Analysis results:
{  analysis_options,
 [{callers, true},
  {sort, acc},
  {totals, false},
  {details, true}]}.

%                                               CNT       ACC       OWN        
[{ totals,                                      243,    4.025,    2.016}].  %%%


%                                               CNT       ACC       OWN        
[{ "<0.31.0>",                                  224,undefined,    1.840}].   %%

{[{undefined,                                     0,    4.025,    0.037}],     
 { {fprof,apply_start_stop,4},                    0,    4.025,    0.037},     %
 [{{error_handler,undefined_function,3},          1,    3.819,    0.018},      
  {suspend,                                       1,    0.169,    0.000}]}.    

{[{{fprof,apply_start_stop,4},                    1,    3.819,    0.018},      
  {{gen_tcp,listen,2},                            1,    0.000,    0.016},      
  {{emssserver,init,0},                           1,    0.000,    0.018}],     
 { {error_handler,undefined_function,3},          3,    3.819,    0.052},     %
 [{{emssserver,init,0},                           1,    3.136,    0.036},      
  {{gen_tcp,listen,2},                            1,    2.129,    0.020},      
  {{error_handler,ensure_loaded,1},               3,    2.059,    0.026},      
  {{erlang,function_exported,3},                  3,    0.015,    0.015},      
  {{inet_tcp,getserv,1},                          1,    0.007,    0.007}]}.    

{[{{error_handler,undefined_function,3},          1,    3.136,    0.036}],     
 { {emssserver,init,0},                           1,    3.136,    0.036},     %
 [{{io,format,2},                                 1,    0.188,    0.011},      
  {{erlang,spawn,1},                              2,    0.057,    0.018},      
  {{erlang,register,2},                           2,    0.020,    0.020},      
  {{erlang,now,0},                                1,    0.009,    0.009},      
  {{error_handler,undefined_function,3},          1,    0.000,    0.018}]}.    

{[{{code_server,call,2},                          3,    1.945,    0.000},      
  {{fprof,apply_start_stop,4},                    1,    0.169,    0.000},      
  {{io,wait_io_mon_reply,2},                      1,    0.071,    0.000}],     
 { suspend,                                       5,    2.185,    0.000},     %
 [ ]}.

{[{{error_handler,undefined_function,3},          1,    2.129,    0.020}],     
 { {gen_tcp,listen,2},                            1,    2.129,    0.020},     %
 [{{inet_tcp,listen,2},                           1,    1.311,    0.040},      
  {{gen_tcp,mod,1},                               1,    0.045,    0.005},      
  {{error_handler,undefined_function,3},          1,    0.000,    0.016}]}.    

{[{{error_handler,undefined_function,3},          3,    2.059,    0.026}],     
 { {error_handler,ensure_loaded,1},               3,    2.059,    0.026},     %
 [{{code,ensure_loaded,1},                        3,    2.022,    0.013},      
  {{erlang,whereis,1},                            3,    0.011,    0.011}]}.    

{[{{error_handler,ensure_loaded,1},               3,    2.022,    0.013}],     
 { {code,ensure_loaded,1},                        3,    2.022,    0.013},     %
 [{{code,call,1},                                 3,    2.009,    0.013}]}.    

{[{{code,ensure_loaded,1},                        3,    2.009,    0.013}],     
 { {code,call,1},                                 3,    2.009,    0.013},     %
 [{{code_server,call,2},                          3,    1.996,    0.051}]}.    

{[{{code,call,1},                                 3,    1.996,    0.051}],     
 { {code_server,call,2},                          3,    1.996,    0.051},     %
 [{suspend,                                       3,    1.945,    0.000}]}.    

{[{{gen_tcp,listen,2},                            1,    1.311,    0.040}],     
 { {inet_tcp,listen,2},                           1,    1.311,    0.040},     %
 [{{inet,open,7},                                 1,    0.651,    0.025},      
  {{inet,listen_options,2},                       1,    0.560,    0.036},      
  {{prim_inet,listen,2},                          1,    0.060,    0.011}]}.    

{[{{inet_tcp,listen,2},                           1,    0.651,    0.025}],     
 { {inet,open,7},                                 1,    0.651,    0.025},     %
 [{{prim_inet,setopts,2},                         1,    0.485,    0.012},      
  {{prim_inet,open,2},                            1,    0.085,    0.004},      
  {{prim_inet,bind,3},                            1,    0.043,    0.015},      
  {{inet_db,register_socket,2},                   1,    0.013,    0.009}]}.    

{[{{inet_tcp,listen,2},                           1,    0.560,    0.036}],     
 { {inet,listen_options,2},                       1,    0.560,    0.036},     %
 [{{inet,list_opt,3},                             1,    0.483,    0.009},      
  {{application,get_env,2},                       1,    0.025,    0.003},      
  {{inet,translate_ip,2},                         1,    0.006,    0.006},      
  {{erlang,setelement,3},                         1,    0.006,    0.006},      
  {{inet,listen_options,0},                       1,    0.004,    0.004}]}.    

{[{{inet,open,7},                                 1,    0.485,    0.012}],     
 { {prim_inet,setopts,2},                         1,    0.485,    0.012},     %
 [{{prim_inet,encode_opt_val,1},                  1,    0.444,    0.007},      
  {{prim_inet,ctl_cmd,3},                         1,    0.029,    0.009}]}.    

{[{{inet,listen_options,2},                       1,    0.483,    0.009},      
  {{inet,list_opt,3},                             1,    0.000,    0.007},      
  {{inet,list_add,5},                             4,    0.000,    0.021}],     
 { {inet,list_opt,3},                             6,    0.483,    0.037},     %
 [{{inet,list_add,5},                             4,    0.464,    0.070},      
  {{erlang,setelement,3},                         1,    0.003,    0.003},      
  {{inet,list_opt,3},                             1,    0.000,    0.007}]}.    

{[{{inet,list_opt,3},                             4,    0.464,    0.070}],     
 { {inet,list_add,5},                             4,    0.464,    0.070},     %
 [{{inet,add_opt,4},                              4,    0.357,    0.068},      
  {{erlang,setelement,3},                         4,    0.016,    0.016},      
  {{inet,list_opt,3},                             4,    0.000,    0.021}]}.    

{[{{prim_inet,setopts,2},                         1,    0.444,    0.007}],     
 { {prim_inet,encode_opt_val,1},                  1,    0.444,    0.007},     %
 [{{prim_inet,enc_opt_val,2},                     1,    0.437,    0.004}]}.    

{[{{prim_inet,encode_opt_val,1},                  1,    0.437,    0.004},      
  {{prim_inet,enc_opt_val,4},                     4,    0.000,    0.019}],     
 { {prim_inet,enc_opt_val,2},                     5,    0.437,    0.023},     %
 [{{prim_inet,enc_opt_val,4},                     4,    0.433,    0.097}]}.    

{[{{prim_inet,enc_opt_val,2},                     4,    0.433,    0.097}],     
 { {prim_inet,enc_opt_val,4},                     4,    0.433,    0.097},     %
 [{{prim_inet,type_value,3},                      4,    0.134,    0.020},      
  {{prim_inet,enc_value,3},                       4,    0.129,    0.022},      
  {{prim_inet,type_opt,2},                        4,    0.034,    0.018},      
  {{prim_inet,enc_opt,1},                         4,    0.020,    0.020},      
  {{prim_inet,enc_opt_val,2},                     4,    0.000,    0.019}]}.    

{[{{inet,list_add,5},                             4,    0.357,    0.068}],     
 { {inet,add_opt,4},                              4,    0.357,    0.068},     %
 [{{prim_inet,is_sockopt_val,2},                  4,    0.182,    0.042},      
  {{lists,keydelete,3},                           4,    0.092,    0.019},      
  {{lists,member,2},                              4,    0.015,    0.015}]}.    

{[{{prim_inet,enc_opt_val,4},                     4,    0.134,    0.020},      
  {{prim_inet,is_sockopt_val,2},                  4,    0.110,    0.016}],     
 { {prim_inet,type_value,3},                      8,    0.244,    0.036},     %
 [{{prim_inet,type_value_default,3},              8,    0.208,    0.032}]}.    

{[{{prim_inet,type_value,3},                      8,    0.208,    0.032}],     
 { {prim_inet,type_value_default,3},              8,    0.208,    0.032},     %
 [{{prim_inet,type_value_1,3},                    8,    0.176,    0.042}]}.    

{[{{emssserver,init,0},                           1,    0.188,    0.011}],     
 { {io,format,2},                                 1,    0.188,    0.011},     %
 [{{io,format,3},                                 1,    0.163,    0.006},      
  {{io,default_output,0},                         1,    0.014,    0.012}]}.    

{[{{inet,add_opt,4},                              4,    0.182,    0.042}],     
 { {prim_inet,is_sockopt_val,2},                  4,    0.182,    0.042},     %
 [{{prim_inet,type_value,3},                      4,    0.110,    0.016},      
  {{prim_inet,type_opt,2},                        4,    0.030,    0.017}]}.    

{[{{prim_inet,type_value_default,3},              8,    0.176,    0.042}],     
 { {prim_inet,type_value_1,3},                    8,    0.176,    0.042},     %
 [{{prim_inet,type_value_2,2},                    8,    0.134,    0.077}]}.    

{[{{io,format,2},                                 1,    0.163,    0.006}],     
 { {io,format,3},                                 1,    0.163,    0.006},     %
 [{{io,o_request,2},                              1,    0.157,    0.010}]}.    

{[{{io,format,3},                                 1,    0.157,    0.010}],     
 { {io,o_request,2},                              1,    0.157,    0.010},     %
 [{{io,request,2},                                1,    0.147,    0.019}]}.    

{[{{io,o_request,2},                              1,    0.147,    0.019}],     
 { {io,request,2},                                1,    0.147,    0.019},     %
 [{{io,wait_io_mon_reply,2},                      1,    0.099,    0.022},      
  {{io,io_request,2},                             1,    0.021,    0.009},      
  {{erlang,monitor,2},                            1,    0.008,    0.008}]}.    

{[{{prim_inet,listen,2},                          1,    0.049,    0.008},      
  {{prim_inet,open1,2},                           1,    0.044,    0.011},      
  {{prim_inet,setopts,2},                         1,    0.029,    0.009},      
  {{prim_inet,bind,3},                            1,    0.019,    0.009}],     
 { {prim_inet,ctl_cmd,3},                         4,    0.141,    0.037},     %
 [{{erlang,port_control,3},                       4,    0.104,    0.104}]}.    

{[{{prim_inet,type_value_1,3},                    8,    0.134,    0.077}],     
 { {prim_inet,type_value_2,2},                    8,    0.134,    0.077},     %
 [{{prim_inet,enum_val,2},                        6,    0.057,    0.033}]}.    

{[{{prim_inet,enc_opt_val,4},                     4,    0.129,    0.022}],     
 { {prim_inet,enc_value,3},                       4,    0.129,    0.022},     %
 [{{prim_inet,enc_value_default,3},               4,    0.107,    0.019}]}.    

{[{{prim_inet,enc_value,3},                       4,    0.107,    0.019}],     
 { {prim_inet,enc_value_default,3},               4,    0.107,    0.019},     %
 [{{prim_inet,enc_value_1,3},                     4,    0.088,    0.023}]}.    

{[{{prim_inet,ctl_cmd,3},                         4,    0.104,    0.104}],     
 { {erlang,port_control,3},                       4,    0.104,    0.104},     %
 [ ]}.

{[{{io,request,2},                                1,    0.099,    0.022}],     
 { {io,wait_io_mon_reply,2},                      1,    0.099,    0.022},     %
 [{suspend,                                       1,    0.071,    0.000},      
  {{erlang,demonitor,1},                          1,    0.006,    0.006}]}.    

{[{{inet,add_opt,4},                              4,    0.092,    0.019}],     
 { {lists,keydelete,3},                           4,    0.092,    0.019},     %
 [{{lists,keydelete3,3},                          4,    0.073,    0.035}]}.    

{[{{prim_inet,enc_value_default,3},               4,    0.088,    0.023}],     
 { {prim_inet,enc_value_1,3},                     4,    0.088,    0.023},     %
 [{{prim_inet,enc_value_2,2},                     4,    0.065,    0.039}]}.    

{[{{inet,open,7},                                 1,    0.085,    0.004}],     
 { {prim_inet,open,2},                            1,    0.085,    0.004},     %
 [{{prim_inet,open1,2},                           1,    0.081,    0.012}]}.    

{[{{prim_inet,type_value_2,2},                    6,    0.057,    0.033},      
  {{prim_inet,enc_value_2,2},                     3,    0.026,    0.015},      
  {{prim_inet,enum_val,2},                        9,    0.000,    0.035}],     
 { {prim_inet,enum_val,2},                       18,    0.083,    0.083},     %
 [{{prim_inet,enum_val,2},                        9,    0.000,    0.035}]}.    

{[{{prim_inet,open,2},                            1,    0.081,    0.012}],     
 { {prim_inet,open1,2},                           1,    0.081,    0.012},     %
 [{{prim_inet,ctl_cmd,3},                         1,    0.044,    0.011},      
  {{prim_inet,open0,1},                           1,    0.025,    0.010}]}.    

{[{{lists,keydelete,3},                           4,    0.073,    0.035},      
  {{lists,keydelete3,3},                          8,    0.000,    0.038}],     
 { {lists,keydelete3,3},                         12,    0.073,    0.073},     %
 [{{lists,keydelete3,3},                          8,    0.000,    0.038}]}.    

{[{{prim_inet,enc_value_1,3},                     4,    0.065,    0.039}],     
 { {prim_inet,enc_value_2,2},                     4,    0.065,    0.039},     %
 [{{prim_inet,enum_val,2},                        3,    0.026,    0.015}]}.    

{[{{prim_inet,enc_opt_val,4},                     4,    0.034,    0.018},      
  {{prim_inet,is_sockopt_val,2},                  4,    0.030,    0.017}],     
 { {prim_inet,type_opt,2},                        8,    0.064,    0.035},     %
 [{{prim_inet,type_opt_1,1},                      8,    0.029,    0.029}]}.    

{[{{inet_tcp,listen,2},                           1,    0.060,    0.011}],     
 { {prim_inet,listen,2},                          1,    0.060,    0.011},     %
 [{{prim_inet,ctl_cmd,3},                         1,    0.049,    0.008}]}.    

{[{{emssserver,init,0},                           2,    0.057,    0.018}],     
 { {erlang,spawn,1},                              2,    0.057,    0.018},     %
 [{{erlang,spawn,3},                              2,    0.039,    0.039}]}.    

{[{{gen_tcp,listen,2},                            1,    0.045,    0.005},      
  {{gen_tcp,mod,1},                               4,    0.000,    0.017}],     
 { {gen_tcp,mod,1},                               5,    0.045,    0.022},     %
 [{{gen_tcp,mod,0},                               1,    0.023,    0.003},      
  {{gen_tcp,mod,1},                               4,    0.000,    0.017}]}.    

{[{{inet,open,7},                                 1,    0.043,    0.015}],     
 { {prim_inet,bind,3},                            1,    0.043,    0.015},     %
 [{{prim_inet,ctl_cmd,3},                         1,    0.019,    0.009},      
  {{prim_inet,ip_to_bytes,1},                     1,    0.009,    0.005}]}.    

{[{{erlang,spawn,1},                              2,    0.039,    0.039}],     
 { {erlang,spawn,3},                              2,    0.039,    0.039},     %
 [ ]}.

{[{{prim_inet,type_opt,2},                        8,    0.029,    0.029}],     
 { {prim_inet,type_opt_1,1},                      8,    0.029,    0.029},     %
 [ ]}.

{[{{prim_inet,open1,2},                           1,    0.025,    0.010}],     
 { {prim_inet,open0,1},                           1,    0.025,    0.010},     %
 [{{erlang,open_port,2},                          1,    0.011,    0.011},      
  {{prim_inet,protocol2drv,1},                    1,    0.004,    0.004}]}.    

{[{{inet,list_add,5},                             4,    0.016,    0.016},      
  {{inet,listen_options,2},                       1,    0.006,    0.006},      
  {{inet,list_opt,3},                             1,    0.003,    0.003}],     
 { {erlang,setelement,3},                         6,    0.025,    0.025},     %
 [ ]}.

{[{{inet,listen_options,2},                       1,    0.025,    0.003}],     
 { {application,get_env,2},                       1,    0.025,    0.003},     %
 [{{application_controller,get_env,2},            1,    0.022,    0.013}]}.    

{[{{gen_tcp,mod,1},                               1,    0.023,    0.003}],     
 { {gen_tcp,mod,0},                               1,    0.023,    0.003},     %
 [{{inet_db,tcp_module,0},                        1,    0.020,    0.004}]}.    

{[{{application,get_env,2},                       1,    0.022,    0.013}],     
 { {application_controller,get_env,2},            1,    0.022,    0.013},     %
 [{{ets,lookup,2},                                1,    0.009,    0.009}]}.    

{[{{io,request,2},                                1,    0.021,    0.009}],     
 { {io,io_request,2},                             1,    0.021,    0.009},     %
 [{garbage_collect,                               1,    0.012,    0.012}]}.    

{[{{prim_inet,enc_opt_val,4},                     4,    0.020,    0.020}],     
 { {prim_inet,enc_opt,1},                         4,    0.020,    0.020},     %
 [ ]}.

{[{{gen_tcp,mod,0},                               1,    0.020,    0.004}],     
 { {inet_db,tcp_module,0},                        1,    0.020,    0.004},     %
 [{{inet_db,db_get,1},                            1,    0.016,    0.010}]}.    

{[{{emssserver,init,0},                           2,    0.020,    0.020}],     
 { {erlang,register,2},                           2,    0.020,    0.020},     %
 [ ]}.

{[{{inet_db,tcp_module,0},                        1,    0.016,    0.010}],     
 { {inet_db,db_get,1},                            1,    0.016,    0.010},     %
 [{{ets,lookup,2},                                1,    0.006,    0.006}]}.    

{[{{inet,add_opt,4},                              4,    0.015,    0.015}],     
 { {lists,member,2},                              4,    0.015,    0.015},     %
 [ ]}.

{[{{application_controller,get_env,2},            1,    0.009,    0.009},      
  {{inet_db,db_get,1},                            1,    0.006,    0.006}],     
 { {ets,lookup,2},                                2,    0.015,    0.015},     %
 [ ]}.

{[{{error_handler,undefined_function,3},          3,    0.015,    0.015}],     
 { {erlang,function_exported,3},                  3,    0.015,    0.015},     %
 [ ]}.

{[{{io,format,2},                                 1,    0.014,    0.012}],     
 { {io,default_output,0},                         1,    0.014,    0.012},     %
 [{{erlang,group_leader,0},                       1,    0.002,    0.002}]}.    

{[{{inet,open,7},                                 1,    0.013,    0.009}],     
 { {inet_db,register_socket,2},                   1,    0.013,    0.009},     %
 [{{erlang,port_set_data,2},                      1,    0.004,    0.004}]}.    

{[{{io,io_request,2},                             1,    0.012,    0.012}],     
 { garbage_collect,                               1,    0.012,    0.012},     %
 [ ]}.

{[{{error_handler,ensure_loaded,1},               3,    0.011,    0.011}],     
 { {erlang,whereis,1},                            3,    0.011,    0.011},     %
 [ ]}.

{[{{prim_inet,open0,1},                           1,    0.011,    0.011}],     
 { {erlang,open_port,2},                          1,    0.011,    0.011},     %
 [ ]}.

{[{{prim_inet,bind,3},                            1,    0.009,    0.005}],     
 { {prim_inet,ip_to_bytes,1},                     1,    0.009,    0.005},     %
 [{{prim_inet,ip4_to_bytes,1},                    1,    0.004,    0.004}]}.    

{[{{emssserver,init,0},                           1,    0.009,    0.009}],     
 { {erlang,now,0},                                1,    0.009,    0.009},     %
 [ ]}.

{[{{io,request,2},                                1,    0.008,    0.008}],     
 { {erlang,monitor,2},                            1,    0.008,    0.008},     %
 [ ]}.

{[{{error_handler,undefined_function,3},          1,    0.007,    0.007}],     
 { {inet_tcp,getserv,1},                          1,    0.007,    0.007},     %
 [ ]}.

{[{{inet,listen_options,2},                       1,    0.006,    0.006}],     
 { {inet,translate_ip,2},                         1,    0.006,    0.006},     %
 [ ]}.

{[{{io,wait_io_mon_reply,2},                      1,    0.006,    0.006}],     
 { {erlang,demonitor,1},                          1,    0.006,    0.006},     %
 [ ]}.

{[{{prim_inet,open0,1},                           1,    0.004,    0.004}],     
 { {prim_inet,protocol2drv,1},                    1,    0.004,    0.004},     %
 [ ]}.

{[{{prim_inet,ip_to_bytes,1},                     1,    0.004,    0.004}],     
 { {prim_inet,ip4_to_bytes,1},                    1,    0.004,    0.004},     %
 [ ]}.

{[{{inet,listen_options,2},                       1,    0.004,    0.004}],     
 { {inet,listen_options,0},                       1,    0.004,    0.004},     %
 [ ]}.

{[{{inet_db,register_socket,2},                   1,    0.004,    0.004}],     
 { {erlang,port_set_data,2},                      1,    0.004,    0.004},     %
 [ ]}.

{[{{io,default_output,0},                         1,    0.002,    0.002}],     
 { {erlang,group_leader,0},                       1,    0.002,    0.002},     %
 [ ]}.

{[ ],
 { undefined,                                     0,    0.000,    0.000},     %
 [{{fprof,apply_start_stop,4},                    0,    4.025,    0.037}]}.    


%                                               CNT       ACC       OWN        
[{ "<0.35.0>",                                   14,undefined,    0.160},    %%
 { spawned_by, "<0.31.0>"},
 { spawned_as, {erlang,apply,["#Fun<emssserver.0.29990721>",[]]}},
 { initial_calls, [{erlang,apply,2},{emssserver,'-init/0-fun-0-',1}]}].

{[{undefined,                                     1,    0.249,    0.012}],     
 { {erlang,apply,2},                              1,    0.249,    0.012},     %
 [{{emssserver,'-init/0-fun-0-',1},               1,    0.148,    0.004},      
  {suspend,                                       1,    0.089,    0.000}]}.    

{[{{erlang,apply,2},                              1,    0.148,    0.004}],     
 { {emssserver,'-init/0-fun-0-',1},               1,    0.148,    0.004},     %
 [{{emssserver,accept_connection,1},              1,    0.144,    0.007}]}.    

{[{{emssserver,'-init/0-fun-0-',1},               1,    0.144,    0.007}],     
 { {emssserver,accept_connection,1},              1,    0.144,    0.007},     %
 [{{gen_tcp,accept,1},                            1,    0.137,    0.088}]}.    

{[{{emssserver,accept_connection,1},              1,    0.137,    0.088}],     
 { {gen_tcp,accept,1},                            1,    0.137,    0.088},     %
 [{{inet_tcp,accept,1},                           1,    0.037,    0.008},      
  {{inet_db,lookup_socket,1},                     1,    0.012,    0.007}]}.    

{[{{erlang,apply,2},                              1,    0.089,    0.000}],     
 { suspend,                                       1,    0.089,    0.000},     %
 [ ]}.

{[{{gen_tcp,accept,1},                            1,    0.037,    0.008}],     
 { {inet_tcp,accept,1},                           1,    0.037,    0.008},     %
 [{{prim_inet,accept,1},                          1,    0.029,    0.005}]}.    

{[{{inet_tcp,accept,1},                           1,    0.029,    0.005}],     
 { {prim_inet,accept,1},                          1,    0.029,    0.005},     %
 [{{prim_inet,accept0,2},                         1,    0.024,    0.004}]}.    

{[{{prim_inet,accept,1},                          1,    0.024,    0.004}],     
 { {prim_inet,accept0,2},                         1,    0.024,    0.004},     %
 [{{prim_inet,async_accept,2},                    1,    0.020,    0.010}]}.    

{[{{prim_inet,accept0,2},                         1,    0.020,    0.010}],     
 { {prim_inet,async_accept,2},                    1,    0.020,    0.010},     %
 [{{prim_inet,enc_time,1},                        1,    0.006,    0.006},      
  {{prim_inet,ctl_cmd,3},                         1,    0.004,    0.004}]}.    

{[{{gen_tcp,accept,1},                            1,    0.012,    0.007}],     
 { {inet_db,lookup_socket,1},                     1,    0.012,    0.007},     %
 [{{erlang,port_get_data,1},                      1,    0.005,    0.005}]}.    

{[{{prim_inet,async_accept,2},                    1,    0.006,    0.006}],     
 { {prim_inet,enc_time,1},                        1,    0.006,    0.006},     %
 [ ]}.

{[{{inet_db,lookup_socket,1},                     1,    0.005,    0.005}],     
 { {erlang,port_get_data,1},                      1,    0.005,    0.005},     %
 [ ]}.

{[{{prim_inet,async_accept,2},                    1,    0.004,    0.004}],     
 { {prim_inet,ctl_cmd,3},                         1,    0.004,    0.004},     %
 [{{erlang,port_control,3},                       1,    0.000,    0.000}]}.    

{[{{prim_inet,ctl_cmd,3},                         1,    0.000,    0.000}],     
 { {erlang,port_control,3},                       1,    0.000,    0.000},     %
 [ ]}.

{[ ],
 { undefined,                                     0,    0.000,    0.000},     %
 [{{erlang,apply,2},                              1,    0.249,    0.012}]}.    


%                                               CNT       ACC       OWN        
[{ "<0.36.0>",                                    5,undefined,    0.016},    %%
 { spawned_by, "<0.31.0>"},
 { spawned_as, {erlang,apply,["#Fun<emssserver.1.46281872>",[]]}},
 { initial_calls, [{erlang,apply,2},{emssserver,'-init/0-fun-1-',0}]}].

{[{undefined,                                     1,    0.208,    0.009}],     
 { {erlang,apply,2},                              1,    0.208,    0.009},     %
 [{suspend,                                       1,    0.109,    0.000},      
  {{emssserver,'-init/0-fun-1-',0},               1,    0.090,    0.004}]}.    

{[{{erlang,apply,2},                              1,    0.109,    0.000},      
  {{emssserver,group_manage,1},                   1,    0.083,    0.000}],     
 { suspend,                                       2,    0.192,    0.000},     %
 [ ]}.

{[{{erlang,apply,2},                              1,    0.090,    0.004}],     
 { {emssserver,'-init/0-fun-1-',0},               1,    0.090,    0.004},     %
 [{{emssserver,group_manage,1},                   1,    0.086,    0.003}]}.    

{[{{emssserver,'-init/0-fun-1-',0},               1,    0.086,    0.003}],     
 { {emssserver,group_manage,1},                   1,    0.086,    0.003},     %
 [{suspend,                                       1,    0.083,    0.000}]}.    

{[ ],
 { undefined,                                     0,    0.000,    0.000},     %
 [{{erlang,apply,2},                              1,    0.208,    0.009}]}.    


Done!
ok
0 请登录后投票
   发表时间:2008-02-16  
icej 写道
加了 true的默认项也没效果

哪个默认项是true?

建议把receive里面加上_Any匹配一下,打印输出或者是exit都可以,没有匹配的消息对性能影响特别大,特别是你这里大量消息的情况。
0 请登录后投票
   发表时间:2008-02-16  
sorry 记错了....晕了
any 没有输出内容,进程间通信的值不会有其他不能匹配上的吧?都是自己写的固定参数。
有gtalk或msn吗?方便加吗 方便。
谢谢!
0 请登录后投票
   发表时间:2008-02-16  
可能是多进程的关系,profile没有统计到其它几个进程。

gtalk: cpunion 鸡妹儿 点卡么
0 请登录后投票
   发表时间:2008-02-16  
难道是process数目限制引起的?
erl +P 50000
0 请登录后投票
   发表时间:2008-02-16  
他的进程数没几个的
0 请登录后投票
   发表时间:2008-02-16  
将1k,3k,1w,3w的消息量执行的时间列了出来
时间都是client端的,没有server的

用erlang:now 获得的unix时间戳。


1000行
recv 收 client
s:{1203,153348,319481} 开始时间
e:{1203,153348,340950} 结束时间

send  发 client
s:{1203,152336,201004}
e:{1203,152336,204824}

3000
recv
s:{1203,153458,324042}
e:{1203,153458,466801}

send
{1203,152446,201836}
{1203,152446,212793}

5000
recv
{1203,153555,442786}
{1203,153555,827598}

send
{1203,152543,317354}
{1203,152543,335749}

10000
recv
{1203,153655,449082}
{1203,153656,934513}

send
{1203,152643,320305}
{1203,152643,397123}

30000
recv
{1203,153743,824530}
{1203,153758,505836}

send
{1203,152731,692758}
{1203,152732,64380}
0 请登录后投票
   发表时间:2008-02-16  
进程数没几个 server应该5-6个左右
2个client
1 listen
1 group_manage
1 group
0 请登录后投票
   发表时间:2008-02-16  
感谢qiezi的帮忙!
代码的group下去掉一个无用ok,在server和client增加了tcp属性的设置{nodelay, false}, {delay_send, true},100W的数据在本地单机跑大概用40秒,迅驰1.7 1.5G内存的笔记本上。比以前快多了,谢谢qiezi一直在帮助,学到以前没了解的东西。

在我测试用的服务器上依然出现SERVER端CPU占用99%导致发消息慢的情况。感觉可能是服务器设置或erlang安装造成的问题,因为即使把代码放到同一机器走127.0.0.1的时候一样会出现cpu占满的情况的。

我在安装erlang的时候记得提示 没有java odbc libgd好像没别的库少了,各位还有别的办法吗?谢谢!
0 请登录后投票
   发表时间:2008-02-17  
1. 你最初的代码没有设置client socket的options,不知后来有没有改过。
2. 安装erlang时有没有enable-kernel-poll? 运行server时有没有加 +K true选项? kernel poll对提高性能作用很大。
0 请登录后投票
论坛首页 综合技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics