Skip to content
Accurately measure how long a command takes to run
Go
Branch: master
Clone or download

Latest commit

Latest commit 59a23f2 Jun 1, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE Initial commit May 30, 2020
README.md Update README.md Jun 1, 2020
go.mod Rename to timer May 30, 2020
go.sum Add working version May 30, 2020
main.go Improve README examples Jun 1, 2020

README.md

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
You can’t perform that action at this time.