Skip to content

Instantly share code, notes, and snippets.

@rzezeski
Created April 2, 2012 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rzezeski/2287383 to your computer and use it in GitHub Desktop.
Save rzezeski/2287383 to your computer and use it in GitHub Desktop.
fprof PB search/mapred

Get conn

{ok, Pid} = riakc_pb_socket:start_link("127.0.0.1", 8081). 

Set variables

Bucket = <<"spam">>.
Query = <<"Scott">>.
Phases = [ {reduce,{modfun, riak_kv_mapreduce, reduce_identity},[{reduce_phase_only_1, true}],true} ].

Get the pid of the PB Server.

ServerPid = element(2,hd(supervisor:which_children(riak_kv_pb_socket_sup))).

Jot down the value of Pid and ServerPid on a piece of paper. Invoke frpof and send results to pb.analysis

fprof:apply(riakc_pb_socket, mapred, [Pid, Input, Phases], [{procs, [Pid, ServerPid]}]).
fprof:profile().
fprof:analyse([{dest, "pb.analysis"}]).

Open pb.analysis with favorite editor. Refer to your Pid & ServerPid values to determine where time is being spent.

http://www.erlang.org/doc/man/fprof.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment