Liking cljdoc? Tell your friends :D

criterium.viewer.common.core

Core utility functions for viewer data preparation.

This namespace provides foundational functions used across multiple viewer namespaces for formatting metrics, computing SI scaling, and preparing basic statistical data for display.

Core utility functions for viewer data preparation.

This namespace provides foundational functions used across multiple viewer
namespaces for formatting metrics, computing SI scaling, and preparing
basic statistical data for display.
raw docstring

ascii-barclj

(ascii-bar value max-value width)

Generate a bar of █ characters proportional to value/max-value. Returns a string of at most width characters.

Generate a bar of █ characters proportional to value/max-value.
Returns a string of at most `width` characters.
sourceraw docstring

ascii-bar-bidirectionalclj

(ascii-bar-bidirectional value max-abs-value half-width)

Generate a bidirectional bar centered on a vertical line. Negative values extend left, positive values extend right. Returns a string of exactly (2 * half-width + 1) characters.

Example outputs for half-width=10: value 0.5 -> ' |█████ ' value -0.3 -> ' ███| ' value 0.0 -> ' | '

Generate a bidirectional bar centered on a vertical line.
Negative values extend left, positive values extend right.
Returns a string of exactly (2 * half-width + 1) characters.

Example outputs for half-width=10:
  value  0.5 -> '          |█████     '
  value -0.3 -> '       ███|          '
  value  0.0 -> '          |          '
sourceraw docstring

collect-plan-dataclj

(collect-plan-data bench-map)
source

column-data->mapsclj

(column-data->maps column-data column-keys column-tforms)

Convert data where each column's values are stored in vectors.

Convert data where each column's values are stored in vectors.
sourceraw docstring

composite-keyclj

(composite-key path)
source

compute-si-scalingclj

(compute-si-scaling metric-path values)

Compute SI scaling factors for a metric-path given sample values. Returns {:base-scale, :si-scale, :total-scale, :unit}.

  • base-scale: converts raw values to base units (e.g., ns -> s)
  • si-scale: SI prefix scaling factor
  • total-scale: base-scale * si-scale
  • unit: SI unit string (e.g., "ms", "μs")
Compute SI scaling factors for a metric-path given sample values.
Returns {:base-scale, :si-scale, :total-scale, :unit}.
- base-scale: converts raw values to base units (e.g., ns -> s)
- si-scale: SI prefix scaling factor
- total-scale: base-scale * si-scale
- unit: SI unit string (e.g., "ms", "μs")
sourceraw docstring

coord-column-headerclj

(coord-column-header single-key-info)

Return the appropriate column header for coordinates.

Return the appropriate column header for coordinates.
sourceraw docstring

detect-uniform-axesclj

(detect-uniform-axes coords)

Find coordinate axes where all values are identical. Returns a set of keys that have uniform values across all coords.

Find coordinate axes where all values are identical.
Returns a set of keys that have uniform values across all coords.
sourceraw docstring

error-bound-value?clj

(error-bound-value? v)

Returns true if v is an error-bound value map {:value X :error E}.

Returns true if v is an error-bound value map {:value X :error E}.
sourceraw docstring

event-statsclj

(event-stats metrics-defs ev-stats)
source

event-stats-metricsclj

(event-stats-metrics event-stats _k metric ms)
source

extremes-mapclj

(extremes-map stats metric-configs transforms)

Prepare min/max extremes for display in tabular format. Returns a vector of maps with :metric, :min, and :max keys.

Prepare min/max extremes for display in tabular format.
Returns a vector of maps with :metric, :min, and :max keys.
sourceraw docstring

format-coordclj

(format-coord coord)

Format a coordinate for display.

Format a coordinate for display.
sourceraw docstring

format-row-key-valueclj

(format-row-key-value row-key single-key-info)

Format a row-key for display, extracting the value for single-key maps.

Format a row-key for display, extracting the value for single-key maps.
sourceraw docstring

format-value-with-unitclj

(format-value-with-unit value metric-path)

Format a value from domain-extract as a string with SI units.

Format a value from domain-extract as a string with SI units.
sourceraw docstring

get-numeric-valueclj

(get-numeric-value v)

Extract numeric value from plain value or error-bound format {:value v}.

Extract numeric value from plain value or error-bound format {:value v}.
sourceraw docstring

has-box-plot-data?clj

(has-box-plot-data? v)

Check if a value map contains all required box plot fields. Box plot data requires :median, :p10, and :p90 keys.

Check if a value map contains all required box plot fields.
Box plot data requires :median, :p10, and :p90 keys.
sourceraw docstring

histogramclj

(histogram histogram transforms metric-config)
source

metric-path->base-scaleclj

