Skip to content

Instantly share code, notes, and snippets.

@begoon
Forked from arcusfelis/tcp_proxy_profile.erl
Created December 13, 2011 12:35
Show Gist options
  • Save begoon/1471987 to your computer and use it in GitHub Desktop.
Save begoon/1471987 to your computer and use it in GitHub Desktop.
tcp_proxy profile
Eshell V5.8.4 (abort with ^G)
1> c(tcp_proxy, [debug_info, export_all]).
{ok,tcp_proxy}
2> fprof:apply(tcp_proxy, dump_binary, [1,<<"Test 3">>]).
[["000",49],
58,32,
["000",48],
58,32,
["54 65 73 74 20 33 ",
[32,[32," ",32,32,32],32," ",32,32,32],
32,
[32," ",32,32,32],
32," ",32,32,32],
124,32,
["Test 3",[32," ",32,32],32," ",32,32],
"\n"]
3> fprof:profile().
Reading trace data...
End of trace!
ok
4> fprof:analyse().
Processing data...
Creating output...
%% Analysis results:
{ analysis_options,
[{callers, true},
{sort, acc},
{totals, false},
{details, true}]}.
% CNT ACC OWN
[{ totals, 531, 3.332, 3.198}]. %%%
% CNT ACC OWN
[{ "<0.32.0>", 531,undefined, 3.198}]. %%
{[{undefined, 0, 3.332, 0.030}],
{ {fprof,apply_start_stop,4}, 0, 3.332, 0.030}, %
[{{tcp_proxy,dump_binary,2}, 1, 3.302, 0.013},
{suspend, 1, 0.000, 0.000}]}.
{[{{fprof,apply_start_stop,4}, 1, 3.302, 0.013}],
{ {tcp_proxy,dump_binary,2}, 1, 3.302, 0.013}, %
[{{tcp_proxy,dump_list,3}, 1, 3.281, 0.031},
{{erlang,binary_to_list,1}, 1, 0.008, 0.008}]}.
{[{{tcp_proxy,dump_binary,2}, 1, 3.281, 0.031},
{{tcp_proxy,dump_list,3}, 1, 0.000, 0.004}],
{ {tcp_proxy,dump_list,3}, 2, 3.281, 0.035}, %
[{{tcp_proxy,dump_numbers,1}, 1, 1.770, 0.008},
{{io_lib,format,2}, 1, 1.323, 0.007},
{{tcp_proxy,dump_chars,1}, 1, 0.090, 0.005},
{{lists,split,2}, 1, 0.045, 0.008},
{{lists,min,1}, 1, 0.013, 0.005},
{{erlang,'++',2}, 1, 0.005, 0.005},
{{tcp_proxy,dump_list,3}, 1, 0.000, 0.004}]}.
{[{{tcp_proxy,'-dump_numbers/1-lc$^0/1-0-',1}, 6, 1.433, 0.043},
{{tcp_proxy,dump_list,3}, 1, 1.323, 0.007}],
{ {io_lib,format,2}, 7, 2.756, 0.050}, %
[{{io_lib_format,fwrite,2}, 7, 2.706, 0.084}]}.
{[{{io_lib,format,2}, 7, 2.706, 0.084}],
{ {io_lib_format,fwrite,2}, 7, 2.706, 0.084}, %
[{{io_lib_format,build,3}, 7, 1.385, 0.141},
{{io_lib_format,collect,2}, 7, 0.964, 0.105},
{{io_lib_format,pcount,1}, 7, 0.139, 0.026},
{suspend, 1, 0.134, 0.000}]}.
{[{{tcp_proxy,dump_list,3}, 1, 1.770, 0.008}],
{ {tcp_proxy,dump_numbers,1}, 1, 1.770, 0.008}, %
[{{tcp_proxy,'-dump_numbers/1-lc$^0/1-0-',1}, 1, 1.499, 0.034},
{{lists,flatten,1}, 1, 0.263, 0.004}]}.
{[{{tcp_proxy,dump_numbers,1}, 1, 1.499, 0.034},
{{tcp_proxy,'-dump_numbers/1-lc$^0/1-0-',1}, 6, 0.000, 0.032}],
{ {tcp_proxy,'-dump_numbers/1-lc$^0/1-0-',1}, 7, 1.499, 0.066}, %
[{{io_lib,format,2}, 6, 1.433, 0.043},
{{tcp_proxy,'-dump_numbers/1-lc$^0/1-0-',1}, 6, 0.000, 0.032}]}.
{[{{io_lib_format,fwrite,2}, 7, 1.385, 0.141},
{{io_lib_format,build,3}, 23, 0.000, 0.155}],
{ {io_lib_format,build,3}, 30, 1.385, 0.296}, %
[{{io_lib_format,control,8}, 11, 1.048, 0.080},
{{io_lib_format,decr_pc,2}, 11, 0.041, 0.041},
{{io_lib_format,build,3}, 23, 0.000, 0.155}]}.
{[{{io_lib_format,build,3}, 11, 1.048, 0.080}],
{ {io_lib_format,control,8}, 11, 1.048, 0.080}, %
[{{io_lib_format,unprefixed_integer,6}, 8, 0.529, 0.089},
{{io_lib_format,iolist_to_chars,1}, 2, 0.212, 0.043},
{{io_lib_format,string,5}, 2, 0.195, 0.015},
{{io_lib_format,base,1}, 8, 0.029, 0.029},
{{io_lib_format,newline,4}, 1, 0.003, 0.003}]}.
{[{{io_lib_format,fwrite,2}, 7, 0.964, 0.105},
{{io_lib_format,collect,2}, 23, 0.000, 0.122}],
{ {io_lib_format,collect,2}, 30, 0.964, 0.227}, %
[{{io_lib_format,collect_cseq,2}, 11, 0.737, 0.227},
{{io_lib_format,collect,2}, 23, 0.000, 0.122}]}.
{[{{io_lib_format,collect,2}, 11, 0.737, 0.227}],
{ {io_lib_format,collect_cseq,2}, 11, 0.737, 0.227}, %
[{{io_lib_format,field_width,2}, 11, 0.225, 0.083},
{{io_lib_format,precision,2}, 11, 0.165, 0.041},
{{io_lib_format,collect_cc,2}, 11, 0.044, 0.044},
{{io_lib_format,pad_char,2}, 11, 0.039, 0.039},
{{io_lib_format,encoding,2}, 11, 0.037, 0.037}]}.
{[{{io_lib_format,control,8}, 8, 0.529, 0.089}],
{ {io_lib_format,unprefixed_integer,6}, 8, 0.529, 0.089}, %
[{{io_lib_format,term,5}, 8, 0.320, 0.119},
{{erlang,integer_to_list,2}, 8, 0.093, 0.036},
{{io_lib_format,cond_lowercase,2}, 8, 0.027, 0.027}]}.
{[{{io_lib_format,unprefixed_integer,6}, 8, 0.320, 0.119}],
{ {io_lib_format,term,5}, 8, 0.320, 0.119}, %
[{{lists,flatlength,1}, 8, 0.113, 0.032},
{{io_lib_format,adjust,3}, 8, 0.031, 0.031},
{{io_lib_format,chars,2}, 8, 0.029, 0.029},
{{erlang,min,2}, 8, 0.028, 0.028}]}.
{[{{tcp_proxy,dump_numbers,1}, 1, 0.263, 0.004}],
{ {lists,flatten,1}, 1, 0.263, 0.004}, %
[{{lists,do_flatten,2}, 1, 0.259, 0.055}]}.
{[{{lists,flatten,1}, 1, 0.259, 0.055},
{{lists,do_flatten,2}, 42, 0.000, 0.204}],
{ {lists,do_flatten,2}, 43, 0.259, 0.259}, %
[{{lists,do_flatten,2}, 42, 0.000, 0.204}]}.
{[{{io_lib_format,precision,2}, 8, 0.124, 0.032},
{{io_lib_format,field_width,2}, 11, 0.104, 0.043}],
{ {io_lib_format,field_value,2}, 19, 0.228, 0.075}, %
[{{io_lib_format,field_value,3}, 16, 0.153, 0.065}]}.
{[{{io_lib_format,term,5}, 8, 0.113, 0.032},
{{io_lib_format,string,5}, 2, 0.113, 0.008}],
{ {lists,flatlength,1}, 10, 0.226, 0.040}, %
[{{lists,flatlength,2}, 10, 0.186, 0.039}]}.
{[{{io_lib_format,collect_cseq,2}, 11, 0.225, 0.083}],
{ {io_lib_format,field_width,2}, 11, 0.225, 0.083}, %
[{{io_lib_format,field_value,2}, 11, 0.104, 0.043},
{{io_lib_format,field_width,3}, 11, 0.038, 0.038}]}.
{[{{io_lib_format,control,8}, 2, 0.212, 0.043},
{{io_lib_format,iolist_to_chars,1}, 24, 0.000, 0.143}],
{ {io_lib_format,iolist_to_chars,1}, 26, 0.212, 0.186}, %
[{garbage_collect, 1, 0.026, 0.026},
{{io_lib_format,iolist_to_chars,1}, 24, 0.000, 0.143}]}.
{[{{io_lib_format,control,8}, 2, 0.195, 0.015}],
{ {io_lib_format,string,5}, 2, 0.195, 0.015}, %
[{{lists,flatlength,1}, 2, 0.113, 0.008},
{{io_lib_format,string_field,5}, 2, 0.067, 0.016}]}.
{[{{lists,flatlength,1}, 10, 0.186, 0.039},
{{lists,flatlength,2}, 38, 0.000, 0.147}],
{ {lists,flatlength,2}, 48, 0.186, 0.186}, %
[{{lists,flatlength,2}, 38, 0.000, 0.147}]}.
{[{{io_lib_format,collect_cseq,2}, 11, 0.165, 0.041}],
{ {io_lib_format,precision,2}, 11, 0.165, 0.041}, %
[{{io_lib_format,field_value,2}, 8, 0.124, 0.032}]}.
{[{{io_lib_format,field_value,2}, 16, 0.153, 0.065},
{{io_lib_format,field_value,3}, 24, 0.000, 0.088}],
{ {io_lib_format,field_value,3}, 40, 0.153, 0.153}, %
[{{io_lib_format,field_value,3}, 24, 0.000, 0.088}]}.
{[{{io_lib_format,fwrite,2}, 7, 0.139, 0.026}],
{ {io_lib_format,pcount,1}, 7, 0.139, 0.026}, %
[{{io_lib_format,pcount,2}, 7, 0.113, 0.027}]}.
{[{{io_lib_format,fwrite,2}, 1, 0.134, 0.000},
{{fprof,apply_start_stop,4}, 1, 0.000, 0.000}],
{ suspend, 2, 0.134, 0.000}, %
[ ]}.
{[{{io_lib_format,pcount,1}, 7, 0.113, 0.027},
{{io_lib_format,pcount,2}, 23, 0.000, 0.086}],
{ {io_lib_format,pcount,2}, 30, 0.113, 0.113}, %
[{{io_lib_format,pcount,2}, 23, 0.000, 0.086}]}.
{[{{io_lib_format,unprefixed_integer,6}, 8, 0.093, 0.036}],
{ {erlang,integer_to_list,2}, 8, 0.093, 0.036}, %
[{{erlang,integer_to_list,3}, 7, 0.052, 0.030},
{{erlang,integer_to_list,1}, 1, 0.005, 0.005}]}.
{[{{tcp_proxy,dump_list,3}, 1, 0.090, 0.005}],
{ {tcp_proxy,dump_chars,1}, 1, 0.090, 0.005}, %
[{{lists,map,2}, 1, 0.085, 0.033}]}.
{[{{tcp_proxy,dump_chars,1}, 1, 0.085, 0.033},
{{lists,map,2}, 6, 0.000, 0.030}],
{ {lists,map,2}, 7, 0.085, 0.063}, %
[{{tcp_proxy,'-dump_chars/1-fun-0-',1}, 6, 0.022, 0.022},
{{lists,map,2}, 6, 0.000, 0.030}]}.
{[{{io_lib_format,string_field,5}, 2, 0.044, 0.018},
{{io_lib_format,term,5}, 8, 0.029, 0.029},
{{io_lib_format,chars,2}, 5, 0.000, 0.026}],
{ {io_lib_format,chars,2}, 15, 0.073, 0.073}, %
[{{io_lib_format,chars,2}, 5, 0.000, 0.026}]}.
{[{{io_lib_format,string,5}, 2, 0.067, 0.016}],
{ {io_lib_format,string_field,5}, 2, 0.067, 0.016}, %
[{{io_lib_format,chars,2}, 2, 0.044, 0.018},
{{io_lib_format,adjust,3}, 2, 0.007, 0.007}]}.
{[{{erlang,integer_to_list,2}, 7, 0.052, 0.030},
{{erlang,integer_to_list,3}, 6, 0.000, 0.022}],
{ {erlang,integer_to_list,3}, 13, 0.052, 0.052}, %
[{{erlang,integer_to_list,3}, 6, 0.000, 0.022}]}.
{[{{tcp_proxy,dump_list,3}, 1, 0.045, 0.008}],
{ {lists,split,2}, 1, 0.045, 0.008}, %
[{{lists,split,3}, 1, 0.037, 0.004}]}.
{[{{io_lib_format,collect_cseq,2}, 11, 0.044, 0.044}],
{ {io_lib_format,collect_cc,2}, 11, 0.044, 0.044}, %
[ ]}.
{[{{io_lib_format,build,3}, 11, 0.041, 0.041}],
{ {io_lib_format,decr_pc,2}, 11, 0.041, 0.041}, %
[ ]}.
{[{{io_lib_format,collect_cseq,2}, 11, 0.039, 0.039}],
{ {io_lib_format,pad_char,2}, 11, 0.039, 0.039}, %
[ ]}.
{[{{io_lib_format,field_width,2}, 11, 0.038, 0.038}],
{ {io_lib_format,field_width,3}, 11, 0.038, 0.038}, %
[ ]}.
{[{{io_lib_format,term,5}, 8, 0.031, 0.031},
{{io_lib_format,string_field,5}, 2, 0.007, 0.007}],
{ {io_lib_format,adjust,3}, 10, 0.038, 0.038}, %
[ ]}.
{[{{lists,split,2}, 1, 0.037, 0.004},
{{lists,split,3}, 6, 0.000, 0.029}],
{ {lists,split,3}, 7, 0.037, 0.033}, %
[{{lists,reverse,2}, 1, 0.004, 0.004},
{{lists,split,3}, 6, 0.000, 0.029}]}.
{[{{io_lib_format,collect_cseq,2}, 11, 0.037, 0.037}],
{ {io_lib_format,encoding,2}, 11, 0.037, 0.037}, %
[ ]}.
{[{{io_lib_format,control,8}, 8, 0.029, 0.029}],
{ {io_lib_format,base,1}, 8, 0.029, 0.029}, %
[ ]}.
{[{{io_lib_format,term,5}, 8, 0.028, 0.028}],
{ {erlang,min,2}, 8, 0.028, 0.028}, %
[ ]}.
{[{{io_lib_format,unprefixed_integer,6}, 8, 0.027, 0.027}],
{ {io_lib_format,cond_lowercase,2}, 8, 0.027, 0.027}, %
[ ]}.
{[{{io_lib_format,iolist_to_chars,1}, 1, 0.026, 0.026}],
{ garbage_collect, 1, 0.026, 0.026}, %
[ ]}.
{[{{lists,map,2}, 6, 0.022, 0.022}],
{ {tcp_proxy,'-dump_chars/1-fun-0-',1}, 6, 0.022, 0.022}, %
[ ]}.
{[{{tcp_proxy,dump_list,3}, 1, 0.013, 0.005}],
{ {lists,min,1}, 1, 0.013, 0.005}, %
[{{lists,min,2}, 1, 0.008, 0.004}]}.
{[{{lists,min,1}, 1, 0.008, 0.004},
{{lists,min,2}, 1, 0.000, 0.004}],
{ {lists,min,2}, 2, 0.008, 0.008}, %
[{{lists,min,2}, 1, 0.000, 0.004}]}.
{[{{tcp_proxy,dump_binary,2}, 1, 0.008, 0.008}],
{ {erlang,binary_to_list,1}, 1, 0.008, 0.008}, %
[ ]}.
{[{{erlang,integer_to_list,2}, 1, 0.005, 0.005}],
{ {erlang,integer_to_list,1}, 1, 0.005, 0.005}, %
[ ]}.
{[{{tcp_proxy,dump_list,3}, 1, 0.005, 0.005}],
{ {erlang,'++',2}, 1, 0.005, 0.005}, %
[ ]}.
{[{{lists,split,3}, 1, 0.004, 0.004}],
{ {lists,reverse,2}, 1, 0.004, 0.004}, %
[ ]}.
{[{{io_lib_format,control,8}, 1, 0.003, 0.003}],
{ {io_lib_format,newline,4}, 1, 0.003, 0.003}, %
[ ]}.
{[ ],
{ undefined, 0, 0.000, 0.000}, %
[{{fprof,apply_start_stop,4}, 0, 3.332, 0.030}]}.
Done!
ok
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment