[ library(instprofile) | Reference Manual | Alphabetic Index ]

# statsample(+ProfileName, +SamplePeriod, +Statistics, +File)

Create a statistics sampling profile.

ProfileName
  Atom or string
SamplePeriod
  Number
Statistics
  List of statistic keywords
File
  Atom or string

## Description

The predicate defines a profile, ProfileName, for use by the sampling profiler. Samples of the statistics (statistics/2 metric keywords) specified in Statistics are collected every SamplePeriod seconds and stored in File. The format of file is such that it can easily be analysed or graphed offline.

The sample based profiler is implemented using after events and is therefore less intrusive in its effect on the performance of the executing code than the instrumentation profiler. However, it is used to indicate the trend of resource usage over time of a running program not to attribute specific costs of a statistic to a specific piece of code. The instrumentation based profiler is used to do this.

### Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

### Fail Conditions

Statistics is empty or contains an invalid statistic/2 keyword.

### Resatisfiable

no

### Exceptions

(5) type error
  File is not an atom or string

## Examples

       [eclipse 1]: instprofile:statsample(memory, 5, [global_stack_used,
                                           trail_stack_used], 'memory_sample.dat').
       string     compiled traceable 476 bytes in 0.00 seconds

       Yes (0.01s cpu)

## See Also

statsample_control / 2, statistics / 2, library(instprofile)