jepsen.checker.perf

Supporting functions for performance analysis.

broaden-range

(broaden-range [a b])

Given a lower upper range for a plot, returns lower’ upper’, which covers the original range, but slightly expanded, to fall nicely on integral boundaries.

bucket-points

(bucket-points dt points)

Takes a time window dt and a sequence of time, _ points, and emits a seq of time, points-in-window buckets, ordered by time. Time is at the midpoint of the window.

bucket-scale

(bucket-scale dt b)

Given a bucket size dt, and a bucket number (e.g. 0, 1, …), returns the time at the midpoint of that bucket.

bucket-time

(bucket-time dt t)

Given a bucket size dt and a time t, computes the time at the midpoint of the bucket this time falls into.

buckets

(buckets dt)(buckets dt tmax)

Given a bucket size dt, emits a lazy sequence of times at the midpoints of each bucket.

completions-by-f-type

(completions-by-f-type history)

Takes a history and returns a map of f -> type-> ops, for all completions in history.

default-nemesis-color

first-time

(first-time history)

Takes a history and returns the first :time in it, in seconds, as a double.

fs->points

(fs->points fs)

Given a sequence of :f’s, yields a map of f -> gnuplot-point-type, so we can render each function in a different style.

has-data?

(has-data? plot)

Takes a plot and returns true iff it has at least one series with data points.

interval->times

(interval->times [a b])

Given an interval of two operations a b, returns the times time-a time-b covering the interval. If b is missing, yields time-a nil.

invokes-by-f

(invokes-by-f)(invokes-by-f history)

Takes a history and returns a map of f -> ops, for all invocations. Either a tesswer fold, or runs on a history.

invokes-by-f-type

(invokes-by-f-type)(invokes-by-f-type history)

A fold which returns a map of f -> type -> ops, for all invocations.

invokes-by-type

(invokes-by-type)(invokes-by-type history)

Splits up a sequence of invocations into ok, failed, and crashed ops by looking at their corresponding completions. Either a tesser fold, or runs on a history.

latencies->quantiles

(latencies->quantiles dt qs points)

Takes a time window in seconds, a sequence of quantiles from 0 to 1, and a sequence of time, latency pairs. Groups pairs by their time window and emits a emits a map of quantiles to sequences of time, latency-at-that-quantile pairs, one per time window.

latency-point

(latency-point op)

Given an operation, returns a time, latency pair: times in seconds, latencies in ms.

latency-preamble

(latency-preamble test output-path)

Gnuplot commands for setting up a latency plot.

legend-part

(legend-part series)

Takes a series map and returns the list of gnuplot commands to render that series.

nemesis-activity

(nemesis-activity nemeses history)

Given a nemesis specification and a history, partitions the set of nemesis operations in the history into different nemeses, as per the spec. Returns the spec, restricted to just those non-hidden nemeses taking part in this history, and with each spec augmented with two keys:

:ops All operations the nemeses performed :intervals A set of start end paired ops.

nemesis-alpha

nemesis-lines

(nemesis-lines plot nemeses)

Given nemesis activity, emits a sequence of gnuplot commands rendering vertical lines where nemesis events occurred.

nemesis-ops

(nemesis-ops nemeses history)

Given a history and a nemeses specification, partitions the set of nemesis operations in the history into different nemeses, as per the spec. Returns the nemesis spec, restricted to just those nemeses taking part in this history, and with each spec augmented with an :ops key, which contains all operations that nemesis performed. Skips :hidden? nemeses.

nemesis-regions

(nemesis-regions plot nemeses)

Given nemesis activity, emits a sequence of gnuplot commands rendering shaded regions where each nemesis was active. We can render a maximum of 12 nemeses; this keeps size and spacing consistent.

nemesis-series

(nemesis-series plot nemeses)

Given nemesis activity, constructs the series required to show every present nemesis’ activity in the legend. We do this by constructing dummy data, and a key that will match the way that nemesis’s activity is rendered.

plot!

(plot! opts)

Renders a gnuplot plot. Takes an option map:

:preamble Gnuplot commands to send first :series A vector of series maps :draw-fewer-on-top? If passed, renders series with fewer points on top :xrange A pair xmin xmax which controls the xrange :yrange Ditto, for the y axis :logscale e.g. :y

A series map is a map with:

:data A sequence of data points to render, e,g. [0 0 1 2 2 4] :with How to draw this series, e.g. ’points :linetype What kind of line to use :pointtype What kind of point to use :title A string, or nil, to label this series map

point-graph!

(point-graph! test history {:keys [subdirectory nemeses], :as opts})

Writes a plot of raw latency data points.

preamble

(preamble output-path)

Shared gnuplot preamble

qs->colors

(qs->colors qs)

Given a sequence of quantiles q, yields a map of q -> gnuplot-color, so we can render each latency curve in a different color.

quantiles

(quantiles qs points)

Takes a sequence of quantiles from 0 to 1 and a sequence of values, and returns a map of quantiles to values at those quantiles.

quantiles-graph!

(quantiles-graph! test history {:keys [subdirectory nemeses]})

Writes a plot of latency quantiles, by f, over time.

rate

(rate history)

Map breaking down the mean rate of completions by f and type, plus totals at each level.

rate-graph!

(rate-graph! test history {:keys [subdirectory nemeses]})

Writes a plot of operation rate by their completion times.

rate-preamble

(rate-preamble test output-path)

Gnuplot commands for setting up a rate plot.

type->color

Takes a type of operation (e.g. :ok) and returns a gnuplot color.

types

What types are we rendering?

with-nemeses

(with-nemeses plot history nemeses)

Augments a plot map to render nemesis activity. Takes a nemesis specification: a collection of nemesis spec maps, each of which has keys:

:name A string uniquely naming this nemesis :color What color to use for drawing this nemesis (e.g. “#abcd01”) :start A set of :f’s which begin this nemesis’ activity :stop A set of :f’s which end this nemesis’ activity :fs A set of :f’s otherwise related to this nemesis :hidden? Skips rendering this nemesis.

with-range

(with-range plot)

Takes a plot object. Where xrange or yrange are not provided, fills them in by iterating over each series :data.

without-empty-series

(without-empty-series plot)

Takes a plot, and strips out empty series objects.