performance - ERLANG - Timing Applications -


i interested in benchmarking different parts of program speed. having tried using info(statistics) , erlang:now()

i need know down microsecond avg speed is. don't know why having trouble script wrote.

it should able start anywhere , end anywhere. ran problem when tried starting on process may running 4 times in parallel.

is there has solution issue?

edit:

willing give bounty if can provide script it. needs spawn though multiple process'. cannot accept function timer.. @ least in implementations have seen. traverses 1 process , major editing necessary full test of full program. hope made clear enough.

here's how use eprof, easiest solution you:

first need start it, applications out there:

23> eprof:start(). {ok,<0.95.0>} 

eprof supports 2 profiling mode. can call , ask profile function, can't use because other processes mess up. need manually start profiling , tell when stop (this why won't have easy script, way).

24> eprof:start_profiling([self()]). profiling 

this tells eprof profile run , spawned shell. new processes included here. run arbitrary multiprocessing function have, spawns 4 processes communicating each other few seconds:

25> trade_calls:main_ab(). spawned carl: <0.99.0> spawned jim: <0.101.0> <0.100.0> jim: asking user <0.99.0> trade carl: <0.101.0> asked trade negotiation carl: accepting negotiation jim: starting negotiation ... <snip> ... 

we can tell eprof stop profiling once function done running.

26> eprof:stop_profiling(). profiling_stopped 

and want logs. eprof print them screen default. can ask log file eprof:log(file). can tell analyze results. tell collapse run time processes single table option total (see manual more options):

27> eprof:analyze(total).            function                                  calls      %  time  [us / calls] --------                                  -----    ---  ----  [----------] io:o_request/3                               46   0.00     0  [      0.00] io:columns/0                                  2   0.00     0  [      0.00] io:columns/1                                  2   0.00     0  [      0.00] io:format/1                                   4   0.00     0  [      0.00] io:format/2                                  46   0.00     0  [      0.00] io:request/2                                 48   0.00     0  [      0.00] ... erlang:atom_to_list/1                         5   0.00     0  [      0.00] io:format/3                                  46  16.67  1000  [     21.74] erl_eval:bindings/1                           4  16.67  1000  [    250.00] dict:store_bkt_val/3                        400  16.67  1000  [      2.50] dict:store/3                                114  50.00  3000  [     26.32] 

and can see of time (50%) spent in dict:store/3. 16.67% taken in outputting result, 16.67% taken erl_eval (this why running short functions in shell -- parsing them becomes longer running them).

you can start going there. that's basics of profiling run times erlang. handle care, eprof can quite load on production system or functions run long. on production system.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -