meansd-cli

Crates.iomeansd-cli
lib.rsmeansd-cli
version1.4.0
sourcesrc
created_at2020-12-20 10:07:38.909545
updated_at2023-08-17 15:31:48.734838
descriptioncalculate mean and standard deviation (CLI)
homepagehttps://gitlab.com/umcdev/meansd
repositoryhttps://gitlab.com/umcdev/meansd
max_upload_size
id324815
size40,638
♫ Christian Krause ♫ (wookietreiber)

documentation

https://gitlab.com/umcdev/meansd

README

meansd

Calculates mean and standard deviation.

Usage

Simple execution mode:

$ seq 1 3 | meansd
n=3 ∅ 2 ± 1

Binning:

$ seq 2 7 | meansd --bin-width 5

From To Size Mean SD
   0  4    3    3  1
   5  9    3    6  1

n=6 ∅ 5 ± 2

For more command line options, see meansd --help.

Resource Requirements

This tool uses so-called online algorithms. This means that the input is not stored and you can pipe an indefinite amount to this tool without increasing its memory requirement.

Memory

Without binning, VmPeak is only 4884 kB, measured with:

# generate 2 byte unsigned numbers and pipe to meansd
od -v -A n -t u2 -w2 /dev/urandom |
  meansd --progress 1000000

# measure VmPeak
rg VmPeak /proc/$(pgrep meansd)/status

With binning, the memory requirements increase only ever so slightly per bin.

CPU

During the memory tests, my observation was that meansd consumes the numbers faster than the random number generator can produce them. While od was at 100% CPU utilization, meansd was at about 50% without binning and 90% with binning.

Commit count: 59

cargo fmt