[erlang-questions] Percept2 and gen_server messages

Tyron Zerafa tyron.zerafa@REDACTED
Sun Jan 19 19:32:24 CET 2014


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140119/4b8e03ba/attachment.htm>


More information about the erlang-questions mailing list