[erlang-questions] Percept2 and gen_server messages

Tyron Zerafa tyron.zerafa@REDACTED
Wed Jan 22 08:19:41 CET 2014


That did the trick, I changed the function which I was profiling and
everything worked like charm :) Cheers


On Sun, Jan 19, 2014 at 10:22 PM, <H.Li@REDACTED> wrote:

> Hi Tyron,
>
> Percept2 monitors both types of communications (via explicit message
> passing and the gen_server:call/2). The reason that you got only one
> message send/receive is that the 'start_link' function you profiled
> returned immediately after the gen_server has been started, so the process
> you saw was the process that started the gen_server process, not the
> gen_server process itself.
>
> Kind Regards,
> Huiqing
>
> > Hi all,
> >
> >     I am trying to use Percept2 to find out the communication overhead of
> > a
> > gen_server process. However, when I'm analyzing the "*.dat" generated I'm
> > only finding the following for my gen_server process (code below):
> > msgs_recv = 1
> > avg_size_msgs_recv = 18
> > msgs_sent = 1
> > avg_size_msgs_sent = 72
> >
> > We are communicating with this server both via messages (ServerPid !
> > {test}) and the gen_server:call/2
> >
> > Are we missing something here? Shouldn't the request/ replies be recorded
> > as msgs?
> >
> >
> >
> >
> >
> >
> >
> >
> > %%  gen_server code
> > -module(test_percept_1).
> >
> > -behaviour(gen_server).
> >
> > -define(SERVER, ?MODULE).
> >
> > -export([
> > init/1,
> > handle_call/3,
> > start_link/0,
> > handle_info/2 ,
> >         .....
> > ]).
> >
> > start_profiling() ->
> > percept2:profile("data.dat", {test_percept_1,start_link, []},[all]).
> > stop_profiling() ->
> > percept2:stop().
> > start_link() ->
> > case gen_server:start_link({local, ?SERVER}, ?SERVER, [], []) of
> > {ok, Pid} ->
> > io:format("Gen_server started: ~p on node: ~p. ~n",[Pid,node()]),
> > {ok,Pid};
> > Other ->
> > io:format("Error starting ~p: ~p. ~n",[?SERVER,Other]),
> > {error, Other}
> >     end.
> > init([]) -> {ok,[]}.
> >
> > ....
> >
> > handle_call({test},_From,State)->
> > {reply,"This is a test string",State}.
> >
> > .....
> > handle_info(_, State) ->
> > {noreply,state}.
> >
> > .....
> >
> >
> >
> > --
> > Best Regards,
> > Tyron Zerafa
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://erlang.org/mailman/listinfo/erlang-questions
> >
>
>
>


-- 
Best Regards,
Tyron Zerafa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140122/488139bf/attachment.htm>


More information about the erlang-questions mailing list