From 100b825383319c9bc5ff57707348d39ad72279a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Fri, 4 Jun 2010 12:23:57 +0200 Subject: Update eprof documentation The eprof documentation is updated to reflect the new eprof application and some API changes and convenience functions. --- lib/tools/doc/src/eprof.xml | 49 ++++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 18 deletions(-) (limited to 'lib') diff --git a/lib/tools/doc/src/eprof.xml b/lib/tools/doc/src/eprof.xml index ae1033f2d0..8839b2e69e 100644 --- a/lib/tools/doc/src/eprof.xml +++ b/lib/tools/doc/src/eprof.xml @@ -35,8 +35,7 @@ used. The profiling is done using the Erlang trace BIFs. Tracing of local function calls for a specified set of processes is enabled when profiling is begun, and disabled when profiling is stopped.

-

When using Eprof, expect a significant slowdown in program execution, - in most cases at least 100 percent.

+

When using Eprof expect a slowdown in program execution.

@@ -47,15 +46,19 @@ Reason = {already_started,Pid} -

Starts the Eprof server which owns the Eprof internal database.

+

Starts the Eprof server which holds the internal state of the collected data.

- start_profiling(Rootset) -> profiling | error - profile(Rootset) -> profiling | error + start_profiling(Rootset) -> profiling | {error, Reason} + start_profiling(Rootset,Pattern) -> profiling | {error, Reason} Start profiling. Rootset = [atom() | pid()] + Pattern = {Module, Function, Arity} + Module = Function = atom() + Arity = integer() + Reason = term()

Starts profiling for the processes in Rootset (and any new @@ -64,6 +67,9 @@

Rootset is a list of pids and registered names.

The function returns profiling if tracing could be enabled for all processes in Rootset, or error otherwise.

+

A pattern can be selected to narrow the profiling. For instance ca a specific + module be selected and only the code processes executes in that module will be + profiled.

@@ -75,14 +81,20 @@ - profile(Rootset,Fun) -> {ok,Value} | {error,Reason} | error - profile(Rootset,Module,Function,Args) -> {ok,Value} | {error,Reason} | error + profile(Fun) -> profiling | {error, Reason} + profile(Rootset) -> profiling | {error, Reason} + profile(Rootset,Fun) -> {ok, Value} | {error,Reason} + profile(Rootset,Fun,Pattern) -> {ok, Value} | {error, Reason} + profile(Rootset,Module,Function,Args) -> {ok, Value} | {error, Reason} + profile(Rootset,Module,Function,Args,Pattern) -> {ok, Value} | {error, Reason} Start profiling. Rootset = [atom() | pid()] Fun = fun() -> term() + Pattern = {Module, Function, Arity} Module = Function = atom() Args = [term()] + Arity = integer() Value = Reason = term() @@ -96,7 +108,7 @@ Rootset, the function returns {ok,Value} when Fun()/apply returns with the value Value, or {error,Reason} if Fun()/apply fails with - exit reason Reason. Otherwise it returns error + exit reason Reason. Otherwise it returns {error, Reason} immediately.

The programmer must ensure that the function given as argument is truly synchronous and that no work continues after @@ -104,7 +116,15 @@ - analyse() + analyze() -> ok + analyze(Type) -> ok + analyze(Type,Options) -> ok + + Type = procs | total + Options = [{filter, Filter} | {sort, Sort} + Filter = [{calls, integer()} | {time, float()}] + Sort = time | calls | mfa + Display profiling results per process.

Call this function when profiling has been stopped to display @@ -113,17 +133,10 @@ how much time has been used by each process, and in which function calls this time has been spent. -

Time is shown as percentage of total time, not as absolute time.

-
-
- - total_analyse() - Display profiling results per function call. - -

Call this function when profiling has been stopped to display +

Call analyze with total option when profiling has been stopped to display the results per function call, that is in which function calls the time has been spent.

-

Time is shown as percentage of total time, not as absolute time.

+

Time is shown as percentage of total time and as absolute time.

-- cgit v1.2.3