On this page:
rival-profile
execution
*rival-profile-executions*
8.13.0.9

3 Profiling Rival🔗ℹ

Rival’s compiler and evaluator expose a variety of interesting profiling data, which can be accessed via the rival-profile function. Note that all of Rival’s profiling information is not guaranteed to be stable, backward-, or forward-compatible between versions. We do not recommend relying on rival-profile in your code without following Rival development closely.

procedure

(rival-profile machine command)  any/c

  machine : rival-machine?
  command : symbol?
The rival-profile function is called on a rival-machine? with a command symbol that decribes the kind of profiling information to return. Profiling commands may be added or removed freely across versions; do not rely on them.

The currently-supported command symbols and their return values are:

struct

(struct execution (name number precision time))

  name : symbol?
  number : natural?
  precision : natural?
  time : flonum?
Each execution corresponds to a single Rival interval operator being executed. The name names the operator, except the special symbol 'adjust, in which case it refers to an internal precision-tuning pass. The number gives its position in the compiled instruction sequence; this allows disambiguating if an expression contains, say, multiple addition operations. The precision is the bf-precision that the operator is executed at, and the time is the time, in milliseconds, that that execution took. Note that, because Rival executes the register machine multiple times, the same operator (with the same name and number) can appear multiple times for a single point. On the other hand, in some iterations Rival might skip some operators, if the precision is unchanged from previous iterations, so not every operator may show up in the executions list the same number of times.

parameter

(*rival-profile-executions*)  natural?

(*rival-profile-executions* executions)  void?
  executions : natural?
 = 1000
The executions are, for maximum performance, written into a single fixed-size vector allocated when rival-compile is called. To change the size of this struct, set the *rival-profile-executions* during compilation. Once the rival-compile returns, the profiling vector’s size cannot be changed.