Liking cljdoc? Tell your friends :D

criterium.metric

Functions for working with metric configurations and definitions.

A metric represents a measurable value that can be collected during benchmarking. Each metric is described by a configuration map with the following structure:

{:type keyword ; The type of metric (e.g., :timing, :memory) :name string ; Human readable name of the metric :values [...] ; Collection of metric value configurations}

Metrics can be organized in groups using a metrics configuration map: {:group-name {:values [...]} ; Direct metric values :other-group {:groups {:subgroup {:values [...]}}} ; Nested metric groups}

This namespace provides functions for querying and filtering metric configurations. It supports both flat and hierarchical metric organization structures.

Functions for working with metric configurations and definitions.

A metric represents a measurable value that can be collected during
benchmarking.  Each metric is described by a configuration map with
the following structure:

{:type    keyword    ; The type of metric (e.g., :timing, :memory)
 :name    string     ; Human readable name of the metric
 :values  [...]      ; Collection of metric value configurations}

Metrics can be organized in groups using a metrics configuration map:
{:group-name {:values [...]}                    ; Direct metric values
 :other-group {:groups {:subgroup {:values [...]}}} ; Nested metric groups}

This namespace provides functions for querying and filtering metric
configurations.  It supports both flat and hierarchical metric
organization structures.
raw docstring

all-metric-configsclj

(all-metric-configs metric-defs)

Return all metric configurations from both flat and nested structures.

Similar to metric-configs but also handles nested metric groups. Processes both direct :values entries and nested :groups configurations recursively.

Example input: {:timing {:values [{:type :timing, :name "basic-timing"}]} :memory {:groups {:heap {:values [{:type :memory, :name "heap-used"}]} :non-heap {:values [{:type :memory, :name "metaspace"}]}}}}

Return flat sequence of all metric configurations regardless of nesting.

Return all metric configurations from both flat and nested structures.

Similar to metric-configs but also handles nested metric
groups. Processes both direct :values entries and nested :groups
configurations recursively.

Example input:
{:timing {:values [{:type :timing, :name "basic-timing"}]}
:memory  {:groups
{:heap    {:values [{:type :memory, :name "heap-used"}]}
:non-heap {:values [{:type :memory, :name "metaspace"}]}}}}

Return flat sequence of all metric configurations regardless of
nesting.
sourceraw docstring

dimension-predclj

(dimension-pred dim)

Create predicate that matches metric values with given dimension

Create predicate that matches metric values with given dimension
sourceraw docstring

elapsed-timeclj

(elapsed-time sample)

Return the elapsed time in nanoseconds from a sample map.

Parameters: sample - A map containing benchmark sample data with :elapsed-time key

Return: long - The elapsed time in nanoseconds

Note: This function assumes the sample contains an :elapsed-time value measured in nanoseconds.

Return the elapsed time in nanoseconds from a sample map.

Parameters:
  sample - A map containing benchmark sample data with :elapsed-time key

Return:
  long - The elapsed time in nanoseconds

Note: This function assumes the sample contains an :elapsed-time value
measured in nanoseconds.
sourceraw docstring

filter-metric-valuesclj

(filter-metric-values pred values)

Filter a sequence of metric value maps using predicate

Filter a sequence of metric value maps using predicate
sourceraw docstring

filter-metricsclj

(filter-metrics metrics pred)
source

filter-metrics*clj

(filter-metrics* pred metrics)

Filter metrics tree keeping values matching predicate. Preserves structure while only keeping values that match the predicate. When filtering groups, removes empty groups after filtering.

Filter metrics tree keeping values matching predicate.
Preserves structure while only keeping values that match the predicate.
When filtering groups, removes empty groups after filtering.
sourceraw docstring

metric-config?clj

(metric-config? x)
source

metric-configsclj

(metric-configs metric-defs)

Returns a sequence of metric-config maps from a metrics configuration map.

Takes a map of metric groups where each group contains a :values key with a sequence of metric configurations. Flattens all metric configs into a single sequence.

Example input: {:timing {:values [{:type :timing, :name "execution-time"}]} :memory {:values [{:type :memory, :name "heap-usage"}]}}

Returns: [{:type :timing, :name "execution-time"} {:type :memory, :name "heap-usage"}]

Returns a sequence of metric-config maps from a metrics configuration map.

Takes a map of metric groups where each group contains a :values key
with a sequence of metric configurations. Flattens all metric configs
into a single sequence.

Example input:
{:timing {:values [{:type :timing, :name "execution-time"}]}
 :memory {:values [{:type :memory, :name "heap-usage"}]}}

Returns:
 [{:type :timing, :name "execution-time"}
  {:type :memory, :name "heap-usage"}]
sourceraw docstring

metric-configs-of-typeclj

(metric-configs-of-type metrics-defs metric-type metric-ids)

Return a sequence of metric configurations filtered by type and optional IDs.

Similar to metrics-of-type but returns a flat sequence of configurations instead of a map. Useful when you need to process all matching configurations sequentially.

Parameters: metrics-defs - Map of metric configurations metric-type - Keyword identifying the type of metrics to select metric-ids - Optional sequence of metric IDs to filter by

Example: (metric-configs-of-type config :memory nil) ; Returns sequence of all memory metric configurations

Return a sequence of metric configurations filtered by type and optional IDs.

Similar to metrics-of-type but returns a flat sequence of
configurations instead of a map. Useful when you need to process all
matching configurations sequentially.

Parameters:
  metrics-defs - Map of metric configurations
  metric-type     - Keyword identifying the type of metrics to select
  metric-ids      - Optional sequence of metric IDs to filter by

Example:
  (metric-configs-of-type config :memory nil)
  ; Returns sequence of all memory metric configurations
sourceraw docstring

metrics-of-typeclj

(metrics-of-type metrics-config metric-type metric-ids)

Returns a map of metric configurations filtered by type and optional IDs.

Given a metrics configuration map, returns configurations matching the specified metric-type. If metric-ids is provided, only returns metrics with matching IDs.

Parameters: metrics-config - Map of metric configurations

metric-type - Keyword identifying the type of metrics to select (e.g., :timing)

metric-ids - Optional sequence of metric IDs to filter by. If nil, returns all metrics of the specified type.

Example: (metrics-of-type config :timing [:exec-time :wait-time])

Return only :timing metrics with the specified IDs.

Returns a map of metric configurations filtered by type and optional IDs.

Given a metrics configuration map, returns configurations matching the
specified metric-type. If metric-ids is provided, only returns metrics
with matching IDs.

Parameters:
metrics-config - Map of metric configurations

metric-type    - Keyword identifying the type of metrics to
                 select (e.g., :timing)

metric-ids     - Optional sequence of metric IDs to filter by. If nil,
                 returns all metrics of the specified type.

Example:
(metrics-of-type config :timing [:exec-time :wait-time])

Return only :timing metrics with the specified IDs.
sourceraw docstring

select-metricsclj

(select-metrics metrics-defs metric-ids)
source

type-predclj

(type-pred typ)

Create predicate that matches metric values with given type

Create predicate that matches metric values with given type
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