mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-21 03:41:25 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
697deb6d88 | ||
|
|
355765e7bf | ||
|
|
fdc4c655d3 | ||
|
|
233a995ba4 | ||
|
|
be09ae413f | ||
|
|
d677901341 | ||
|
|
07f142528e | ||
|
|
e862cf8567 | ||
|
|
3966bf05c1 | ||
|
|
8295327263 | ||
|
|
3351f52b1b | ||
|
|
0756558d53 | ||
|
|
8a25885714 | ||
|
|
5fb66db100 | ||
|
|
5602c17bef | ||
|
|
8b933dc64d | ||
|
|
df1500dc60 | ||
|
|
97920d5b74 | ||
|
|
1bd5436109 | ||
|
|
9b5dd60a92 | ||
|
|
4b8cc34815 | ||
|
|
bd81fe65a2 | ||
|
|
aabe1331a2 | ||
|
|
c59110d652 | ||
|
|
ce79d81bd2 | ||
|
|
7c7277777a | ||
|
|
c4688a7386 | ||
|
|
12d8fdbf61 | ||
|
|
a91912f322 |
No files matched your search
Generated
+164
-42
@@ -8,8 +8,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ansi_term"
|
||||
version = "0.10.2"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "approx"
|
||||
@@ -18,10 +21,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
version = "0.2.6"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@@ -38,11 +41,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.30.0"
|
||||
version = "2.31.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atty 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -57,7 +60,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@@ -76,14 +79,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"clicolors-control 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"termios 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "csv"
|
||||
version = "1.0.0-beta.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"csv-core 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "csv-core"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dtoa"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "fuchsia-zircon"
|
||||
version = "0.3.3"
|
||||
@@ -100,15 +125,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "hyperfine"
|
||||
version = "0.5.0"
|
||||
version = "1.0.0"
|
||||
dependencies = [
|
||||
"approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atty 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clap 2.30.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"csv 1.0.0-beta.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"indicatif 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"statistical 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@@ -121,9 +150,14 @@ dependencies = [
|
||||
"console 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "kernel32-sys"
|
||||
version = "0.2.2"
|
||||
@@ -145,7 +179,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.37"
|
||||
version = "0.2.39"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
@@ -153,7 +187,7 @@ name = "memchr"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -162,11 +196,11 @@ version = "0.1.42"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"num-bigint 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-complex 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-integer 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-iter 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -175,17 +209,17 @@ version = "0.1.43"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"num-integer 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-complex"
|
||||
version = "0.1.42"
|
||||
version = "0.1.43"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"num-traits 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@@ -194,7 +228,7 @@ name = "num-integer"
|
||||
version = "0.1.36"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"num-traits 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -203,7 +237,7 @@ version = "0.1.35"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"num-integer 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -213,13 +247,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"num-bigint 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-integer 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
@@ -244,19 +278,35 @@ name = "parking_lot_core"
|
||||
version = "0.2.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.3.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@@ -266,7 +316,7 @@ version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@@ -285,26 +335,65 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "0.2.6"
|
||||
version = "0.2.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex-syntax 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.4.2"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-serialize"
|
||||
version = "0.3.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive_internals 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive_internals"
|
||||
version = "0.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "0.6.0"
|
||||
@@ -329,13 +418,23 @@ name = "strsim"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "0.12.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "term_size"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@@ -344,7 +443,7 @@ name = "termion"
|
||||
version = "1.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@@ -354,7 +453,7 @@ name = "termios"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -375,11 +474,21 @@ dependencies = [
|
||||
"unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ucd-util"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-width"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "unreachable"
|
||||
version = "1.0.0"
|
||||
@@ -429,50 +538,63 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[metadata]
|
||||
"checksum aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6531d44de723825aa81398a6415283229725a00fa30713812ab9323faa82fc4"
|
||||
"checksum ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6b3568b48b7cefa6b8ce125f9bb4989e52fbcc29ebea88df04cc7c5f12f70455"
|
||||
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
||||
"checksum approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08abcc3b4e9339e33a3d0a5ed15d84a687350c05689d825e0f6655eef9e76a94"
|
||||
"checksum atty 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8352656fd42c30a0c3c89d26dea01e3b77c0ab2af18230835c15e2e13cd51859"
|
||||
"checksum atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "af80143d6f7608d746df1520709e5d141c96f240b0e62b0aa41bdfb53374d9d4"
|
||||
"checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf"
|
||||
"checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"
|
||||
"checksum clap 2.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1c07b9257a00f3fc93b7f3c417fc15607ec7a56823bc2c37ec744e266387de5b"
|
||||
"checksum clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f0f16b89cbb9ee36d87483dc939fe9f1e13c05898d56d7b230a0d4dff033a536"
|
||||
"checksum clicolors-control 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1f84dec9bc083ce2503908cd305af98bd363da6f54bf8d4bf0ac14ee749ad5d1"
|
||||
"checksum colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b0aa3473e85a3161b59845d6096b289bb577874cafeaf75ea1b1beaa6572c7fc"
|
||||
"checksum console 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7649ca90478264b9686aac8d269fcb014f14c2bed7c79a7e51b9f6afd4d783eb"
|
||||
"checksum csv 1.0.0-beta.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e7a9e063dcebdb56c306f23e672bfd31df3da8ec5f6d696b35f2c29c2a9572f0"
|
||||
"checksum csv-core 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4dd8e6d86f7ba48b4276ef1317edc8cc36167546d8972feb4a2b5fec0b374105"
|
||||
"checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab"
|
||||
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
|
||||
"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
|
||||
"checksum indicatif 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a29b2fa6f00010c268bface64c18bb0310aaa70d46a195d5382d288c477fb016"
|
||||
"checksum itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c069bbec61e1ca5a596166e55dfe4773ff745c3d16b700013bcaff9a6df2c682"
|
||||
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||
"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
|
||||
"checksum lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d"
|
||||
"checksum libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)" = "56aebce561378d99a0bb578f8cb15b6114d2a1814a6c7949bbe646d968bb4fa9"
|
||||
"checksum libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)" = "f54263ad99207254cf58b5f701ecb432c717445ea2ee8af387334bdd1a03fdff"
|
||||
"checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d"
|
||||
"checksum num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e"
|
||||
"checksum num-bigint 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "81b483ea42927c463e191802e7334556b48e7875297564c0e9951bd3a0ae53e3"
|
||||
"checksum num-complex 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "26ff8edeab9f1d8cf6b595e35138c2a389ea29f4f57a0e6bc44abf406e4b0077"
|
||||
"checksum num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "b288631d7878aaf59442cffd36910ea604ecd7745c36054328595114001c9656"
|
||||
"checksum num-integer 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f8d26da319fb45674985c78f1d1caf99aa4941f785d384a2ae36d0740bc3e2fe"
|
||||
"checksum num-iter 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "4b226df12c5a59b63569dd57fafb926d91b385dfce33d8074a412411b689d593"
|
||||
"checksum num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "ee314c74bd753fc86b4780aa9475da469155f3848473a261d2d18e35245a784e"
|
||||
"checksum num-traits 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3c2bd9b9d21e48e956b763c9f37134dc62d9e95da6edb3f672cacb6caf3cd3"
|
||||
"checksum num-traits 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dee092fcdf725aee04dd7da1d21debff559237d49ef1cb3e69bcb8ece44c7364"
|
||||
"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
|
||||
"checksum parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9fd9d732f2de194336fb02fe11f9eed13d9e76f13f4315b4d88a14ca411750cd"
|
||||
"checksum parking_lot_core 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "538ef00b7317875071d5e00f603f24d16f0b474c1a5fc0ccb8b454ca72eafa79"
|
||||
"checksum proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cd07deb3c6d1d9ff827999c7f9b04cdfd66b1b17ae508e14fe47b620f2282ae0"
|
||||
"checksum quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eca14c727ad12702eb4b6bfb5a232287dcf8385cb8ca83a3eeaf6519c44c408"
|
||||
"checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1"
|
||||
"checksum rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eba5f8cb59cc50ed56be8880a5c7b496bfd9bd26394e176bc67884094145c2c5"
|
||||
"checksum redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "0d92eecebad22b767915e4d529f89f28ee96dbbf5a4810d2b844373f136417fd"
|
||||
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
|
||||
"checksum regex 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "5be5347bde0c48cfd8c3fdc0766cdfe9d8a755ef84d620d6794c778c91de8b2b"
|
||||
"checksum regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8e931c58b93d86f080c734bfd2bce7dd0079ae2331235818133c8be7f422e20e"
|
||||
"checksum regex 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "aec3f58d903a7d2a9dc2bf0e41a746f4530e0cab6b615494e058f67a3ef947fb"
|
||||
"checksum regex-syntax 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b2550876c31dc914696a6c2e01cbce8afba79a93c8ae979d2fe051c0230b3756"
|
||||
"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
|
||||
"checksum serde 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)" = "0e100d00fb985a5bf16b857a436450e404fa613de3321b2e383947a93cbd75df"
|
||||
"checksum serde_derive 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)" = "86daebd995aa948b069d886f2105f2425cd66103049855e45c15c58c573f12c5"
|
||||
"checksum serde_derive_internals 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6b3f714f52a41e371c5e141e9dafcead60921349bec76b44d79000c88aba3cfc"
|
||||
"checksum serde_json 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "5c508584d9913df116b91505eec55610a2f5b16e9ed793c46e4d0152872b3e74"
|
||||
"checksum smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44db0ecb22921ef790d17ae13a3f6d15784183ff5f2a01aa32098c7498d2b4b9"
|
||||
"checksum stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "15132e0e364248108c5e2c02e3ab539be8d6f5d52a01ca9bbf27ed657316f02b"
|
||||
"checksum statistical 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c139942f46d96c53b28420a2cdfb374629f122656bd9daef7fc221ed4d8ec228"
|
||||
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
|
||||
"checksum syn 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)" = "8c5bc2d6ff27891209efa5f63e9de78648d7801f085e4653701a692ce938d6fd"
|
||||
"checksum term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9e5b9a66db815dcfd2da92db471106457082577c3c278d4138ab3e3b4e189327"
|
||||
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
|
||||
"checksum termios 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d5d9cf598a6d7ce700a4e6a9199da127e6819a61e64b68609683cc9a01b5683a"
|
||||
"checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693"
|
||||
"checksum thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "279ef31c19ededf577bfd12dfae728040a21f635b06a24cd670ff510edd38963"
|
||||
"checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d"
|
||||
"checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f"
|
||||
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||
"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
|
||||
"checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122"
|
||||
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
||||
|
||||
+5
-1
@@ -7,7 +7,7 @@ license = "MIT/Apache-2.0"
|
||||
name = "hyperfine"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/sharkdp/hyperfine"
|
||||
version = "0.5.0"
|
||||
version = "1.0.0"
|
||||
|
||||
[dependencies]
|
||||
colored = "1.6"
|
||||
@@ -15,6 +15,10 @@ indicatif = "0.9"
|
||||
statistical = "0.1"
|
||||
atty = "0.2.2"
|
||||
cfg-if = "0.1.2"
|
||||
csv = "1.0.0-beta.5"
|
||||
serde = "1.0.33"
|
||||
serde_derive = "1.0.33"
|
||||
serde_json = "1.0.11"
|
||||
|
||||
[target.'cfg(not(windows))'.dependencies]
|
||||
libc = "0.2"
|
||||
|
||||
@@ -18,6 +18,8 @@ A command-line benchmarking tool (*inspired by [bench](https://github.com/Gabrie
|
||||
* Warmup runs can be executed before the actual benchmark.
|
||||
* Cache-clearing commands can be set up before each timing run.
|
||||
* Statistical outlier detection.
|
||||
* Export results to various formats: CSV, JSON, Markdown.
|
||||
* Parameterized benchmarks.
|
||||
* Cross-platform
|
||||
|
||||
## Usage
|
||||
@@ -60,6 +62,26 @@ and then call:
|
||||
hyperfine --prepare 'sync; echo 3 | sudo tee /proc/sys/vm/drop_caches' 'grep -R TODO *'
|
||||
```
|
||||
|
||||
### Parameterized benchmarks
|
||||
|
||||
If you want to run a benchmark where only a single parameter is varied (say, the number of
|
||||
threads), you can use the `-P`/`--parameter-scan` option and call:
|
||||
``` bash
|
||||
hyperfine --prepare 'make clean' --parameter-scan num_threads 1 12 'make -j {num_threads}'
|
||||
```
|
||||
|
||||
### Export results
|
||||
|
||||
Hyperfine has multiple options for exporting benchmark results: CSV, JSON, Markdown (see `--help`
|
||||
text for details). To export results to Markdown, for example, you can use the `--export-markdown`
|
||||
option that will create tables like this:
|
||||
|
||||
| Command | Mean [ms] | Min…Max [ms] |
|
||||
|:---|---:|---:|
|
||||
| `find . -iregex '.*[0-9]\.jpg$'` | 506.0 ± 8.1 | 495.4…518.6 |
|
||||
| `find . -iname '*[0-9].jpg'` | 304.9 ± 3.1 | 299.8…309.3 |
|
||||
| `fd -HI '.*[0-9]\.jpg$'` | 66.2 ± 5.8 | 62.5…86.3 |
|
||||
|
||||
## Installation
|
||||
|
||||
Hyperfine can be installed via [cargo](https://doc.rust-lang.org/cargo/):
|
||||
@@ -79,8 +101,8 @@ yaourt -S hyperfine
|
||||
Download the appropriate `.deb` package from the [Release page](https://github.com/sharkdp/hyperfine/releases)
|
||||
and install it via `dpkg`:
|
||||
```
|
||||
wget https://github.com/sharkdp/hyperfine/releases/download/v0.5.0/hyperfine_0.5.0_amd64.deb
|
||||
sudo dpkg -i hyperfine_0.6.0_amd64.deb
|
||||
wget https://github.com/sharkdp/hyperfine/releases/download/v1.0.0/hyperfine_1.0.0_amd64.deb
|
||||
sudo dpkg -i hyperfine_1.0.0_amd64.deb
|
||||
```
|
||||
|
||||
### Void Linux
|
||||
|
||||
@@ -3,14 +3,15 @@ use std::io;
|
||||
use colored::*;
|
||||
use statistical::{mean, standard_deviation};
|
||||
|
||||
use hyperfine::internal::{get_progress_bar, max, min, CmdFailureAction, HyperfineOptions,
|
||||
OutputStyleOption, Second, MIN_EXECUTION_TIME};
|
||||
use hyperfine::internal::{get_progress_bar, max, min, MIN_EXECUTION_TIME};
|
||||
use hyperfine::types::{CmdFailureAction, HyperfineOptions, OutputStyleOption, Second};
|
||||
use hyperfine::warnings::Warnings;
|
||||
use hyperfine::format::{format_duration, format_duration_unit};
|
||||
use hyperfine::outlier_detection::{modified_zscores, OUTLIER_THRESHOLD};
|
||||
use hyperfine::timer::{TimerStart, TimerStop};
|
||||
use hyperfine::timer::wallclocktimer::WallClockTimer;
|
||||
use hyperfine::shell::execute_and_time;
|
||||
use hyperfine::types::{BenchmarkResult, Command};
|
||||
|
||||
/// Results from timing a single shell command
|
||||
#[derive(Debug, Default, Copy, Clone)]
|
||||
@@ -36,13 +37,13 @@ fn subtract_shell_spawning_time(time: Second, shell_spawning_time: Second) -> Se
|
||||
|
||||
/// Run the given shell command and measure the execution time
|
||||
pub fn time_shell_command(
|
||||
shell_cmd: &str,
|
||||
command: &Command,
|
||||
failure_action: CmdFailureAction,
|
||||
shell_spawning_time: Option<TimingResult>,
|
||||
) -> io::Result<(TimingResult, bool)> {
|
||||
let wallclock_timer = WallClockTimer::start();
|
||||
|
||||
let result = execute_and_time(shell_cmd)?;
|
||||
let result = execute_and_time(&command.get_shell_command())?;
|
||||
|
||||
let mut time_user = result.user_time;
|
||||
let mut time_system = result.system_time;
|
||||
@@ -85,7 +86,7 @@ pub fn mean_shell_spawning_time(style: &OutputStyleOption) -> io::Result<TimingR
|
||||
|
||||
for _ in 0..COUNT {
|
||||
// Just run the shell without any command
|
||||
let res = time_shell_command("", CmdFailureAction::RaiseError, None);
|
||||
let res = time_shell_command(&Command::new(""), CmdFailureAction::RaiseError, None);
|
||||
|
||||
match res {
|
||||
Err(_) => {
|
||||
@@ -115,7 +116,11 @@ pub fn mean_shell_spawning_time(style: &OutputStyleOption) -> io::Result<TimingR
|
||||
/// Run the command specified by `--prepare`.
|
||||
fn run_preparation_command(command: &Option<String>) -> io::Result<TimingResult> {
|
||||
if let &Some(ref preparation_command) = command {
|
||||
let res = time_shell_command(preparation_command, CmdFailureAction::RaiseError, None);
|
||||
let res = time_shell_command(
|
||||
&Command::new(preparation_command),
|
||||
CmdFailureAction::RaiseError,
|
||||
None,
|
||||
);
|
||||
if res.is_err() {
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
@@ -133,10 +138,10 @@ fn run_preparation_command(command: &Option<String>) -> io::Result<TimingResult>
|
||||
/// Run the benchmark for a single shell command
|
||||
pub fn run_benchmark(
|
||||
num: usize,
|
||||
cmd: &str,
|
||||
cmd: &Command,
|
||||
shell_spawning_time: TimingResult,
|
||||
options: &HyperfineOptions,
|
||||
) -> io::Result<()> {
|
||||
) -> io::Result<BenchmarkResult> {
|
||||
println!(
|
||||
"{}{}: {}",
|
||||
"Benchmark #".bold(),
|
||||
@@ -293,5 +298,14 @@ pub fn run_benchmark(
|
||||
|
||||
println!(" ");
|
||||
|
||||
Ok(())
|
||||
Ok(BenchmarkResult::new(
|
||||
cmd.get_shell_command(),
|
||||
t_mean,
|
||||
t_stddev,
|
||||
user_mean,
|
||||
system_mean,
|
||||
t_min,
|
||||
t_max,
|
||||
times_real,
|
||||
))
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
use std::num;
|
||||
use std::error::Error;
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum ParameterScanError {
|
||||
ParseIntError(num::ParseIntError),
|
||||
EmptyRange,
|
||||
TooLarge,
|
||||
}
|
||||
|
||||
impl ParameterScanError {
|
||||
fn __description(&self) -> &str {
|
||||
match *self {
|
||||
ParameterScanError::ParseIntError(ref e) => e.description(),
|
||||
ParameterScanError::EmptyRange => "Empty parameter range",
|
||||
ParameterScanError::TooLarge => "Parameter range is too large",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<num::ParseIntError> for ParameterScanError {
|
||||
fn from(e: num::ParseIntError) -> ParameterScanError {
|
||||
ParameterScanError::ParseIntError(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for ParameterScanError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{}", self.__description())
|
||||
}
|
||||
}
|
||||
|
||||
impl Error for ParameterScanError {
|
||||
fn description(&self) -> &str {
|
||||
self.__description()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
use super::Exporter;
|
||||
|
||||
use hyperfine::types::BenchmarkResult;
|
||||
|
||||
use std::io::{Error, ErrorKind, Result};
|
||||
|
||||
use csv::WriterBuilder;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct CsvExporter {}
|
||||
|
||||
impl Exporter for CsvExporter {
|
||||
fn serialize(&self, results: &Vec<BenchmarkResult>) -> Result<Vec<u8>> {
|
||||
let mut writer = WriterBuilder::new().from_writer(vec![]);
|
||||
for res in results {
|
||||
// The list of times can not be exported to the CSV file - remove it:
|
||||
let mut result = res.clone();
|
||||
result.times = None;
|
||||
|
||||
writer.serialize(result)?;
|
||||
}
|
||||
|
||||
writer
|
||||
.into_inner()
|
||||
.map_err(|e| Error::new(ErrorKind::Other, e))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
use super::Exporter;
|
||||
use hyperfine::types::BenchmarkResult;
|
||||
|
||||
use std::io::{Error, ErrorKind, Result};
|
||||
|
||||
use serde_json::to_vec_pretty;
|
||||
|
||||
#[derive(Serialize, Debug)]
|
||||
struct HyperfineSummary<'a> {
|
||||
results: &'a Vec<BenchmarkResult>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct JsonExporter {}
|
||||
|
||||
impl Exporter for JsonExporter {
|
||||
fn serialize(&self, results: &Vec<BenchmarkResult>) -> Result<Vec<u8>> {
|
||||
let mut output = to_vec_pretty(&HyperfineSummary { results });
|
||||
for content in output.iter_mut() {
|
||||
content.push(b'\n');
|
||||
}
|
||||
|
||||
output.map_err(|e| Error::new(ErrorKind::Other, e))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
use super::Exporter;
|
||||
use hyperfine::types::BenchmarkResult;
|
||||
|
||||
use std::io::Result;
|
||||
|
||||
const MULTIPLIER: f64 = 1e3;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct MarkdownExporter {}
|
||||
|
||||
impl Exporter for MarkdownExporter {
|
||||
fn serialize(&self, results: &Vec<BenchmarkResult>) -> Result<Vec<u8>> {
|
||||
let mut destination = start_table();
|
||||
|
||||
for result in results {
|
||||
add_table_row(&mut destination, result);
|
||||
}
|
||||
|
||||
Ok(destination)
|
||||
}
|
||||
}
|
||||
|
||||
fn start_table() -> Vec<u8> {
|
||||
"| Command | Mean [ms] | Min…Max [ms] |\n|:---|---:|---:|\n"
|
||||
.bytes()
|
||||
.collect()
|
||||
}
|
||||
fn add_table_row(dest: &mut Vec<u8>, entry: &BenchmarkResult) {
|
||||
dest.extend(
|
||||
format!(
|
||||
"| `{}` | {:.1} ± {:.1} | {:.1}…{:.1} |\n",
|
||||
entry.command.replace("|", "\\|"),
|
||||
entry.mean * MULTIPLIER,
|
||||
entry.stddev * MULTIPLIER,
|
||||
entry.min * MULTIPLIER,
|
||||
entry.max * MULTIPLIER
|
||||
).as_bytes(),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
mod csv;
|
||||
mod json;
|
||||
mod markdown;
|
||||
|
||||
use self::csv::CsvExporter;
|
||||
use self::json::JsonExporter;
|
||||
use self::markdown::MarkdownExporter;
|
||||
|
||||
use std::io::{Result, Write};
|
||||
use std::fs::File;
|
||||
|
||||
use hyperfine::types::BenchmarkResult;
|
||||
|
||||
/// The desired form of exporter to use for a given file.
|
||||
#[derive(Clone)]
|
||||
pub enum ExportType {
|
||||
/// CSV (comma separated values) format
|
||||
Csv,
|
||||
|
||||
/// JSON format
|
||||
Json,
|
||||
|
||||
/// Markdown table
|
||||
Markdown,
|
||||
}
|
||||
|
||||
/// Interface for different exporters.
|
||||
trait Exporter {
|
||||
/// Export the given entries in the serialized form.
|
||||
fn serialize(&self, results: &Vec<BenchmarkResult>) -> Result<Vec<u8>>;
|
||||
}
|
||||
|
||||
struct ExporterWithFilename {
|
||||
exporter: Box<Exporter>,
|
||||
filename: String,
|
||||
}
|
||||
|
||||
/// Handles the management of multiple file exporters.
|
||||
pub struct ExportManager {
|
||||
exporters: Vec<ExporterWithFilename>,
|
||||
}
|
||||
|
||||
impl ExportManager {
|
||||
/// Create a new ExportManager
|
||||
pub fn new() -> ExportManager {
|
||||
ExportManager {
|
||||
exporters: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Add an additional exporter to the ExportManager
|
||||
pub fn add_exporter(&mut self, export_type: ExportType, filename: &str) {
|
||||
let exporter: Box<Exporter> = match export_type {
|
||||
ExportType::Csv => Box::new(CsvExporter::default()),
|
||||
ExportType::Json => Box::new(JsonExporter::default()),
|
||||
ExportType::Markdown => Box::new(MarkdownExporter::default()),
|
||||
};
|
||||
self.exporters.push(ExporterWithFilename {
|
||||
exporter,
|
||||
filename: filename.to_string(),
|
||||
});
|
||||
}
|
||||
|
||||
/// Write the given results to all Exporters contained within this manager
|
||||
pub fn write_results(&self, results: Vec<BenchmarkResult>) -> Result<()> {
|
||||
for e in &self.exporters {
|
||||
let file_content = e.exporter.serialize(&results)?;
|
||||
write_to_file(&e.filename, &file_content)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Write the given content to a file with the specified name
|
||||
fn write_to_file(filename: &String, content: &Vec<u8>) -> Result<()> {
|
||||
let mut file = File::create(filename)?;
|
||||
file.write_all(content)
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
use hyperfine::internal::Second;
|
||||
use hyperfine::types::Second;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum Unit {
|
||||
|
||||
+38
-59
@@ -1,68 +1,14 @@
|
||||
use colored::*;
|
||||
use indicatif::{ProgressBar, ProgressStyle};
|
||||
|
||||
/// Type alias for unit of time
|
||||
pub type Second = f64;
|
||||
use hyperfine::types::{BenchmarkResult, OutputStyleOption, Second};
|
||||
|
||||
use std::cmp::Ordering;
|
||||
use std::iter::Iterator;
|
||||
|
||||
/// Threshold for warning about fast execution time
|
||||
pub const MIN_EXECUTION_TIME: Second = 5e-3;
|
||||
|
||||
/// Action to take when an executed command fails.
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum CmdFailureAction {
|
||||
/// Exit with an error message
|
||||
RaiseError,
|
||||
|
||||
/// Simply ignore the non-zero exit code
|
||||
Ignore,
|
||||
}
|
||||
|
||||
/// Output style type option
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum OutputStyleOption {
|
||||
/// Do not output with colors or any special formatting
|
||||
Basic,
|
||||
|
||||
/// Output with full color and formatting
|
||||
Full,
|
||||
|
||||
/// Keep elements such as progress bar, but use no coloring
|
||||
NoColor,
|
||||
}
|
||||
|
||||
/// A set of options for hyperfine
|
||||
pub struct HyperfineOptions {
|
||||
/// Number of warmup runs
|
||||
pub warmup_count: u64,
|
||||
|
||||
/// Minimum number of benchmark runs
|
||||
pub min_runs: u64,
|
||||
|
||||
/// Minimum benchmarking time
|
||||
pub min_time_sec: Second,
|
||||
|
||||
/// Whether or not to ignore non-zero exit codes
|
||||
pub failure_action: CmdFailureAction,
|
||||
|
||||
/// Command to run before each timing run
|
||||
pub preparation_command: Option<String>,
|
||||
|
||||
/// What color mode to use for output
|
||||
pub output_style: OutputStyleOption,
|
||||
}
|
||||
|
||||
impl Default for HyperfineOptions {
|
||||
fn default() -> HyperfineOptions {
|
||||
HyperfineOptions {
|
||||
warmup_count: 0,
|
||||
min_runs: 10,
|
||||
min_time_sec: 3.0,
|
||||
failure_action: CmdFailureAction::RaiseError,
|
||||
preparation_command: None,
|
||||
output_style: OutputStyleOption::Full,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Return a pre-configured progress bar
|
||||
pub fn get_progress_bar(length: u64, msg: &str, option: &OutputStyleOption) -> ProgressBar {
|
||||
let progressbar_style = match *option {
|
||||
@@ -97,6 +43,39 @@ pub fn min(vals: &[f64]) -> f64 {
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
pub fn write_benchmark_comparison(results: &Vec<BenchmarkResult>) {
|
||||
if results.len() < 2 {
|
||||
return;
|
||||
}
|
||||
|
||||
// Show which was faster, maybe expand to table later?
|
||||
let mut fastest_item: &BenchmarkResult = &results[0];
|
||||
let mut longer_items: Vec<&BenchmarkResult> = Vec::new();
|
||||
|
||||
for run in &results[1..] {
|
||||
if let Some(Ordering::Less) = fastest_item.mean.partial_cmp(&run.mean) {
|
||||
longer_items.push(run);
|
||||
} else {
|
||||
longer_items.push(fastest_item);
|
||||
fastest_item = run;
|
||||
}
|
||||
}
|
||||
|
||||
println!("{}\n", "Summary".bold());
|
||||
println!("'{}' ran", fastest_item.command.cyan());
|
||||
longer_items.sort_by(|l, r| l.mean.partial_cmp(&r.mean).unwrap_or(Ordering::Equal));
|
||||
|
||||
for item in longer_items {
|
||||
println!(
|
||||
"{} faster than '{}'",
|
||||
format!("{:8.2}x", item.mean / fastest_item.mean)
|
||||
.bold()
|
||||
.green(),
|
||||
&item.command.magenta()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_max() {
|
||||
assert_eq!(1.0, max(&[1.0]));
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
pub mod benchmark;
|
||||
pub mod export;
|
||||
pub mod format;
|
||||
pub mod internal;
|
||||
pub mod outlier_detection;
|
||||
pub mod warnings;
|
||||
pub mod timer;
|
||||
pub mod shell;
|
||||
pub mod timer;
|
||||
pub mod types;
|
||||
pub mod warnings;
|
||||
pub mod error;
|
||||
@@ -1,4 +1,4 @@
|
||||
use hyperfine::internal::Second;
|
||||
use hyperfine::types::Second;
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct CPUTimes {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use super::internal::{CPUInterval, CPUTimes};
|
||||
use hyperfine::timer::{TimerStart, TimerStop};
|
||||
use hyperfine::internal::Second;
|
||||
use hyperfine::types::Second;
|
||||
|
||||
use std::mem;
|
||||
use std::process::Child;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::process::Child;
|
||||
use std::time::Instant;
|
||||
|
||||
use hyperfine::internal::Second;
|
||||
use hyperfine::types::Second;
|
||||
use hyperfine::timer::{TimerStart, TimerStop};
|
||||
|
||||
pub struct WallClockTimer {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#![cfg(windows)]
|
||||
|
||||
use super::internal::CPUTimes;
|
||||
use hyperfine::internal::Second;
|
||||
use hyperfine::types::Second;
|
||||
use hyperfine::timer::{TimerStart, TimerStop};
|
||||
|
||||
use winapi::um::processthreadsapi::GetProcessTimes;
|
||||
@@ -13,7 +13,7 @@ use std::process::Child;
|
||||
|
||||
const HUNDRED_NS_PER_MS: i64 = 10;
|
||||
|
||||
pub fn get_cpu_timer(process: &Child) -> Box<TimerStop<Result=(Second,Second)>> {
|
||||
pub fn get_cpu_timer(process: &Child) -> Box<TimerStop<Result = (Second, Second)>> {
|
||||
Box::new(CPUTimer::start_for_process(process))
|
||||
}
|
||||
|
||||
@@ -22,14 +22,15 @@ struct CPUTimer {
|
||||
}
|
||||
|
||||
impl TimerStart for CPUTimer {
|
||||
|
||||
fn start() -> Self {
|
||||
panic!()
|
||||
}
|
||||
|
||||
fn start_for_process(process: &Child) -> Self {
|
||||
CPUTimer { handle: process.as_raw_handle() }
|
||||
}
|
||||
CPUTimer {
|
||||
handle: process.as_raw_handle(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl TimerStop for CPUTimer {
|
||||
@@ -37,7 +38,10 @@ impl TimerStop for CPUTimer {
|
||||
|
||||
fn stop(&self) -> Self::Result {
|
||||
let times = get_cpu_times(self.handle);
|
||||
(times.user_usec as f64 * 1e-6, times.system_usec as f64 * 1e-6)
|
||||
(
|
||||
times.user_usec as f64 * 1e-6,
|
||||
times.system_usec as f64 * 1e-6,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,9 +63,12 @@ fn get_cpu_times(handle: RawHandle) -> CPUTimes {
|
||||
// GetProcessTimes will exit with non-zero if success as per: https://msdn.microsoft.com/en-us/library/windows/desktop/ms683223(v=vs.85).aspx
|
||||
if res != 0 {
|
||||
// Extract times as laid out here: https://support.microsoft.com/en-us/help/188768/info-working-with-the-filetime-structure
|
||||
// Both user_time and kernel_time are spans that the proces spent in either.
|
||||
let user: i64 = (((user_time.dwHighDateTime as i64) << 32) + user_time.dwLowDateTime as i64) / HUNDRED_NS_PER_MS;
|
||||
let kernel: i64 = (((kernel_time.dwHighDateTime as i64) << 32) + kernel_time.dwLowDateTime as i64) / HUNDRED_NS_PER_MS;
|
||||
// Both user_time and kernel_time are spans that the proces spent in either.
|
||||
let user: i64 = (((user_time.dwHighDateTime as i64) << 32)
|
||||
+ user_time.dwLowDateTime as i64) / HUNDRED_NS_PER_MS;
|
||||
let kernel: i64 = (((kernel_time.dwHighDateTime as i64) << 32)
|
||||
+ kernel_time.dwLowDateTime as i64)
|
||||
/ HUNDRED_NS_PER_MS;
|
||||
(user, kernel)
|
||||
} else {
|
||||
(0, 0)
|
||||
@@ -69,6 +76,7 @@ fn get_cpu_times(handle: RawHandle) -> CPUTimes {
|
||||
};
|
||||
|
||||
CPUTimes {
|
||||
user_usec, system_usec,
|
||||
user_usec,
|
||||
system_usec,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
/// This module contains common internal types.
|
||||
|
||||
use std::fmt;
|
||||
|
||||
/// Type alias for unit of time
|
||||
pub type Second = f64;
|
||||
|
||||
/// A command that should be benchmarked.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Command<'a> {
|
||||
/// The command that should be executed (without parameter substitution)
|
||||
expression: &'a str,
|
||||
|
||||
/// A possible parameter value.
|
||||
parameter: Option<(&'a str, i32)>,
|
||||
}
|
||||
|
||||
impl<'a> Command<'a> {
|
||||
pub fn new(expression: &'a str) -> Command<'a> {
|
||||
Command {
|
||||
expression: expression,
|
||||
parameter: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_parametrized(expression: &'a str, parameter: &'a str, value: i32) -> Command<'a> {
|
||||
Command {
|
||||
expression: expression,
|
||||
parameter: Some((parameter, value)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_shell_command(&self) -> String {
|
||||
match self.parameter {
|
||||
Some((param_name, param_value)) => self.expression.replace(
|
||||
&format!("{{{param_name}}}", param_name = param_name),
|
||||
¶m_value.to_string(),
|
||||
),
|
||||
None => self.expression.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> fmt::Display for Command<'a> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{}", self.get_shell_command())
|
||||
}
|
||||
}
|
||||
|
||||
/// Action to take when an executed command fails.
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum CmdFailureAction {
|
||||
/// Exit with an error message
|
||||
RaiseError,
|
||||
|
||||
/// Simply ignore the non-zero exit code
|
||||
Ignore,
|
||||
}
|
||||
|
||||
/// Output style type option
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum OutputStyleOption {
|
||||
/// Do not output with colors or any special formatting
|
||||
Basic,
|
||||
|
||||
/// Output with full color and formatting
|
||||
Full,
|
||||
|
||||
/// Keep elements such as progress bar, but use no coloring
|
||||
NoColor,
|
||||
}
|
||||
|
||||
/// A set of options for hyperfine
|
||||
pub struct HyperfineOptions {
|
||||
/// Number of warmup runs
|
||||
pub warmup_count: u64,
|
||||
|
||||
/// Minimum number of benchmark runs
|
||||
pub min_runs: u64,
|
||||
|
||||
/// Minimum benchmarking time
|
||||
pub min_time_sec: Second,
|
||||
|
||||
/// Whether or not to ignore non-zero exit codes
|
||||
pub failure_action: CmdFailureAction,
|
||||
|
||||
/// Command to run before each timing run
|
||||
pub preparation_command: Option<String>,
|
||||
|
||||
/// What color mode to use for output
|
||||
pub output_style: OutputStyleOption,
|
||||
}
|
||||
|
||||
impl Default for HyperfineOptions {
|
||||
fn default() -> HyperfineOptions {
|
||||
HyperfineOptions {
|
||||
warmup_count: 0,
|
||||
min_runs: 10,
|
||||
min_time_sec: 3.0,
|
||||
failure_action: CmdFailureAction::RaiseError,
|
||||
preparation_command: None,
|
||||
output_style: OutputStyleOption::Full,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Set of values that will be exported.
|
||||
#[derive(Debug, Default, Clone, Serialize)]
|
||||
pub struct BenchmarkResult {
|
||||
/// The command that was run
|
||||
pub command: String,
|
||||
|
||||
/// The mean run time
|
||||
pub mean: Second,
|
||||
|
||||
/// The standard deviation of all run times
|
||||
pub stddev: Second,
|
||||
|
||||
/// Time spend in user space
|
||||
pub user: Second,
|
||||
|
||||
/// Time spent in system space
|
||||
pub system: Second,
|
||||
|
||||
/// Min time measured
|
||||
pub min: Second,
|
||||
|
||||
/// Max time measured
|
||||
pub max: Second,
|
||||
|
||||
/// All run time measurements
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub times: Option<Vec<Second>>,
|
||||
}
|
||||
|
||||
impl BenchmarkResult {
|
||||
/// Create a new entry with the given values.
|
||||
pub fn new(
|
||||
command: String,
|
||||
mean: Second,
|
||||
stddev: Second,
|
||||
user: Second,
|
||||
system: Second,
|
||||
min: Second,
|
||||
max: Second,
|
||||
times: Vec<Second>,
|
||||
) -> Self {
|
||||
BenchmarkResult {
|
||||
command,
|
||||
mean,
|
||||
stddev,
|
||||
user,
|
||||
system,
|
||||
min,
|
||||
max,
|
||||
times: Some(times),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
use std::fmt;
|
||||
|
||||
use hyperfine::internal::{Second, MIN_EXECUTION_TIME};
|
||||
use hyperfine::internal::MIN_EXECUTION_TIME;
|
||||
use hyperfine::types::Second;
|
||||
use hyperfine::format::format_duration;
|
||||
|
||||
/// A list of all possible warnings
|
||||
|
||||
+117
-9
@@ -6,7 +6,13 @@ extern crate cfg_if;
|
||||
#[macro_use]
|
||||
extern crate clap;
|
||||
extern crate colored;
|
||||
extern crate csv;
|
||||
extern crate indicatif;
|
||||
extern crate serde;
|
||||
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
extern crate serde_json;
|
||||
extern crate statistical;
|
||||
|
||||
cfg_if! {
|
||||
@@ -24,6 +30,7 @@ extern crate approx;
|
||||
use std::cmp;
|
||||
use std::error::Error;
|
||||
use std::io;
|
||||
use std::ops::Range;
|
||||
|
||||
use atty::Stream;
|
||||
use colored::*;
|
||||
@@ -31,8 +38,12 @@ use clap::{App, AppSettings, Arg};
|
||||
|
||||
mod hyperfine;
|
||||
|
||||
use hyperfine::internal::{CmdFailureAction, HyperfineOptions, OutputStyleOption};
|
||||
use hyperfine::internal::write_benchmark_comparison;
|
||||
use hyperfine::types::{BenchmarkResult, CmdFailureAction, Command, HyperfineOptions,
|
||||
OutputStyleOption};
|
||||
use hyperfine::benchmark::{mean_shell_spawning_time, run_benchmark};
|
||||
use hyperfine::export::{ExportManager, ExportType};
|
||||
use hyperfine::error::ParameterScanError;
|
||||
|
||||
/// Print error message to stderr and terminate
|
||||
pub fn error(message: &str) -> ! {
|
||||
@@ -41,15 +52,37 @@ pub fn error(message: &str) -> ! {
|
||||
}
|
||||
|
||||
/// Runs the benchmark for the given commands
|
||||
fn run(commands: &Vec<&str>, options: &HyperfineOptions) -> io::Result<()> {
|
||||
fn run(commands: &Vec<Command>, options: &HyperfineOptions) -> io::Result<Vec<BenchmarkResult>> {
|
||||
let shell_spawning_time = mean_shell_spawning_time(&options.output_style)?;
|
||||
|
||||
let mut timing_results = vec![];
|
||||
|
||||
// Run the benchmarks
|
||||
for (num, cmd) in commands.iter().enumerate() {
|
||||
run_benchmark(num, cmd, shell_spawning_time, options)?;
|
||||
timing_results.push(run_benchmark(num, cmd, shell_spawning_time, options)?);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
Ok(timing_results)
|
||||
}
|
||||
|
||||
/// A function to read the `--parameter-scan` arguments
|
||||
fn parse_parameter_scan_args<'a>(
|
||||
mut vals: clap::Values<'a>,
|
||||
) -> Result<(&'a str, Range<i32>), ParameterScanError> {
|
||||
let param_name = vals.next().unwrap();
|
||||
let param_min: i32 = vals.next().unwrap().parse()?;
|
||||
let param_max: i32 = vals.next().unwrap().parse()?;
|
||||
|
||||
const MAX_PARAMETERS: i32 = 100000;
|
||||
if param_max - param_min > MAX_PARAMETERS {
|
||||
return Err(ParameterScanError::TooLarge);
|
||||
}
|
||||
|
||||
if param_max < param_min {
|
||||
return Err(ParameterScanError::EmptyRange);
|
||||
}
|
||||
|
||||
return Ok((param_name, param_min..(param_max + 1)));
|
||||
}
|
||||
|
||||
fn main() {
|
||||
@@ -67,6 +100,8 @@ fn main() {
|
||||
.setting(clap_color_setting)
|
||||
.setting(AppSettings::DeriveDisplayOrder)
|
||||
.setting(AppSettings::UnifiedHelpMessage)
|
||||
.setting(AppSettings::NextLineHelp)
|
||||
.setting(AppSettings::HidePossibleValuesInHelp)
|
||||
.max_term_width(90)
|
||||
.about("A command-line benchmarking tool.")
|
||||
.arg(
|
||||
@@ -109,6 +144,18 @@ fn main() {
|
||||
clearing disk caches, for example.",
|
||||
),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("parameter-scan")
|
||||
.long("parameter-scan")
|
||||
.short("P")
|
||||
.help(
|
||||
"Perform benchmark runs for each value in the range MIN..MAX. Replaces the \
|
||||
string '{VAR}' in each command by the current parameter value.",
|
||||
)
|
||||
.takes_value(true)
|
||||
.allow_hyphen_values(true)
|
||||
.value_names(&["VAR", "MIN", "MAX"]),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("style")
|
||||
.long("style")
|
||||
@@ -119,8 +166,8 @@ fn main() {
|
||||
.help(
|
||||
"Set output style type (default: auto). Set this to 'basic' to disable output \
|
||||
coloring and interactive elements. Set it to 'full' to enable all effects \
|
||||
even if no interactive terminal was detected. Setting to 'nocolor' maintains \
|
||||
all advanced output, but uses no colorization.",
|
||||
even if no interactive terminal was detected. Set this to 'nocolor' to \
|
||||
keep the interactive output without any colors.",
|
||||
),
|
||||
)
|
||||
.arg(
|
||||
@@ -129,6 +176,27 @@ fn main() {
|
||||
.short("i")
|
||||
.help("Ignore non-zero exit codes."),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("export-csv")
|
||||
.long("export-csv")
|
||||
.takes_value(true)
|
||||
.value_name("FILE")
|
||||
.help("Export the timing results as CSV to the given FILE."),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("export-json")
|
||||
.long("export-json")
|
||||
.takes_value(true)
|
||||
.value_name("FILE")
|
||||
.help("Export the timing results as JSON to the given FILE."),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("export-markdown")
|
||||
.long("export-markdown")
|
||||
.takes_value(true)
|
||||
.value_name("FILE")
|
||||
.help("Export the timing results as a Markdown table to the given FILE."),
|
||||
)
|
||||
.help_message("Print this help message.")
|
||||
.version_message("Show version information.")
|
||||
.get_matches();
|
||||
@@ -158,6 +226,17 @@ fn main() {
|
||||
},
|
||||
};
|
||||
|
||||
let mut export_manager = ExportManager::new();
|
||||
if let Some(filename) = matches.value_of("export-json") {
|
||||
export_manager.add_exporter(ExportType::Json, filename);
|
||||
}
|
||||
if let Some(filename) = matches.value_of("export-csv") {
|
||||
export_manager.add_exporter(ExportType::Csv, filename);
|
||||
}
|
||||
if let Some(filename) = matches.value_of("export-markdown") {
|
||||
export_manager.add_exporter(ExportType::Markdown, filename);
|
||||
}
|
||||
|
||||
// We default Windows to NoColor if full had been specified.
|
||||
if cfg!(windows) && options.output_style == OutputStyleOption::Full {
|
||||
options.output_style = OutputStyleOption::NoColor;
|
||||
@@ -171,10 +250,39 @@ fn main() {
|
||||
options.failure_action = CmdFailureAction::Ignore;
|
||||
}
|
||||
|
||||
let commands = matches.values_of("command").unwrap().collect();
|
||||
let command_strings = matches.values_of("command").unwrap();
|
||||
|
||||
let commands = if let Some(args) = matches.values_of("parameter-scan") {
|
||||
match parse_parameter_scan_args(args) {
|
||||
Ok((param_name, param_range)) => {
|
||||
let mut commands = vec![];
|
||||
let command_strings = command_strings.collect::<Vec<&str>>();
|
||||
for value in param_range.start..param_range.end {
|
||||
for ref cmd in &command_strings {
|
||||
commands.push(Command::new_parametrized(cmd, param_name, value));
|
||||
}
|
||||
}
|
||||
commands
|
||||
}
|
||||
Err(e) => error(e.description()),
|
||||
}
|
||||
} else {
|
||||
command_strings.map(|c| Command::new(c)).collect()
|
||||
};
|
||||
|
||||
let res = run(&commands, &options);
|
||||
|
||||
if let Err(e) = res {
|
||||
error(e.description());
|
||||
match res {
|
||||
Ok(timing_results) => {
|
||||
write_benchmark_comparison(&timing_results);
|
||||
let ans = export_manager.write_results(timing_results);
|
||||
if let Err(e) = ans {
|
||||
error(&format!(
|
||||
"The following error occured while exporting: {}",
|
||||
e.description()
|
||||
));
|
||||
}
|
||||
}
|
||||
Err(e) => error(e.description()),
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user