eprof简例

-module(test_eprof).

-compile(export_all).

test_tc() ->
    timer:tc(?MODULE, test1, [99999999]).

test1(0) ->ok;
test1(N) ->
    test1(N-1).

test_eprof() ->
    eprof:start(),
    eprof:profile([self()], ?MODULE, test1, [999999]),
    eprof:stop_profiling(),
    eprof:log("test_eprof.txt"),
    eprof:analyze().
    
%% ****** Process <0.62.0>    -- 100.00 % of profiled time *** 
%% FUNCTION              CALLS       %    TIME  [uS / CALLS]
%% --------              -----     ---    ----  [----------]
%% erlang:apply/2            1    0.00       0  [      0.00]
%% test_eprof:test1/1  1000000  100.00  609000  [      0.61]

 

你可能感兴趣的:(lang/erlang)