curry.interpreter.stats module

Implements Interpreter.stats, the statistics of a run.

class curry.interpreter.stats.Stats[source]

Bases: dict

The statistics of a run, keyed by KEYS in that order, followed by SCHEDULER_KEYS when the runtime has the scheduler counters. str gives one line of key=value pairs, the line sprite-exec --stats prints.

curry.interpreter.stats.format_stats(stats)[source]

Formats statistics as one line of key=value pairs, in the order of the keys. Seconds and means have six decimals; counts and bytes are integers.

curry.interpreter.stats.histogram_median(histogram)[source]

The median of a step histogram of the scheduler counters: exact counts in exact for the values below len(exact), and in coarse[k] the count of the values in [2**k, 2**(k+1)). A median that falls in a coarse bucket is reported as the lower bound of the bucket. Zero when the histogram is empty. Of an even number of values, the lower middle one counts.

curry.interpreter.stats.peak_rss()[source]

The peak resident set size of this process, in bytes.

curry.interpreter.stats.scheduler_fields(counters)[source]

The fields derived from the scheduler counters of the C++ runtime, as a list of (key, value) in the order of SCHEDULER_KEYS. counters is the dict the runtime reports (summed over the evaluations), or None, which gives every field as zero.

serial_steps

Steps taken while the outermost queue held one configuration. The serial fraction is this over steps.

nested_steps

Steps taken inside a set function, in a nested queue.

shared_steps

Steps whose redex another configuration created. The shared-work ratio is this over steps.

queue_max

The largest number of configurations in the outermost queue.

configurations

The configurations of the outermost queue: the ones that ended by a value, a failure, or a fork, and the ones still in the queue.

failures, failed_steps

The configurations of the outermost queue that failed, and the steps they took.

lifetime_median, lifetime_mean, lifetime_max

The steps from the creation of a configuration of the outermost queue to its end by a value, a failure, or a fork. The median is exact below 1024 steps; above, it is the lower bound of a power-of-two bucket.

nested_configurations, nested_lifetime_median, nested_lifetime_mean, nested_lifetime_max

The same for the configurations of the queues of set functions, which end by a value, a failure, or a fork.

curry.interpreter.stats.stats(interp)[source]

Reports the statistics of the run.

Returns:

wall

Seconds since this process started (on Linux; elsewhere, since the Curry system was imported). The start time of a process has a resolution of one clock tick, 10 ms on most systems.

cpu

User plus system CPU seconds of this process. Child processes, such as the Curry front end and the C++ compiler, are not included.

steps

The rewrite steps taken by the evaluations of this interpreter, a running evaluation included. A soft reset keeps the count.

forks

The number of times a configuration forked at a choice in those evaluations.

collections

The collections run in this process by the node collector of the C++ backend. The Python backend reports zero.

peak_rss

The peak resident set size of this process, in bytes.

compile

Seconds this process spent in the steps of the toolchain: the Curry front end, the ICurry-JSON conversion, the code generator, and the C++ compiler. Zero when every file was current.

gc_seconds

Seconds the node collector of the C++ backend spent in its collections. The Python backend reports zero.

swapped

The functions that tiered execution of the C++ backend swapped from the interpreter to compiled code in this process (the interpreter flag interpret set to ‘tiered’). The Python backend reports zero.

failed_compiles

The background compiles of tiered execution that failed in this process; the modules stay interpreted. The Python backend reports zero.

gc_roots_seconds, gc_trace_seconds, gc_sweep_seconds, gc_registries_seconds

Seconds the collections of the node collector spent in each phase: the roots (the configurations of the queues and the nodes Python holds), the trace from the roots, the block sweep, and the registries (the free-variable tables, the generator nodes, the queues and the sets). The verifier of the stress mode is in none of them. The Python backend reports zero.

gc_marked, gc_marked_old, gc_marked_young

The nodes the collections marked: all, those marked in the collection before as well (old), and those allocated since (young).

gc_configurations_pushed

The configurations whose roots the collections pushed.

gc_queues_destroyed, gc_configurations_destroyed

The queues of set functions no root reached, destroyed by the collections, and the configurations destroyed with them.

gc_old_redexes, gc_old_slot_writes, gc_old_nodes_written, gc_old_blocks

The writes into old nodes between the collections: the writes of a step into an old redex, the other pointer writes into an old node, the distinct old nodes written, and the blocks with such a write, summed over the intervals. Only a runtime built with the write counters (make GC_WRITE_COUNTERS=1) counts them; the default build reports zero.

A C++ runtime built with the scheduler counters (make COUNTERS=1) adds the keys of SCHEDULER_KEYS; see scheduler_fields().

Return type:

A Stats object, a dict with these keys, in this order