[erlang-questions] Newbie questions about file module

Ville Silventoinen <>
Tue Feb 17 12:39:24 CET 2009


Hi Bjorn,

Thank you very much for your help, you were right that I only included my
own module in the eprof. I ran it again now with file_server_2, the time in
file_name_1 has now dropped to 27%:

6> eprof:total_analyse().
FUNCTION                                       CALLS      TIME
erlang:port_command/2                          65075      53 %
file:file_name_1/1                             3086234    27 %
prim_file:get_uint32s/1                        231210     3 %
prim_file:drv_get_response/1                   72301      1 %
prim_file:uint32/4                             223503     1 %
gen:do_call/4                                  29869      1 %
prim_file:drv_command/4                        65075      1 %
prim_file:translate_response/2                 72301      1 %
gen_server:handle_msg/5                        29869      1 %
prim_file:drv_command/3                        65075      1 %
file:check_args/1                              93941      0 %
gen:wait_resp_mon/3                            29869      0 %
file_server:handle_call/3                      29869      0 %
mirror11:get_file_info/2                       21195      0 %
erlang:iolist_to_binary/1                      44100      0 %
prim_file:get_uint64/1                         28462      0 %
prim_file:drv_get_response/2                   72301      0 %
file:check_and_call/2                          29869      0 %
gen:call/4                                     29869      0 %
prim_file:open_int/4                           26976      0 %
file:file_name/1                               36615      0 %
file:call/2                                    29869      0 %
prim_file:open_mode/4                          40464      0 %
gen_server:call/3                              29869      0 %
prim_file:drv_command/2                        64113      0 %
erlang:bump_reductions/1                       72301      0 %
gen_server:loop/6                              29869      0 %
prim_file:write_file_info_int/3                7225       0 %
mirror11:do_file/4                             6744       0 %
prim_file:reverse/1                            26976      0 %
prim_file:get_uint32/1                         56924      0 %
gen_server:reply/2                             29869      0 %
prim_file:transform_info_ints/1                7707       0 %
file:read_link_info/1                          14451      0 %
file:copy_int/3                                13488      0 %
prim_file:drv_close/1                          13488      0 %
erlang:'++'/2                                  21680      0 %
erlang:monitor/2                               29869      0 %
gen_server:decode_msg/8                        29869      0 %
erlang:whereis/1                               29869      0 %
erlang:open_port/2                             13488      0 %
prim_file:open/2                               13488      0 %
erlang:list_to_tuple/1                         29869      0 %
prim_file:close/1                              13488      0 %
erlang:list_to_binary/1                        21195      0 %
erlang:port_close/1                            13488      0 %
erlang:demonitor/1                             29869      0 %
prim_file:drv_open/2                           13488      0 %
prim_file:open_mode/1                          13488      0 %
file:copy_opened_int/4                         7487       0 %
mirror11:by_type/6                             7707       0 %
ets:lookup/2                                   21195      0 %
lists:reverse/2                                26976      0 %
lists:foreach/2                                7708       0 %
prim_file:int_to_bytes/1                       21675      0 %
mirror11:log_debug/2                           6748       0 %
prim_file:date_to_bytes/1                      21675      0 %
file:write_file_info/2                         7225       0 %
prim_file:read/2                               7487       0 %
prim_file:write/2                              7487       0 %
prim_file:read_link_info/2                     14451      0 %
prim_file:read_link_info_int/2                 14451      0 %
ets:insert/2                                   7707       0 %
prim_file:open_int_setopts/3                   13488      0 %
erlang:list_to_atom/1                          7227       0 %
file:read/2                                    7487       0 %
file:write/2                                   7487       0 %
mirror11:do_dir/3                              481        0 %
prim_file:copy/3                               6744       0 %
prim_file:write_file_info/3                    7225       0 %
prim_file:file_access/1                        7707       0 %
file:copy_opened_int/3                         6744       0 %
prim_file:file_type/1                          7707       0 %
file:copy_opened/3                             6744       0 %
mirror11:'-do_dir/3-fun-5-'/4                  6744       0 %
file:copy/2                                    6744       0 %
ets:delete/1                                   481        0 %
mirror11:start_dir_workers/5                   963        0 %
file:list_dir/1                                962        0 %
mirror11:rendezvous/1                          963        0 %
file:make_dir/1                                481        0 %
erlang:apply/2                                 481        0 %
erlang:spawn/3                                 481        0 %
ets:new/2                                      481        0 %
prim_file:list_dir/2                           962        0 %
erlang:spawn/1                                 481        0 %
prim_file:list_dir_int/2                       962        0 %
prim_file:make_dir/2                           481        0 %
prim_file:make_dir_int/2                       481        0 %
mirror11:'-start_dir_workers/5-fun-0-'/3       481        0 %
mirror11:do_symlink/4                          2          0 %
file:read_link/1                               4          0 %
mirror11:master_loop/0                         1          0 %
file:make_symlink/2                            2          0 %
prim_file:read_link/2                          4          0 %
prim_file:read_link_int/2                      4          0 %
mirror11:'-do_dir/3-fun-6-'/4                  2          0 %
prim_file:make_symlink/3                       2          0 %
prim_file:make_symlink_int/3                   2          0 %

Total time: 157.56
Measurement overhead: 20.49

Thanks,
Ville


On Tue, Feb 17, 2009 at 10:10 AM, Bjorn Gustavsson <>wrote:

> Unless you specifically included the file_server_2 process in the set
> of processes
> to profile, you are only profiling the time spent in your own
> processes and not code
> that is executed in other processes. (And since I don't see no calls
> from the file_server or prim_file
> module in the output from eprof, I assume that you did not include the
> file_server_2 process.)
>
> /Bjorn
> --
> Björn Gustavsson, Erlang/OTP, Ericsson AB
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090217/f3ce2a83/attachment.html>


More information about the erlang-questions mailing list