(metric-path->base-scale metric-path)

Return base scale factor to convert raw metric values to base units. Elapsed-time is stored in nanoseconds, so convert to seconds for scaling.

Return base scale factor to convert raw metric values to base units.
Elapsed-time is stored in nanoseconds, so convert to seconds for scaling.
sourceraw docstring

metric-path->dimensionclj

(metric-path->dimension metric-path)

Return the dimension keyword for a metric-path. Used to determine appropriate scaling via format/scale.

Return the dimension keyword for a metric-path.
Used to determine appropriate scaling via format/scale.
sourceraw docstring

metrics-mapclj

(metrics-map sample metrics)
source

outlier-countsclj

(outlier-counts metrics outliers)
source

quantilesclj

(quantiles metric-configs all-quantiles transforms)
source

simple-transformsclj

(simple-transforms data-map)

Extract transforms from a data map, normalizing to vector format.

Many viewer data maps contain a :transform key with :sample-> and :->sample functions. These may be single functions or vectors of functions. This helper normalizes both formats to vectors for use with criterium.util.helpers/transform-sample->.

Returns map {:sample-> [fns...] :->sample [fns...]} or nil if no transform.

Extract transforms from a data map, normalizing to vector format.

Many viewer data maps contain a :transform key with :sample-> and :->sample
functions. These may be single functions or vectors of functions.
This helper normalizes both formats to vectors for use with
criterium.util.helpers/transform-sample->.

Returns map {:sample-> [fns...] :->sample [fns...]} or nil if no transform.
sourceraw docstring

single-key-coord-infoclj

(single-key-coord-info row-keys)

Detect if all row-keys are single-key maps with the same key. Returns {:key k :values [v1 v2 ...]} if so, nil otherwise.

Detect if all row-keys are single-key maps with the same key.
Returns {:key k :values [v1 v2 ...]} if so, nil otherwise.
sourceraw docstring

sort-row-keysclj

(sort-row-keys row-keys single-key-info)

Sort row-keys, using numeric sort when all values are numbers.

Sort row-keys, using numeric sort when all values are numbers.
sourceraw docstring

stats-mapclj

(stats-map stats metric-configs transforms)
source

strip-uniform-axesclj

(strip-uniform-axes coords)

Strip uniform-value axes from coordinates. Only strips axes if doing so leaves at least one key in each coord. Returns coords unchanged if any coord is not a map.

Strip uniform-value axes from coordinates.
Only strips axes if doing so leaves at least one key in each coord.
Returns coords unchanged if any coord is not a map.
sourceraw docstring

tail-high-quantiles-tableclj

(tail-high-quantiles-table tail-data transforms)

Prepare high quantiles table data for display.

Returns a vector of row maps with quantile label and estimated value (SI units). Takes tail-data map for a single metric and optional transforms.

Prepare high quantiles table data for display.

Returns a vector of row maps with quantile label and estimated
value (SI units).  Takes tail-data map for a single metric and
optional transforms.
sourceraw docstring

tail-ratios-table-dataclj

(tail-ratios-table-data tail-data)

Prepare tail ratios table data for display.

Returns a vector of row maps with ratio name, value, and constituent percentiles. Takes tail-data map for a single metric.

Prepare tail ratios table data for display.

Returns a vector of row maps with ratio name, value, and constituent
percentiles.  Takes tail-data map for a single metric.
sourceraw docstring

tail-summary-tableclj

(tail-summary-table tail-data transforms)

Prepare summary table data for tail analysis.

Returns a vector of row maps with:

  • Threshold value (with SI units)
  • Exceedances count (k)
  • GPD shape (ξ) and scale (σ)
  • Hill stable estimate with k-range

Takes tail-data map for a single metric and optional transforms.

Prepare summary table data for tail analysis.

Returns a vector of row maps with:
- Threshold value (with SI units)
- Exceedances count (k)
- GPD shape (ξ) and scale (σ)
- Hill stable estimate with k-range

Takes tail-data map for a single metric and optional transforms.
sourceraw docstring

values-have-error-bounds?clj

(values-have-error-bounds? coll)

Returns true if any value in coll has error bounds. Checks for :lower/:upper keys (from with-error-bounds option) or :ci-lower/:ci-upper keys (from bootstrap stats).

Returns true if any value in coll has error bounds.
Checks for :lower/:upper keys (from with-error-bounds option) or
:ci-lower/:ci-upper keys (from bootstrap stats).
sourceraw docstring

warn-missing-bootstrap-statsclj

(warn-missing-bootstrap-stats metric-id)

Print warning to stdout when bootstrap stats are missing for a metric.

Print warning to stdout when bootstrap stats are missing for a metric.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close