curry.interpreter.stats module
Implements Interpreter.stats, the statistics of a run.
- class curry.interpreter.stats.Stats[source]
Bases:
dictThe statistics of a run, keyed by
KEYSin that order, followed bySCHEDULER_KEYSwhen the runtime has the scheduler counters.strgives one line of key=value pairs, the linesprite-exec --statsprints.
- 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
exactfor the values belowlen(exact), and incoarse[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.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.countersis the dict the runtime reports (summed over the evaluations), or None, which gives every field as zero.serial_stepsSteps taken while the outermost queue held one configuration. The serial fraction is this over
steps.nested_stepsSteps taken inside a set function, in a nested queue.
shared_stepsSteps whose redex another configuration created. The shared-work ratio is this over
steps.queue_maxThe largest number of configurations in the outermost queue.
configurationsThe 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_stepsThe configurations of the outermost queue that failed, and the steps they took.
lifetime_median,lifetime_mean,lifetime_maxThe 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_maxThe 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:
wallSeconds 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.
cpuUser plus system CPU seconds of this process. Child processes, such as the Curry front end and the C++ compiler, are not included.
stepsThe rewrite steps taken by the evaluations of this interpreter, a running evaluation included. A soft reset keeps the count.
forksThe number of times a configuration forked at a choice in those evaluations.
collectionsThe collections run in this process by the node collector of the C++ backend. The Python backend reports zero.
peak_rssThe peak resident set size of this process, in bytes.
compileSeconds 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_secondsSeconds the node collector of the C++ backend spent in its collections. The Python backend reports zero.
swappedThe functions that tiered execution of the C++ backend swapped from the interpreter to compiled code in this process (the interpreter flag
interpretset to ‘tiered’). The Python backend reports zero.failed_compilesThe 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_secondsSeconds 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_youngThe nodes the collections marked: all, those marked in the collection before as well (old), and those allocated since (young).
gc_configurations_pushedThe configurations whose roots the collections pushed.
gc_queues_destroyed,gc_configurations_destroyedThe 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_blocksThe 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; seescheduler_fields().- Return type:
A
Statsobject, a dict with these keys, in this order