[erlang-questions] about erlang eprof tool. Why is the handle_info and handle_cast without in the result

郎咸武 <>
Wed May 18 10:57:33 CEST 2011


hi everybody:
I write a test 'chat' code with eprof.
I have found the handle_info and handle_cast functions without in the
anaylise result.
Why ?

thanks
Regards
jason

  1 -module(chat).


  2 -compile(export_all).
  3 %-behaviour(gen_server).
  4 start(N) ->
  5     start_link(),
  6     eprof:start(),
  7     eprof:start_profiling([chat]),
  8     test(N),
  9     testcast(),
 10     test(),
 11     eprof:stop_profiling(),
 12     eprof:log(chat),
 13     eprof:analyse(),
 14     eprof:total_analyse().
 15
 16 test(N)->
 17     gen_server:call(?MODULE, {test,N}).
 18 test()->
 19     chat ! {test,1}.
 20 testcast() ->
 21     gen_server:cast(?MODULE,castttt).
 22
 23 start_link() ->
 24     gen_server:start_link({local,?MODULE},?MODULE,[],[]).
 25
 26 init([]) ->
 27     {ok, {}}.
 28
 29 handle_cast(Msg,State) ->
 30     tttt(),
 31     io:format("cast=~p~n",[Msg]),
 32     {noreply,State}.
 33
 34 handle_call({test,Number},From, State) when is_number(Number) ->
 35     Reply = Number+1,
 36     {reply, Reply,State};
 37
 38 handle_call(_,From, State) ->
 39     Reply = numerror,
 40     {reply, Reply,State}.
 41 handle_info(Ino,State) ->
 42     tttt(),
 43     io:format("info=~p~n",[Ino]),
 44     {noreply,State}.
 45 tttt() ->
 46     ok.
%%%%%%%%%%%%%%%%%
Test result
5> chat:start(1).
eprof: Starting profiling .....
eprof: Stop profiling
cast=castttt
info={test,1}
FUNCTION                                       CALLS      TIME

****** Process <0.35.0>    -- 100 % of profiled time ***
gen_server:loop/6                               1          30 %
gen_server:handle_msg/5                   1          28 %
chat:handle_call/3                              1          21 %
gen_server:reply/2                             1          14 %
gen_server:decode_msg/8                  1          8 %

Total time: 0.00
Measurement overhead: 0.00
FUNCTION                                       CALLS      TIME
gen_server:loop/6                                1          30 %
gen_server:handle_msg/5                     1          28 %
chat:handle_call/3                                1          21 %
gen_server:reply/2                               1          14 %
gen_server:decode_msg/8                    1          8 %

Total time: 0.00
Measurement overhead: 0.00
ok
6>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110518/23edf2f0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: chat.erl
Type: text/x-erlang
Size: 924 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110518/23edf2f0/attachment.bin>


More information about the erlang-questions mailing list