timer

command module
v0.0.0-...-e344070 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2020 License: MIT Imports: 11 Imported by: 0

README

timer

timer is like time but repeats your command and provides basic statistics on execution time.

It's inspired by perf stat, but works on MacOS.

Install

go get cdr.dev/timer

Basic Usage

$ timer -n curl google.com
--- timer config
command        curl google.com
iterations     10
parallelism    1
--- percentiles
0        (fastest)         0.037s
25       (1st quantile)    0.041s
50       (median)          0.044s
75       (3rd quantile)    0.049s
100th    (slowest)         0.059s
--- summary
total     0.455s
mean      0.046s
stddev    0.006s

Apache Bench is typically better for websites

Parallelism

You can use the -p flag to configure the number of parallel threads.

$ timer -n 4 -p 2 sleep 1s
--- timer config
command        sleep 1s
iterations     4
parallelism    2
--- percentiles
0        (fastest)         1.005s
25       (1st quantile)    1.005s
50       (median)          1.006s
75       (3rd quantile)    1.006s
100th    (slowest)         1.006s
--- summary
total     2.013s
mean      1.006s
stddev    0.001s

Similar Projects

  • bench provides more thorough analysis and is easily installed on MacOS

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL