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.
(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.
(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 -> ' | '
(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.
(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}.
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")(coord-column-header single-key-info)Return the appropriate column header for coordinates.
Return the appropriate column header for coordinates.
(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.
(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}.
(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.
(format-coord coord)Format a coordinate for display.
Format a coordinate for display.
(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.
(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.
(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}.
(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.
(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.
(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.
(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.(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.(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.
(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.
(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.
(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.
(tail-summary-table tail-data transforms)Prepare summary table data for tail analysis.
Returns a vector of row maps with:
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.
(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).
(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.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |