Customized Output

The predicate get_profile_results/4 returns the profiling information as a list of terms, to enable the customized display of profiling results. The first two arguments of get_profile_results/4 are the same as for show_profile_results/2, the third argument returns a list of proc/6 terms described below and the final argument returns a total that depends on the display mode given by the first argument -- for example, if the display mode is by_time then this is the total execution time.

The proc/6 term proc(Name,Ncalls,Nchpts,Nredos,Time,Callers) gives profiling information about one profiled predicate, where Name gives the module, name and arity of the predicate; Ncalls, Nchpts, Nredos, Time give call, choice point and redo counts and the execution time in milliseconds. The Callers argument is a list of calledby/5 terms of the form calledby(Time,Calls,Name,ClauseNo,CallNo) where Time is the percentage of time attributed to this caller, Calls is the number of calls made by this caller and Name, ClauseNo, CallNo identify the actual caller. For 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]
     | ?-