Compare commits

..
1 Commits
Author SHA1 Message Date
sharkdp f326201882 Add correct secure key 2018-01-20 14:06:13 +01:00
17 changed files with 204 additions and 758 deletions

No files matched your search

Generated
+78 -108
View File
@@ -21,9 +21,9 @@ name = "atty"
version = "0.2.6"
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.36 (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)",
"winapi 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -31,20 +31,15 @@ name = "bitflags"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cfg-if"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "clap"
version = "2.30.0"
version = "2.29.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)",
"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)",
"strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -57,16 +52,8 @@ 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)",
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "colored"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -76,12 +63,12 @@ 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)",
"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)",
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.2.5 (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)",
"winapi 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -100,17 +87,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "hyperfine"
version = "0.5.0"
version = "0.3.0"
dependencies = [
"ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
"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)",
"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)",
"colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.29.2 (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.36 (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)",
]
[[package]]
@@ -120,8 +104,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
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)",
"parking_lot 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -145,7 +129,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libc"
version = "0.2.37"
version = "0.2.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -153,73 +137,73 @@ 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.36 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num"
version = "0.1.42"
version = "0.1.41"
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-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-bigint 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
"num-complex 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
"num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"num-iter 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
"num-rational 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num-bigint"
version = "0.1.43"
version = "0.1.41"
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)",
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.20 (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.41"
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.1.41 (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-integer"
version = "0.1.36"
version = "0.1.35"
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.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num-iter"
version = "0.1.35"
version = "0.1.34"
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-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num-rational"
version = "0.1.42"
version = "0.1.40"
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-bigint 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
"num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.41 (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.1.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -232,42 +216,31 @@ dependencies = [
[[package]]
name = "parking_lot"
version = "0.5.4"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot_core 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot_core 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "parking_lot_core"
version = "0.2.13"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.20 (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)",
"winapi 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rand"
version = "0.3.22"
version = "0.3.20"
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)",
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rand"
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)",
"winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -285,7 +258,7 @@ dependencies = [
[[package]]
name = "regex"
version = "0.2.6"
version = "0.2.5"
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)",
@@ -320,13 +293,13 @@ name = "statistical"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
"num 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "strsim"
version = "0.7.0"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -335,7 +308,7 @@ 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.36 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -344,7 +317,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.36 (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 +327,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.36 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -405,11 +378,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "winapi"
version = "0.3.4"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-i686-pc-windows-gnu 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi-x86_64-pc-windows-gnu 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -419,12 +392,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata]
@@ -433,10 +406,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"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 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.29.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4151c5790817c7d21bbdc6c3530811f798172915f93258244948b93ba19604a6"
"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 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"
@@ -444,29 +415,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"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.36 (registry+https://github.com/rust-lang/crates.io-index)" = "1e5d97d6708edaa407429faa671b942dc0f2727222fb6b6539bf1db936e4b121"
"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-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 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "cc4083e14b542ea3eb9b5f33ff48bd373a92d78687e74f4cc0a30caeb754f0ca"
"checksum num-bigint 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "bdc1494b5912f088f260b775799468d9b9209ac60885d8186a547a0476289e23"
"checksum num-complex 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "58de7b4bf7cf5dbecb635a5797d489864eadd03b107930cbccf9e0fd7428b47c"
"checksum num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "d1452e8b06e448a07f0e6ebb0bb1d92b8890eea63288c0b627331d53514d0fba"
"checksum num-iter 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)" = "7485fcc84f85b4ecd0ea527b14189281cf27d60e583ae65ebc9c088b13dffe01"
"checksum num-rational 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "0c7cb72a95250d8a370105c828f388932373e0e94414919891a0f945222310fe"
"checksum num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "cacfcab5eb48250ee7d0c7896b51a2c5eec99c1feea5f32025635f5ae4b00070"
"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 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 parking_lot 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3e7f7c9857874e54afeb950eebeae662b1e51a2493666d2ea4c0a5d91dcf0412"
"checksum parking_lot_core 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "9f35048d735bb93dd115a0030498785971aab3234d311fbe273d020084d26bd8"
"checksum rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)" = "512870020642bb8c221bf68baa1b2573da814f6ccfe5c9699b1c303047abe9b1"
"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 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "744554e01ccbd98fff8c457c3b092cd67af62a555a43bfe97ae8a0451f7799fa"
"checksum regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8e931c58b93d86f080c734bfd2bce7dd0079ae2331235818133c8be7f422e20e"
"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
"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 strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694"
"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"
@@ -477,7 +447,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"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"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
"checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3"
"checksum winapi 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b09fb3b6f248ea4cd42c9a65113a847d612e17505d6ebd1f7357ad68a8bf8693"
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
"checksum winapi-i686-pc-windows-gnu 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ec6667f60c23eca65c561e63a13d81b44234c2e38a6b6c959025ee907ec614cc"
"checksum winapi-x86_64-pc-windows-gnu 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "98f12c52b2630cd05d2c3ffd8e008f7f48252c042b4871c72aed9dc733b96668"
+2 -9
View File
@@ -7,21 +7,14 @@ license = "MIT/Apache-2.0"
name = "hyperfine"
readme = "README.md"
repository = "https://github.com/sharkdp/hyperfine"
version = "0.5.0"
version = "0.3.0"
[dependencies]
colored = "1.6"
ansi_term = "0.10"
indicatif = "0.9"
statistical = "0.1"
atty = "0.2.2"
cfg-if = "0.1.2"
[target.'cfg(not(windows))'.dependencies]
libc = "0.2"
[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.4", features = ["processthreadsapi", "minwindef", "winnt"] }
[dependencies.clap]
version = "2"
default-features = false
+9 -30
View File
@@ -1,6 +1,5 @@
# hyperfine
[![Build Status](https://travis-ci.org/sharkdp/hyperfine.svg?branch=master)](https://travis-ci.org/sharkdp/hyperfine)
[![Build status](https://ci.appveyor.com/api/projects/status/pdqq5frgkcj0smrs?svg=true)](https://ci.appveyor.com/project/sharkdp/hyperfine)
[![Version info](https://img.shields.io/crates/v/hyperfine.svg)](https://crates.io/crates/hyperfine)
A command-line benchmarking tool (*inspired by [bench](https://github.com/Gabriel439/bench)*).
@@ -12,13 +11,10 @@ A command-line benchmarking tool (*inspired by [bench](https://github.com/Gabrie
## Features
* Statistical analysis across multiple runs.
* Support for arbitrary shell commands.
* Constant feedback about the benchmark progress and current estimates.
* Warmup runs can be executed before the actual benchmark.
* Cache-clearing commands can be set up before each timing run.
* Statistical outlier detection.
* Cross-platform
* Statistical analysis across multiple runs
* Support for arbitrary shell commands
* Constant feedback about the benchmark progress and current estimates
* Warmup runs can be executed before the actual benchmark
## Usage
@@ -27,25 +23,25 @@ A command-line benchmarking tool (*inspired by [bench](https://github.com/Gabrie
To run a benchmark, you can simply call `hyperfine <command>...`. The argument(s) can be any
shell command. For example:
``` bash
hyperfine 'sleep 0.3'
> hyperfine 'sleep 0.3'
```
Hyperfine will automatically determine the number of runs to perform for each command. By default,
it will perform *at least* 10 benchmarking runs. To change this, you can use the `-m`/`--min-runs`
option:
``` bash
hyperfine --min-runs 5 'sleep 0.2' 'sleep 3.2'
> hyperfine --min-runs 5 'sleep 0.2' 'sleep 3.2'
```
### I/O-heavy programs
If the program execution time is limited by disk I/O, the benchmarking results can be heavily
influenced by disk caches and whether they are cold or warm.
influence by disk caches and whether they are cold or warm.
If you want to run the benchmark on a warm cache, you can use the `-w`/`--warmup` option to perform
a certain number of program executions before the actual benchmark:
``` bash
hyperfine --warmup 3 'grep -R TODO *'
> hyperfine --warmup 3 'grep -R TODO *'
```
Conversely, if you want to run the benchmark for a cold cache, you can use the `-p`/`--prepare`
@@ -54,7 +50,7 @@ on Linux, you can run
``` bash
sync; echo 3 | sudo tee /proc/sys/vm/drop_caches
```
To use this specific command with Hyperfine, call `sudo -v` to temporarily gain sudo permissions
To use this specific command with Hyperfine, call `sudo echo` to temporarily gain sudo permissions
and then call:
``` bash
hyperfine --prepare 'sync; echo 3 | sudo tee /proc/sys/vm/drop_caches' 'grep -R TODO *'
@@ -74,23 +70,6 @@ On Arch Linux, hyperfine can be installed [from the AUR](https://aur.archlinux.o
yaourt -S hyperfine
```
### Ubuntu
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
```
### Void Linux
Hyperfine can be installed via xbps
```
xbps-install -S hyperfine
```
## Origin of the name
The name *hyperfine* was chosen in reference to the hyperfine levels of caesium 133 which play a crucial role in the
-36
View File
@@ -1,36 +0,0 @@
# Source: https://github.com/starkat99/appveyor-rust/
environment:
global:
PROJECT_NAME: hyperfine
matrix:
# Stable channel
- TARGET: i686-pc-windows-gnu
CHANNEL: stable
- TARGET: i686-pc-windows-msvc
CHANNEL: stable
- TARGET: x86_64-pc-windows-gnu
CHANNEL: stable
- TARGET: x86_64-pc-windows-msvc
CHANNEL: stable
# Install Rust and Cargo
# (Based on from https://github.com/rust-lang/libc/blob/master/appveyor.yml)
install:
- curl -sSf -o rustup-init.exe https://win.rustup.rs
- rustup-init.exe --default-host %TARGET% --default-toolchain %CHANNEL% -y
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
- rustc -Vv
- cargo -V
# 'cargo test' takes care of building for us, so disable Appveyor's build stage. This prevents
# the "directory does not contain a project or solution file" error.
# source: https://github.com/starkat99/appveyor-rust/blob/master/appveyor.yml#L113
build: false
# Equivalent to Travis' `script` phase
test_script:
- cargo build --verbose
- cargo run -- --help
- cargo run -- "echo test"
- cargo test
+59 -79
View File
@@ -1,19 +1,17 @@
use std::io;
use std::process::{Command, Stdio};
use std::time::Instant;
use colored::*;
use ansi_term::Colour::{Blue, Cyan, Green, Purple, White, Yellow};
use statistical::{mean, standard_deviation};
use hyperfine::internal::{get_progress_bar, max, min, CmdFailureAction, HyperfineOptions,
OutputStyleOption, Second, MIN_EXECUTION_TIME};
use hyperfine::warnings::Warnings;
use hyperfine::internal::{get_progress_bar, max, min, CmdFailureAction, HyperfineOptions, Second,
Warnings, MIN_EXECUTION_TIME};
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::cputime::{cpu_time_interval, get_cpu_times};
/// Results from timing a single shell command
#[derive(Debug, Default, Copy, Clone)]
#[derive(Debug, Copy, Clone)]
pub struct TimingResult {
/// Wall clock time
pub time_real: Second,
@@ -40,16 +38,21 @@ pub fn time_shell_command(
failure_action: CmdFailureAction,
shell_spawning_time: Option<TimingResult>,
) -> io::Result<(TimingResult, bool)> {
let wallclock_timer = WallClockTimer::start();
let start = Instant::now();
let start_cpu = get_cpu_times();
let result = execute_and_time(shell_cmd)?;
let status = Command::new("sh")
.arg("-c")
.arg(shell_cmd)
.stdin(Stdio::null())
.stdout(Stdio::null())
.stderr(Stdio::null())
.status()?;
let mut time_user = result.user_time;
let mut time_system = result.system_time;
let end_cpu = get_cpu_times();
let duration = start.elapsed();
let mut time_real = wallclock_timer.stop();
if failure_action == CmdFailureAction::RaiseError && !result.status.success() {
if failure_action == CmdFailureAction::RaiseError && !status.success() {
return Err(io::Error::new(
io::ErrorKind::Other,
"Command terminated with non-zero exit code. \
@@ -57,11 +60,19 @@ pub fn time_shell_command(
));
}
// Real time
let mut time_real = duration.as_secs() as f64 + (duration.subsec_nanos() as f64) * 1e-9;
// User and system time
let cpu_interval = cpu_time_interval(&start_cpu, &end_cpu);
let mut time_user = cpu_interval.user;
let mut time_system = cpu_interval.system;
// Correct for shell spawning time
if let Some(spawning_time) = shell_spawning_time {
time_real = subtract_shell_spawning_time(time_real, spawning_time.time_real);
time_user = subtract_shell_spawning_time(time_user, spawning_time.time_user);
time_system = subtract_shell_spawning_time(time_system, spawning_time.time_system);
time_user = subtract_shell_spawning_time(cpu_interval.user, spawning_time.time_user);
time_system = subtract_shell_spawning_time(cpu_interval.system, spawning_time.time_system);
}
Ok((
@@ -70,14 +81,14 @@ pub fn time_shell_command(
time_user,
time_system,
},
result.status.success(),
status.success(),
))
}
/// Measure the average shell spawning time
pub fn mean_shell_spawning_time(style: &OutputStyleOption) -> io::Result<TimingResult> {
pub fn mean_shell_spawning_time() -> io::Result<TimingResult> {
const COUNT: u64 = 200;
let progress_bar = get_progress_bar(COUNT, "Measuring shell spawning time", style);
let progress_bar = get_progress_bar(COUNT, "Measuring shell spawning time");
let mut times_real: Vec<Second> = vec![];
let mut times_user: Vec<Second> = vec![];
@@ -112,24 +123,6 @@ 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);
if res.is_err() {
return Err(io::Error::new(
io::ErrorKind::Other,
"The preparation command terminated with a non-zero exit code. \
Append ' || true' to the command if you are sure that this can be ignored.",
));
}
return res.map(|r| r.0);
}
Ok(TimingResult {
..Default::default()
})
}
/// Run the benchmark for a single shell command
pub fn run_benchmark(
num: usize,
@@ -139,8 +132,8 @@ pub fn run_benchmark(
) -> io::Result<()> {
println!(
"{}{}: {}",
"Benchmark #".bold(),
(num + 1).to_string().bold(),
White.bold().paint("Benchmark #"),
White.bold().paint((num + 1).to_string()),
cmd
);
println!();
@@ -152,11 +145,7 @@ pub fn run_benchmark(
// Warmup phase
if options.warmup_count > 0 {
let progress_bar = get_progress_bar(
options.warmup_count,
"Performing warmup runs",
&options.output_style,
);
let progress_bar = get_progress_bar(options.warmup_count, "Performing warmup runs");
for _ in 0..options.warmup_count {
let _ = time_shell_command(cmd, options.failure_action, None)?;
@@ -166,23 +155,23 @@ pub fn run_benchmark(
}
// Set up progress bar (and spinner for initial measurement)
let progress_bar = get_progress_bar(
options.min_runs,
"Initial time measurement",
&options.output_style,
);
let progress_bar = get_progress_bar(options.min_runs, "Initial time measurement");
// Run init / cleanup command
let prepare_res = run_preparation_command(&options.preparation_command)?;
let run_preparation_command = || {
if let Some(ref preparation_command) = options.preparation_command {
let _ = time_shell_command(preparation_command, options.failure_action, None);
}
};
run_preparation_command();
// Initial timing run
let (res, success) =
time_shell_command(cmd, options.failure_action, Some(shell_spawning_time))?;
// Determine number of benchmark runs
let runs_in_min_time = (options.min_time_sec
/ (res.time_real + prepare_res.time_real + shell_spawning_time.time_real))
as u64;
let runs_in_min_time =
(options.min_time_sec / (res.time_real + shell_spawning_time.time_real)) as u64;
let count = if runs_in_min_time >= options.min_runs {
runs_in_min_time
@@ -204,11 +193,11 @@ pub fn run_benchmark(
// Gather statistics
for _ in 0..count_remaining {
run_preparation_command(&options.preparation_command)?;
run_preparation_command();
let msg = {
let mean = format_duration(mean(&times_real), None);
format!("Current estimate: {}", mean.to_string().green())
format!("Current estimate: {}", Green.paint(mean))
};
progress_bar.set_message(&msg);
@@ -244,22 +233,22 @@ pub fn run_benchmark(
let system_str = format_duration(system_mean, Some(user_unit));
println!(
" Time ({} ± {}): {:>8} ± {:>8} [User: {}, System: {}]",
"mean".green().bold(),
"σ".green(),
mean_str.green().bold(),
stddev_str.green(),
user_str.blue(),
system_str.blue()
" Time ({} ± {}): {} ± {} [User: {}, System: {}]",
Green.bold().paint("mean"),
Green.paint("σ"),
Green.bold().paint(mean_str),
Green.paint(stddev_str),
Blue.paint(user_str),
Blue.paint(system_str)
);
println!(" ");
println!(
" Range ({} … {}): {:>8} … {:>8}",
"min".cyan(),
"max".purple(),
min_str.cyan(),
max_str.purple()
" Range ({} … {}): {} … {}",
Cyan.paint("min"),
Purple.paint("max"),
Cyan.paint(min_str),
Purple.paint(max_str)
);
// Warnings
@@ -275,19 +264,10 @@ pub fn run_benchmark(
warnings.push(Warnings::NonZeroExitCode);
}
// Run outlier detection
let scores = modified_zscores(&times_real);
if scores[0] > OUTLIER_THRESHOLD {
warnings.push(Warnings::SlowInitialRun(times_real[0]));
} else if scores.iter().any(|&s| s > OUTLIER_THRESHOLD) {
warnings.push(Warnings::OutliersDetected);
}
if !warnings.is_empty() {
eprintln!(" ");
for warning in &warnings {
eprintln!(" {}: {}", "Warning".yellow(), warning);
eprintln!(" {}: {}", Yellow.paint("Warning"), warning);
}
}
@@ -1,46 +1,28 @@
#![cfg(not(windows))]
use libc::{getrusage, rusage, RUSAGE_CHILDREN};
use std::mem;
use super::internal::{CPUInterval, CPUTimes};
use hyperfine::timer::{TimerStart, TimerStop};
use hyperfine::internal::Second;
use std::mem;
use std::process::Child;
#[derive(Debug, Copy, Clone)]
pub struct CPUTimes {
/// Total amount of time spent executing in user mode
user_usec: i64,
pub fn get_cpu_timer() -> Box<TimerStop<Result = (Second, Second)>> {
Box::new(CPUTimer::start())
/// Total amount of time spent executing in kernel mode
system_usec: i64,
}
struct CPUTimer {
start_cpu: CPUTimes,
}
#[derive(Debug, Copy, Clone)]
pub struct CPUInterval {
/// Total amount of time spent executing in user mode
pub user: Second,
impl TimerStart for CPUTimer {
fn start() -> Self {
CPUTimer {
start_cpu: get_cpu_times(),
}
}
fn start_for_process(_: &Child) -> Self {
Self::start()
}
}
impl TimerStop for CPUTimer {
type Result = (Second, Second);
fn stop(&self) -> Self::Result {
let end_cpu = get_cpu_times();
let cpu_interval = cpu_time_interval(&self.start_cpu, &end_cpu);
(cpu_interval.user, cpu_interval.system)
}
/// Total amount of time spent executing in kernel mode
pub system: Second,
}
/// Read CPU execution times ('user' and 'system')
fn get_cpu_times() -> CPUTimes {
use libc::{getrusage, rusage, RUSAGE_CHILDREN};
pub fn get_cpu_times() -> CPUTimes {
let result: rusage = unsafe {
let mut buf = mem::zeroed();
let success = getrusage(RUSAGE_CHILDREN, &mut buf);
@@ -59,7 +41,7 @@ fn get_cpu_times() -> CPUTimes {
}
/// Compute the time intervals in between two `CPUTimes` snapshots
fn cpu_time_interval(start: &CPUTimes, end: &CPUTimes) -> CPUInterval {
pub fn cpu_time_interval(start: &CPUTimes, end: &CPUTimes) -> CPUInterval {
CPUInterval {
user: ((end.user_usec - start.user_usec) as f64) * 1e-6,
system: ((end.system_usec - start.system_usec) as f64) * 1e-6,
+6 -6
View File
@@ -17,9 +17,9 @@ pub fn format_duration(duration: Second, unit: Option<Unit>) -> String {
/// Like `format_duration`, but returns the target unit as well.
pub fn format_duration_unit(duration: Second, unit: Option<Unit>) -> (String, Unit) {
if (duration < 1.0 && unit.is_none()) || unit == Some(Unit::MilliSecond) {
(format!("{:.1} ms", duration * 1e3), Unit::MilliSecond)
(format!("{:5.1} ms", duration * 1e3), Unit::MilliSecond)
} else {
(format!("{:.3} s", duration), Unit::Second)
(format!("{:6.3} s", duration), Unit::Second)
}
}
@@ -27,12 +27,12 @@ pub fn format_duration_unit(duration: Second, unit: Option<Unit>) -> (String, Un
fn test_format_duration_unit_basic() {
let (out_str, out_unit) = format_duration_unit(1.3, None);
assert_eq!("1.300 s", out_str);
assert_eq!(" 1.300 s", out_str);
assert_eq!(Unit::Second, out_unit);
let (out_str, out_unit) = format_duration_unit(1.0, None);
assert_eq!("1.000 s", out_str);
assert_eq!(" 1.000 s", out_str);
assert_eq!(Unit::Second, out_unit);
let (out_str, out_unit) = format_duration_unit(0.999, None);
@@ -42,7 +42,7 @@ fn test_format_duration_unit_basic() {
let (out_str, out_unit) = format_duration_unit(0.0, None);
assert_eq!("0.0 ms", out_str);
assert_eq!(" 0.0 ms", out_str);
assert_eq!(Unit::MilliSecond, out_unit);
let (out_str, out_unit) = format_duration_unit(1000.0, None);
@@ -55,7 +55,7 @@ fn test_format_duration_unit_basic() {
fn test_format_duration_unit_with_unit() {
let (out_str, out_unit) = format_duration_unit(1.3, Some(Unit::Second));
assert_eq!("1.300 s", out_str);
assert_eq!(" 1.300 s", out_str);
assert_eq!(Unit::Second, out_unit);
let (out_str, out_unit) = format_duration_unit(1.3, Some(Unit::MilliSecond));
+26 -28
View File
@@ -1,3 +1,5 @@
use std::fmt;
use indicatif::{ProgressBar, ProgressStyle};
/// Type alias for unit of time
@@ -16,19 +18,6 @@ pub enum CmdFailureAction {
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
@@ -45,9 +34,6 @@ pub struct HyperfineOptions {
/// 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 {
@@ -58,24 +44,17 @@ impl Default for HyperfineOptions {
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 {
OutputStyleOption::Basic => ProgressStyle::default_bar(),
_ => ProgressStyle::default_spinner()
.tick_chars("⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏")
.template(" {spinner} {msg:<30} {wide_bar} ETA {eta_precise}"),
};
pub fn get_progress_bar(length: u64, msg: &str) -> ProgressBar {
let progressbar_style = ProgressStyle::default_spinner()
.tick_chars("⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏")
.template(" {spinner} {msg:<30} {wide_bar} ETA {eta_precise}");
let progress_bar = match *option {
OutputStyleOption::Basic => ProgressBar::hidden(),
_ => ProgressBar::new(length),
};
let progress_bar = ProgressBar::new(length);
progress_bar.set_style(progressbar_style.clone());
progress_bar.enable_steady_tick(80);
progress_bar.set_message(msg);
@@ -83,6 +62,25 @@ pub fn get_progress_bar(length: u64, msg: &str, option: &OutputStyleOption) -> P
progress_bar
}
/// Possible benchmark warnings
pub enum Warnings {
FastExecutionTime,
NonZeroExitCode,
}
impl fmt::Display for Warnings {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
Warnings::FastExecutionTime => write!(
f,
"Command took less than {:.0} ms to complete. Results might be inaccurate.",
MIN_EXECUTION_TIME * 1e3
),
Warnings::NonZeroExitCode => write!(f, "Ignoring non-zero exit code."),
}
}
}
/// A max function for f64's without NaNs
pub fn max(vals: &[f64]) -> f64 {
*vals.iter()
+1 -4
View File
@@ -1,7 +1,4 @@
pub mod benchmark;
pub mod format;
pub mod internal;
pub mod outlier_detection;
pub mod warnings;
pub mod timer;
pub mod shell;
pub mod cputime;
-102
View File
@@ -1,102 +0,0 @@
/// A module for statistical outlier detection.
///
/// References:
/// - Boris Iglewicz and David Hoaglin (1993), "Volume 16: How to Detect and Handle Outliers",
/// The ASQC Basic References in Quality Control: Statistical Techniques, Edward F. Mykytka,
/// Ph.D., Editor.
use statistical::median;
/// Minimum modified Z-score for a datapoint to be an outlier. Here, 1.4826 is a factor that
/// converts the MAD to an estimator for the standard deviation. The second factor is the number
/// of standard deviations.
pub const OUTLIER_THRESHOLD: f64 = 1.4826 * 10.0;
/// Compute modifized Z-scores for a given sample. A (unmodified) Z-score is defined by
/// `(x_i - x_mean)/x_stddev` whereas the modified Z-score is defined by `|x_i - x_median|/MAD`
/// where MAD is the median average deviation.
///
/// References:
/// - <https://en.wikipedia.org/wiki/Median_absolute_deviation>
pub fn modified_zscores(xs: &[f64]) -> Vec<f64> {
assert!(!xs.is_empty());
// Compute sample median:
let x_median = median(xs);
// Compute the absolute deviations from the median:
let deviations: Vec<f64> = xs.iter().map(|x| (x - x_median).abs()).collect();
// Compute median absolute deviation:
let mad = median(&deviations);
// Compute modified Z-scores (x_i - x_median) / MAD
xs.iter().map(|&x| (x - x_median) / mad).collect()
}
/// Return the number of outliers in a given sample. Outliers are defined as data points with a
/// modified Z-score that is larger than `OUTLIER_THRESHOLD`.
#[cfg(test)]
pub fn num_outliers(xs: &[f64]) -> usize {
if xs.is_empty() {
return 0;
}
let scores = modified_zscores(xs);
scores
.iter()
.filter(|&&s| s.abs() > OUTLIER_THRESHOLD)
.count()
}
#[test]
fn test_detect_outliers() {
// Should not detect outliers in small samples
assert_eq!(0, num_outliers(&[]));
assert_eq!(0, num_outliers(&[50.0]));
assert_eq!(0, num_outliers(&[1000.0, 0.0]));
// Should not detect outliers in low-variance samples
let xs = [-0.2, 0.0, 0.2];
assert_eq!(0, num_outliers(&xs));
// Should detect a single outlier
let xs = [-0.2, 0.0, 0.2, 4.0];
assert_eq!(1, num_outliers(&xs));
// Should detect a single outlier
let xs = [0.5, 0.30, 0.29, 0.31, 0.30];
assert_eq!(1, num_outliers(&xs));
// Should detect no outliers in sample drawn from normal distribution
let xs = [
2.33269488,
1.42195907,
-0.57527698,
-0.31293437,
2.2948158,
0.75813273,
-1.0712388,
-0.96394741,
-1.15897446,
1.10976285,
];
assert_eq!(0, num_outliers(&xs));
// Should detect two outliers that were manually added
let xs = [
2.33269488,
1.42195907,
-0.57527698,
-0.31293437,
2.2948158,
0.75813273,
-1.0712388,
-0.96394741,
-1.15897446,
1.10976285,
20.0,
-500.0,
];
assert_eq!(2, num_outliers(&xs));
}
-73
View File
@@ -1,73 +0,0 @@
use std;
use std::io;
use std::process::{Command, ExitStatus, Stdio};
use hyperfine::timer::get_cpu_timer;
/// Used to indicate the result of running a command
#[derive(Debug, Copy, Clone)]
pub struct ExecuteResult {
/// The amount of user time the process used
pub user_time: f64,
/// The amount of cpu time the process used
pub system_time: f64,
/// The exit status of the process
pub status: ExitStatus,
}
/// Execute the given command and return a timing summary
#[cfg(windows)]
pub fn execute_and_time(command: &str) -> io::Result<ExecuteResult> {
let mut child = run_shell_command(command)?;
let cpu_timer = get_cpu_timer(&child);
let status = child.wait()?;
let (user_time, system_time) = cpu_timer.stop();
Ok(ExecuteResult {
user_time,
system_time,
status,
})
}
/// Execute the given command and return a timing summary
#[cfg(not(windows))]
pub fn execute_and_time(command: &str) -> io::Result<ExecuteResult> {
let cpu_timer = get_cpu_timer();
let status = run_shell_command(command)?;
let (user_time, system_time) = cpu_timer.stop();
Ok(ExecuteResult {
user_time,
system_time,
status,
})
}
/// Run a standard shell command
#[cfg(not(windows))]
fn run_shell_command(command: &str) -> io::Result<std::process::ExitStatus> {
Command::new("sh")
.arg("-c")
.arg(command)
.stdin(Stdio::null())
.stdout(Stdio::null())
.stderr(Stdio::null())
.status()
}
/// Run a Windows shell command using cmd.exe
#[cfg(windows)]
fn run_shell_command(command: &str) -> io::Result<std::process::Child> {
Command::new("cmd")
.arg("/C")
.arg(command)
.stdin(Stdio::null())
.stdout(Stdio::null())
.stderr(Stdio::null())
.spawn()
}
-19
View File
@@ -1,19 +0,0 @@
use hyperfine::internal::Second;
#[derive(Debug, Copy, Clone)]
pub struct CPUTimes {
/// Total amount of time spent executing in user mode
pub user_usec: i64,
/// Total amount of time spent executing in kernel mode
pub system_usec: i64,
}
#[derive(Debug, Copy, Clone)]
pub struct CPUInterval {
/// Total amount of time spent executing in user mode
pub user: Second,
/// Total amount of time spent executing in kernel mode
pub system: Second,
}
-26
View File
@@ -1,26 +0,0 @@
mod internal;
pub mod wallclocktimer;
cfg_if! {
if #[cfg(windows)] {
mod windows_timer;
pub use self::windows_timer::get_cpu_timer;
} else {
mod unix_timer;
pub use self::unix_timer::get_cpu_timer;
}
}
use std::process::Child;
/// Defines start functionality of a timer.
pub trait TimerStart {
fn start() -> Self;
fn start_for_process(process: &Child) -> Self;
}
/// Defines stop functionality of a timer.
pub trait TimerStop {
type Result;
fn stop(&self) -> Self::Result;
}
-30
View File
@@ -1,30 +0,0 @@
use std::process::Child;
use std::time::Instant;
use hyperfine::internal::Second;
use hyperfine::timer::{TimerStart, TimerStop};
pub struct WallClockTimer {
start: Instant,
}
impl TimerStart for WallClockTimer {
fn start() -> WallClockTimer {
WallClockTimer {
start: Instant::now(),
}
}
fn start_for_process(_: &Child) -> Self {
Self::start()
}
}
impl TimerStop for WallClockTimer {
type Result = Second;
fn stop(&self) -> Second {
let duration = self.start.elapsed();
duration.as_secs() as f64 + (duration.subsec_nanos() as f64) * 1e-9
}
}
-74
View File
@@ -1,74 +0,0 @@
#![cfg(windows)]
use super::internal::CPUTimes;
use hyperfine::internal::Second;
use hyperfine::timer::{TimerStart, TimerStop};
use winapi::um::processthreadsapi::GetProcessTimes;
use winapi::um::winnt::HANDLE;
use std::mem;
use std::os::windows::io::{AsRawHandle, RawHandle};
use std::process::Child;
const HUNDRED_NS_PER_MS: i64 = 10;
pub fn get_cpu_timer(process: &Child) -> Box<TimerStop<Result=(Second,Second)>> {
Box::new(CPUTimer::start_for_process(process))
}
struct CPUTimer {
handle: RawHandle,
}
impl TimerStart for CPUTimer {
fn start() -> Self {
panic!()
}
fn start_for_process(process: &Child) -> Self {
CPUTimer { handle: process.as_raw_handle() }
}
}
impl TimerStop for CPUTimer {
type Result = (Second, Second);
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)
}
}
/// Read CPU execution times (dummy for now)
fn get_cpu_times(handle: RawHandle) -> CPUTimes {
let (user_usec, system_usec) = unsafe {
let mut _ctime = mem::zeroed();
let mut _etime = mem::zeroed();
let mut kernel_time = mem::zeroed();
let mut user_time = mem::zeroed();
let res = GetProcessTimes(
handle as HANDLE,
&mut _ctime,
&mut _etime,
&mut kernel_time,
&mut user_time,
);
// 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;
(user, kernel)
} else {
(0, 0)
}
};
CPUTimes {
user_usec, system_usec,
}
}
-40
View File
@@ -1,40 +0,0 @@
use std::fmt;
use hyperfine::internal::{Second, MIN_EXECUTION_TIME};
use hyperfine::format::format_duration;
/// A list of all possible warnings
pub enum Warnings {
FastExecutionTime,
NonZeroExitCode,
SlowInitialRun(Second),
OutliersDetected,
}
impl fmt::Display for Warnings {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
Warnings::FastExecutionTime => write!(
f,
"Command took less than {:.0} ms to complete. Results might be inaccurate.",
MIN_EXECUTION_TIME * 1e3
),
Warnings::NonZeroExitCode => write!(f, "Ignoring non-zero exit code."),
Warnings::SlowInitialRun(t_first) => write!(
f,
"The first benchmarking run for this command was significantly slower than the \
rest ({}). This could be caused by (filesystem) caches that were not filled until \
after the first run. You should consider using the '--warmup' option to fill \
those caches before the actual benchmark. Alternatively, use the '--prepare' \
option to clear the caches before each timing run.",
format_duration(t_first, None)
),
Warnings::OutliersDetected => write!(
f,
"Statistical outliers were detected. Consider re-running this benchmark on a quiet \
PC without any interferences from other programs. It might help to use the \
'--warmup' or '--prepare' options."
),
}
}
}
+7 -60
View File
@@ -1,22 +1,10 @@
extern crate atty;
#[macro_use]
extern crate cfg_if;
extern crate ansi_term;
#[macro_use]
extern crate clap;
extern crate colored;
extern crate indicatif;
extern crate libc;
extern crate statistical;
cfg_if! {
if #[cfg(windows)] {
extern crate winapi;
} else {
extern crate libc;
}
}
#[cfg(test)]
#[macro_use]
extern crate approx;
@@ -25,24 +13,23 @@ use std::cmp;
use std::error::Error;
use std::io;
use atty::Stream;
use colored::*;
use ansi_term::Colour::Red;
use clap::{App, AppSettings, Arg};
mod hyperfine;
use hyperfine::internal::{CmdFailureAction, HyperfineOptions, OutputStyleOption};
use hyperfine::internal::{CmdFailureAction, HyperfineOptions};
use hyperfine::benchmark::{mean_shell_spawning_time, run_benchmark};
/// Print error message to stderr and terminate
pub fn error(message: &str) -> ! {
eprintln!("{} {}", "Error:".red(), message);
eprintln!("{}: {}", Red.paint("Error"), message);
std::process::exit(1);
}
/// Runs the benchmark for the given commands
fn run(commands: &Vec<&str>, options: &HyperfineOptions) -> io::Result<()> {
let shell_spawning_time = mean_shell_spawning_time(&options.output_style)?;
let shell_spawning_time = mean_shell_spawning_time()?;
// Run the benchmarks
for (num, cmd) in commands.iter().enumerate() {
@@ -56,15 +43,9 @@ fn main() {
// Process command line options
let mut options = HyperfineOptions::default();
let clap_color_setting = if atty::is(Stream::Stdout) {
AppSettings::ColoredHelp
} else {
AppSettings::ColorNever
};
let matches = App::new("hyperfine")
.version(crate_version!())
.setting(clap_color_setting)
.setting(AppSettings::ColoredHelp)
.setting(AppSettings::DeriveDisplayOrder)
.setting(AppSettings::UnifiedHelpMessage)
.max_term_width(90)
@@ -109,20 +90,6 @@ fn main() {
clearing disk caches, for example.",
),
)
.arg(
Arg::with_name("style")
.long("style")
.short("s")
.takes_value(true)
.value_name("TYPE")
.possible_values(&["auto", "basic", "full", "nocolor"])
.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.",
),
)
.arg(
Arg::with_name("ignore-failure")
.long("ignore-failure")
@@ -147,26 +114,6 @@ fn main() {
options.preparation_command = matches.value_of("prepare").map(String::from);
options.output_style = match matches.value_of("style") {
Some("full") => OutputStyleOption::Full,
Some("basic") => OutputStyleOption::Basic,
Some("nocolor") => OutputStyleOption::NoColor,
_ => if atty::is(Stream::Stdout) {
OutputStyleOption::Full
} else {
OutputStyleOption::Basic
},
};
// We default Windows to NoColor if full had been specified.
if cfg!(windows) && options.output_style == OutputStyleOption::Full {
options.output_style = OutputStyleOption::NoColor;
}
if options.output_style != OutputStyleOption::Full {
colored::control::set_override(false);
}
if matches.is_present("ignore-failure") {
options.failure_action = CmdFailureAction::Ignore;
}