Samples

object Samples

The sampled lines of Resources: each sample is the time it arrived (epoch milliseconds) and its values, and the measured phase a range of those times.

Functions

Link copied to clipboard
fun at(sample: Map<String, Double>): Long

A store sample's own time, its epoch column in milliseconds: its output may reach the reader late.

Link copied to clipboard
fun <T> atOrAfter(samples: List<Pair<Long, T>>, time: Long): Pair<Long, T>?

The first sample at or after time, else the last one before it.

Link copied to clipboard
fun <T> atOrBefore(samples: List<Pair<Long, T>>, time: Long): Pair<Long, T>?

The last sample at or before time, else the first one after it.

Link copied to clipboard
fun columns(line: String, names: List<String>, separator: Char): Map<String, Double>?

line split by separator into numbers named names, or null when it is not such a line.

Link copied to clipboard

/proc/diskstats as each disk's cumulative counters, <disk>:<counter>: writes completed, writeKb, writeMs (the time those writes took), flushes and flushMs (Linux 5.5 on: the cache flushes an fsync issues), and ioMs (the time the disk was busy). A disk's line counts its partitions' I/O, so partitions are left out, and so are loop and RAM devices.

Link copied to clipboard
fun perSecond(samples: List<Pair<Long, Map<String, Double>>>, window: LongRange, keys: List<String>): List<Map<String, Any>>

The per-second rate of each of keys between consecutive samples, from the last one at or before the window's start to the first at or after its end; t is the later sample's second in the window.

Link copied to clipboard
fun procStat(stat: String, clockTicks: Double, pageKb: Double): Map<String, Any>?

A /proc/<pid>/stat line as the process's CPU seconds (user and system, clockTicks a second) and resident memory (pageKb a page), or null when it is not one. The command name may hold spaces: the fields follow its ).

Link copied to clipboard
fun whole(value: Double): Number

value as a Long when it is whole, for counters.

Link copied to clipboard
fun within(samples: List<Pair<Long, String>>, window: LongRange): List<String>

The lines of samples that arrived inside window.