[erlang-questions] about erlang eprof tool. Why is the handle_info and handle_cast without in the result
jasonlxw
langxianzhe@REDACTED
Wed May 18 12:20:22 CEST 2011
I try to do after adding seelp.
It is ok .
You are right.
Thank you,
2011/5/18 Ahmed Omar [via Erlang] <
ml-node+3532180-407008175-67370@REDACTED>
> Sending a message (handled by handle_info) or doing a cast (handled by
> handle_cast) are both async.
> You are stopping the profiler too early.
> Changing the order to do the async operations first, then the sync one
> should assure that all the requests have been handled before you stop eprof
>
> On Wed, May 18, 2011 at 10:57 AM, 郎咸武 <[hidden email]<http://user/SendEmail.jtp?type=node&node=3532180&i=0>
> > wrote:
>
>> 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>
>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> [hidden email] <http://user/SendEmail.jtp?type=node&node=3532180&i=1>
>>
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
>
>
> --
> Best Regards,
> - Ahmed Omar
> http://nl.linkedin.com/in/adiaa
> Follow me on twitter
> @spawn_think <http://twitter.com/#%21/spawn_think>
>
>
> _______________________________________________
> erlang-questions mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=3532180&i=2>
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://erlang.2086793.n4.nabble.com/about-erlang-eprof-tool-Why-is-the-handle-info-and-handle-cast-without-in-the-result-tp3532017p3532180.html
> To start a new topic under Erlang Questions, email
> ml-node+2086794-1604045721-67370@REDACTED
> To unsubscribe from Erlang Questions, click here<http://erlang.2086793.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2086794&code=bGFuZ3hpYW56aGVAZ21haWwuY29tfDIwODY3OTR8MTA2ODExODQ5Ng==>.
>
>
-----
Never give up
--
View this message in context: http://erlang.2086793.n4.nabble.com/about-erlang-eprof-tool-Why-is-the-handle-info-and-handle-cast-without-in-the-result-tp3532017p3532216.html
Sent from the Erlang Questions mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110518/772f3f6a/attachment.htm>
More information about the erlang-questions
mailing list