package cascade

  1. Overview
  2. Docs
On This Page
  1. Recording
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Cascade.StatsSource

Optimizer profiling counters, scoped to one run.

A recorder is threaded through only the optimizer run that receives it, so an optimization started while another is in progress counts its own work. Readers take a snapshot: a value, not a view, so a later run cannot rewrite what an earlier one reported.

Sourcetype t

One run's recorder.

Sourceval v : ?profile:bool -> unit -> t

v () is a recorder for one optimizer run. profile (default false) turns on exact size accounting: the byte columns cost a full serialization of the rule list on either side of every fixpoint iteration, so they are collected only when asked for.

Sourceval profile : t -> bool

Whether exact size accounting is enabled for this run.

Sourcetype iteration_stat = {
  1. fixpoint : int;
  2. iteration : int;
  3. local_iteration : int;
  4. before_rules : int;
  5. after_rules : int;
  6. before_bytes : int;
  7. after_bytes : int;
  8. bytes_saved : int;
  9. active_passes : int;
  10. changed_passes : int;
  11. elapsed : float;
}

One global factoring fixpoint iteration.

Sourcetype counters = {
  1. iterations : int;
    (*

    factor_rules_to_fixpoint iterations

    *)
  2. factor_fixpoints_run : int;
    (*

    global factoring fixpoints attempted after the preflight

    *)
  3. factor_fixpoints_skipped : int;
    (*

    global factoring fixpoints skipped by the incremental preflight

    *)
  4. factor_preflight_gain : int;
    (*

    total raw-byte gain estimated by the global factoring preflight

    *)
  5. factor_bytes_saved : int;
    (*

    total committed byte savings reported by global factoring passes

    *)
  6. factor_transfer_reverts : int;
    (*

    factoring results discarded because the estimated DEFLATE size grew

    *)
}

Counters over one run.

Sourcetype snapshot = {
  1. counters : counters;
  2. iteration_stats : iteration_stat list;
    (*

    newest first

    *)
}

What a run recorded, as of the moment it was taken.

Sourceval snapshot : t -> snapshot

snapshot t is what t has recorded so far.

Recording

Called by the factoring passes; a caller holding a recorder can add to a run it does not own, which only skews that run's own report.

Sourceval start_fixpoint : t -> int

start_fixpoint t counts one factoring fixpoint and returns its number.

Sourceval skip_fixpoint : t -> unit

Count one fixpoint the preflight declined to run.

Sourceval revert_fixpoint : t -> unit

Count one factoring result the transfer gate threw away.

Sourceval add_preflight_gain : t -> int -> unit

Add the preflight's raw-byte gain estimate for one segment.

Sourceval record_iteration : t -> fixpoint:int -> local_iteration:int -> before_rules:int -> before_bytes:int -> after_rules:int -> after_bytes:int -> bytes_saved:int -> active_passes:int -> changed_passes:int -> elapsed:float -> unit

Record one factor-fixpoint iteration.

Sourceval add_saving : t -> int -> unit

Add committed factoring savings for the current iteration.

Sourceval reset_saving : t -> unit

Reset committed factoring savings for the current iteration.

Sourceval saving : t -> int

Committed factoring savings for the current iteration.