- aggregate_result(+File)
- Write the aggregated instrument profiling results to a named file.
- close_delta_file
- Close the instrumentation profiler's delta results file.
- open_delta_file(+DeltaFile)
- Open the instrumentation profiler's delta results file.
- reset
- Reset the profiling statistics for the calling context module.
- result
- Pretty-print the instrument profiled source with aggregated results.
- statprofile(+File, +Statistics)
- Instrument a file with statistics profiling code.
- statprofile(+File, +Statistics, +OptionsList)
- Instrument a file with statistics profiling code.
- statsample(+ProfileName, +SamplePeriod, +Statistics, +File)
- Create a statistics sampling profile.
- statsample_control(+ProfileName, +State)
- Enable / disable the sampling profiler for a named profile.
The instprofile library provides two complimentary mechanisms for the profiling of ECLiPSe code with the metrics provided by the statistics/2 predicate:
While the performance overhead of the sampling profiler is lower, it cannot be used to determine the exact cost of a piece of code for a particular statistic. It merely provides snapshots with respect to time not code location. The instrumentation based profiler does however provide the means for the measurement of both the aggregated cost for all executions of a piece of code and also the cost for each individual execution.
The usage of the instrumentation based profiler is as follows:
?- lib(instprofile).
?- instprofile:statprofile(my_program, [global_stack_used, trail_stack_used]).
?- my_query(X,Y,Z).
?- instprofile:result@my_program_module.
?- lib(instprofile).
?- instprofile:statsample(memory, 5, [global_stack_used, trail_stack_used], 'memory_sample.dat').
?- instprofile:statsample_control(memory, on)
?- my_query(X,Y,Z).
?- instprofile:statsample_control(memory, off)
Limitations to be resolved shortly:
Results are currently produced per module, not for individual files within a module (i.e. results must be retrieved for all files within a module).
When multiple statistics are specified, the order in which the statistics will appear in the results (pretty-printed source and results file) is displayed during the invocation of the statsample predicate, not the result predicate.
Results are produced to a file or annotated on pretty-printed source and these results to be viewed offline. Additional facilities are to be provided that allow for the real time visualisation of results.
The model that accounts for the cost of inserted instrumentation is fairly rudimentary (especially for the 'global_stack_used' statistic.