get_profile_results/4 development

Synopsis

get_profile_results(+By, +Num,-Results,-Total)

Returns the results of the last profiled execution.

Arguments


By atom
must be one of the atoms:
  1. by_time
  2. by_choice_points
  3. by_calls
  4. by_redos

Num integer
specifies the maximum length of the Results list
Results list of term
the results list
Total integer

Description

Returns profiling information accumulated from the last call to profile/1. The By argument specifies the display mode, which determines how the list is sorted and what the Total argument returns. The Num argument determines the maximum length of the Results list. This list is always sorted in descending order so that the top Num predicates are included in the list.

Results is a list of terms of the form proc(Name,Ncalls,Nchpts,Nredos,Time,Callers) where Name,Ncalls,Nchpts,Nredos,Time give call, choice point, redo counts and the execution time spent in milliseconds, and Callers is a list of calledby(Time,Calls,Name,ClauseNo,CallNo) terms, where Time in this case is the percentage of time attributed to this caller, Calls is the number of calls made from this caller and Name, ClauseNo, CallNo locate precisely the actual caller.

If the display mode is by_time then Total is the total execution time in milliseconds. If the display mode is by_calls, by_choice_points or by_redos then Total returns the total number of calls, choice points or redos respectively.

This predicate is not supported in runtime systems.

Example

     | ?- get_profile_results(by_time,3,List,Total).
     
     List = [proc(user:setof/3,227,0,0,1980,
                  [calledby(61,152,user:satisfy/1,6,1),
                   calledby(20,27,user:satisfy/1,7,1),
                   calledby(18,48,user:seto/3,1,1)]),
             proc(user:satisfy/1,35738,36782,14112,260,
                  [calledby(69,13857,user:satisfy/1,1,2),
                   calledby(15,12137,user:satisfy/1,2,1)]),
             proc(user:write/1,2814,0,0,240,
                  [calledby(33,481,user:reply/1,3,1),
                   calledby(25,608,user:replies/1,3,1),
                   calledby(16,562,user:out/1,2,1),
                   calledby(8,203,user:reply/1,2,5),
                   calledby(8,34,user:replies/1,2,3)])],
     Total = 6040
     
     [profile]
     

See Also

profile/[0,1,2,3], show_profile_results/[0,1,2]