<div dir="ltr">Hi all,<div><br></div><div> 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):</div>
<table class="" align="center" border="0" cellspacing="10" width="1100"><tbody><tr><td align="left">msgs_recv = 1<br>avg_size_msgs_recv = 18<br>msgs_sent = 1<br>avg_size_msgs_sent = 72<br><br>We are communicating with this server both via messages (ServerPid ! {test}) and the gen_server:call/2<br>
<br>Are we missing something here? Shouldn't the request/ replies be recorded as msgs?<br><br><br></td><td align="left"><br></td><td align="left"><br></td><td align="left"><br></td></tr></tbody></table><div> <br clear="all">
<div><br></div><div><br></div><div>%% gen_server code</div><div><div>-module(test_percept_1).</div><div> </div><div>-behaviour(gen_server).</div><div> </div><div>-define(SERVER, ?MODULE).</div><div> </div><div>-export([ </div>
<div><span class="" style="white-space:pre"> </span>init/1,</div><div><span class="" style="white-space:pre"> </span>handle_call/3,</div><div><span class="" style="white-space:pre"> </span>start_link/0, </div><div><span class="" style="white-space:pre"> </span>handle_info/2 ,</div>
<div> .....</div><div>]).</div><div><br></div><div>start_profiling() -></div><div><span class="" style="white-space:pre"> </span>percept2:profile("data.dat", {test_percept_1,start_link, []},[all]).</div>
<div><span class="" style="white-space:pre"> </span></div><div>stop_profiling() -></div><div><span class="" style="white-space:pre"> </span>percept2:stop().</div><div><span class="" style="white-space:pre"> </span></div>
<div>start_link() -></div><div><span class="" style="white-space:pre"> </span>case gen_server:start_link({local, ?SERVER}, ?SERVER, [], []) of </div><div><span class="" style="white-space:pre"> </span>{ok, Pid} -></div>
<div><span class="" style="white-space:pre"> </span>io:format("Gen_server started: ~p on node: ~p. ~n",[Pid,node()]),</div><div><span class="" style="white-space:pre"> </span>{ok,Pid};</div><div><span class="" style="white-space:pre"> </span>Other -></div>
<div><span class="" style="white-space:pre"> </span>io:format("Error starting ~p: ~p. ~n",[?SERVER,Other]),</div><div><span class="" style="white-space:pre"> </span>{error, Other}</div><div> end.</div><div>
<span class="" style="white-space:pre"> </span></div><div>init([]) -> {ok,[]}.</div><div><br></div><div>.... </div><div><br></div><div>handle_call({test},_From,State)-></div><div><span class="" style="white-space:pre"> </span>{reply,"This is a test string",State}.</div>
<div><span class="" style="white-space:pre"><br></span></div><div><span class="" style="white-space:pre">.....</span></div><div><span class="" style="white-space:pre"> </span></div><div>handle_info(_, State) -></div><div>
<span class="" style="white-space:pre"> </span>{noreply,state}.</div></div><div><br></div><div>.....</div><div><br></div><div><br></div><div><br></div>-- <br>Best Regards,<div>Tyron Zerafa</div>
</div></div>