Compare commits

..
1 Commits
Author SHA1 Message Date
sharkdp 148460b950 Fix nan/inf output for very fast commands
closes #319
2020-10-16 10:50:52 +02:00
10 changed files with 91 additions and 212 deletions

No files matched your search

+12 -17
View File
@@ -1,5 +1,6 @@
language: rust
jobs:
cache: cargo
matrix:
include:
# Stable channel.
- os: linux
@@ -17,17 +18,6 @@ jobs:
- os: osx
rust: stable
env: TARGET=x86_64-apple-darwin
- os: linux
rust: stable
env:
- TARGET=arm-unknown-linux-gnueabihf
- CC_arm_unknown_linux_gnueabihf=/usr/bin/arm-linux-gnueabihf-gcc-4.8
- CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc-4.8
- os: linux
rust: stable
env:
- TARGET=arm-unknown-linux-musleabihf
- CARGO_TARGET_ARM_UNKNOWN_LINUX_MUSLEABIHF_LINKER=arm-linux-gnueabihf-gcc-4.8
# Minimum Rust supported channel.
- os: linux
@@ -46,8 +36,13 @@ jobs:
rust: 1.43.0
env: TARGET=x86_64-apple-darwin
before_install:
- ci/before_install.bash
addons:
apt:
packages:
# needed for i686-unknown-linux-gnu target
- gcc-multilib
# needed to build deb packages
- fakeroot
env:
global:
@@ -64,19 +59,19 @@ install:
script:
# Incorporate TARGET env var to the build and test process
- cargo build --target $TARGET --verbose
- '[[ $TARGET == arm-unknown-linux-* ]] || cargo test --target $TARGET --verbose'
- cargo test --target $TARGET --verbose
before_deploy:
- bash ci/before_deploy.bash
deploy:
provider: releases
# NOTE updating the `token.secure`
# NOTE updating the `api_key.secure`
# - go to: https://github.com/settings/tokens/new
# - generate new token using `public_repo` scope
# - encrypt it using: `travis encrypt API_KEY_HERE`
# - paste the output below
token:
api_key:
secure: "U9QfCOQkeozaDNrTV6i2vRocX2puB5p1WSN+w9t/1j33rAtXx6ZhFx67A8nl0+dQ9nvPu/RIsFWXrYzfHQskL1WulKNHm0S5otN+747dEzbSIfMNi1UfysyCiM1SNPq+FX3qOkva83+Fe2Lyd1g4gQObceE4xsgfplfzdm+ebIa6CrfKOypToEuetzP/r8V0WpW4Cp8ojQwvsL1nfHjr1gmvmr443Gr9Yvgq9SS/NAHldrpaJr8mD26W/7jbHdm3lvrNwqLbthYDUTPZsO+2B44h+T/tuhVYbur4fel1KMo4mkIwZwsSKvJbf3Q6Vdcc9dZM+niZU78UGLt0JNEMQNqQLPGYqh+TlFR2B++lcYlybT3LcUaSkt0YIX7C4DAbMLS6sl5Fq2pRNuM/eY2BWdHf0I+K19PDxUEliUifsfSQ3rbfl52aKKLcJa0WPyDJt0qldElagxOaTIk/jn1kKkdkQu9M4gVzKXImIauRQih3CLER7th8ADMxW5Plgq8fvffJBTKlubUznKrGeeR3Mjm8DsRjhkIvFO0Doqmki4sd5zE/BOFI5a/SHg73ms+bLXLuKFK+YzIlHszCHolzkAT44aq7+LEudk8jt+QVtBEocCN/4ew4Q9Qh2tcn22+hU3Aw88lO95PsbZzTzoFtX4X89Sl1fGtpkHFZvvL4ZT0="
# for uploading multiple files
file_glob: true
+6 -23
View File
@@ -2,22 +2,7 @@
## Features
## Changes
## Bugfixes
## Other
## Packaging
# v1.11.0
## Features
- The `-L`/`--parameter-list` option can now be specified multiple times to
evaluate all possible combinations of the listed parameters:
- The `-L`/`--parameter-list` option can now be specified multiple times to evaluate all possible combinations of the listed parameters:
``` bash
hyperfine -L number 1,2 -L letter a,b,c \
@@ -33,20 +18,18 @@
## Changes
- When parameters are used with `--parameter-list` or `--parameter-scan`, the JSON export format
now contains a dictionary `parameters` instead of a single key `parameter`. See #253, #318.
- The `plot_parametrized.py` script now infers the parameter name, and its `--parameter-name`
argument has been deprecated. See #253, #318.
- When parameters are used with `--parameter-list` or `--parameter-scan`, the JSON export format now contains a dictionary `parameters` instead of a single key `parameter`. See #253, #318.
- The `plot_parametrized.py` script now infers the parameter name, and its `--parameter-name` argument has been deprecated. See #253, #318.
## Bugfixes
- Fix a bug in the outlier detection which would only detect "slow outliers" but not the fast
ones (runs that are much faster than the rest of the benchmarking runs), see #329
- Fix a bug in the outlier detection which would only detect "slow outliers" but not the fast ones (runs that are much faster than the rest of the benchmarking runs), see #329
- Better error messages for very fast commands that would lead to inf/nan results in the relative
speed comparison, see #319
- Show error message if `--warmup` or `--*runs` arguments can not be parsed, see #337
- Keep output colorized when the output is not interactive and `--style=full` or `--style=color` is used.
## Other
## Packaging
# v1.10.0
Generated
+53 -53
View File
@@ -37,9 +37,9 @@ checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
[[package]]
name = "autocfg"
version = "1.0.1"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"
[[package]]
name = "bitflags"
@@ -109,9 +109,9 @@ dependencies = [
[[package]]
name = "console"
version = "0.12.0"
version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0b1aacfaffdbff75be81c15a399b4bedf78aaefe840e8af1d299ac2ade885d2"
checksum = "8c0994e656bba7b922d8dd1245db90672ffb701e684e45be58f20719d69abc5a"
dependencies = [
"encode_unicode",
"lazy_static",
@@ -160,9 +160,9 @@ checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
[[package]]
name = "getrandom"
version = "0.1.15"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6"
checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
dependencies = [
"cfg-if",
"libc",
@@ -171,16 +171,16 @@ dependencies = [
[[package]]
name = "hermit-abi"
version = "0.1.17"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8"
checksum = "91780f809e750b0a89f5544be56617ff6b1227ee485bcb06ebe10cdf89bd3b71"
dependencies = [
"libc",
]
[[package]]
name = "hyperfine"
version = "1.11.0"
version = "1.10.0"
dependencies = [
"approx",
"atty",
@@ -213,9 +213,9 @@ dependencies = [
[[package]]
name = "itoa"
version = "0.4.6"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6"
checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e"
[[package]]
name = "lazy_static"
@@ -225,9 +225,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.79"
version = "0.2.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2448f6066e80e3bfc792e9c98bf705b4b0fc6e8ef5b43e5889aff0eaa9c58743"
checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235"
[[package]]
name = "memchr"
@@ -255,7 +255,7 @@ version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304"
dependencies = [
"autocfg 1.0.1",
"autocfg 1.0.0",
"num-integer",
"num-traits",
]
@@ -266,27 +266,27 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95"
dependencies = [
"autocfg 1.0.1",
"autocfg 1.0.0",
"num-traits",
]
[[package]]
name = "num-integer"
version = "0.1.43"
version = "0.1.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b"
checksum = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba"
dependencies = [
"autocfg 1.0.1",
"autocfg 1.0.0",
"num-traits",
]
[[package]]
name = "num-iter"
version = "0.1.41"
version = "0.1.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a6e6b7c748f995c4c29c5f5ae0248536e04a5739927c74ec0fa564805094b9f"
checksum = "dfb0800a0291891dd9f4fe7bd9c19384f98f7fbe0cd0f39a2c6b88b9868bbc00"
dependencies = [
"autocfg 1.0.1",
"autocfg 1.0.0",
"num-integer",
"num-traits",
]
@@ -297,7 +297,7 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef"
dependencies = [
"autocfg 1.0.1",
"autocfg 1.0.0",
"num-bigint",
"num-integer",
"num-traits",
@@ -305,11 +305,11 @@ dependencies = [
[[package]]
name = "num-traits"
version = "0.2.12"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611"
checksum = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096"
dependencies = [
"autocfg 1.0.1",
"autocfg 1.0.0",
]
[[package]]
@@ -320,24 +320,24 @@ checksum = "17b02fc0ff9a9e4b35b3342880f48e896ebf69f2967921fe8646bf5b7125956a"
[[package]]
name = "ppv-lite86"
version = "0.2.9"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20"
checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea"
[[package]]
name = "proc-macro2"
version = "1.0.24"
version = "1.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
checksum = "1502d12e458c49a4c9cbff560d0fe0060c252bc29799ed94ca2ed4bb665a0101"
dependencies = [
"unicode-xid",
]
[[package]]
name = "quote"
version = "1.0.7"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
checksum = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea"
dependencies = [
"proc-macro2",
]
@@ -500,9 +500,9 @@ dependencies = [
[[package]]
name = "regex"
version = "1.4.1"
version = "1.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8963b85b8ce3074fecffde43b4b0dded83ce2f367dc8d363afc56679f3ee820b"
checksum = "a6020f034922e3194c711b82a627453881bc4682166cabb07134a10c26ba7692"
dependencies = [
"regex-syntax",
]
@@ -518,9 +518,9 @@ dependencies = [
[[package]]
name = "regex-syntax"
version = "0.6.20"
version = "0.6.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8cab7a364d15cde1e505267766a2d3c4e22a843e1a601f0fa7564c0f82ced11c"
checksum = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae"
[[package]]
name = "rust_decimal"
@@ -534,24 +534,24 @@ dependencies = [
[[package]]
name = "ryu"
version = "1.0.5"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
checksum = "ed3d612bc64430efeb3f7ee6ef26d590dce0c43249217bddc62112540c7941e1"
[[package]]
name = "serde"
version = "1.0.117"
version = "1.0.116"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b88fa983de7720629c9387e9f517353ed404164b1e482c970a90c1a4aaf7dc1a"
checksum = "96fe57af81d28386a513cbc6858332abc6117cfdb5999647c6444b8f43a370a5"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.117"
version = "1.0.116"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbd1ae72adb44aab48f325a02444a5fc079349a8d804c1fc922aed3f7454c74e"
checksum = "f630a6370fd8e457873b4bd2ffdae75408bc291ba72be773772a4c2a065d9ae8"
dependencies = [
"proc-macro2",
"quote",
@@ -560,9 +560,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.59"
version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcac07dbffa1c65e7f816ab9eba78eb142c6d44410f4eeba1e26e4f5dfa56b95"
checksum = "a230ea9107ca2220eea9d46de97eddcb04cd00e92d13dda78e478dd33fa82bd4"
dependencies = [
"itoa",
"ryu",
@@ -587,9 +587,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]]
name = "syn"
version = "1.0.44"
version = "1.0.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e03e57e4fcbfe7749842d53e24ccb9aa12b7252dbe5e91d2acad31834c8b8fdd"
checksum = "e8d5d96e8cbb005d6959f119f773bfaebb5684296108fb32600c00cde305b2cd"
dependencies = [
"proc-macro2",
"quote",
@@ -608,9 +608,9 @@ dependencies = [
[[package]]
name = "terminal_size"
version = "0.1.13"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a14cd9f8c72704232f0bfc8455c0e861f0ad4eb60cc9ec8a170e231414c1e13"
checksum = "8038f95fc7a6f351163f4b964af631bd26c9e828f7db085f2a84aca56f70d13b"
dependencies = [
"libc",
"winapi",
@@ -618,9 +618,9 @@ dependencies = [
[[package]]
name = "termios"
version = "0.3.3"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "411c5bf740737c7918b8b1fe232dca4dc9f8e754b8ad5e20966814001ed0ac6b"
checksum = "6f0fcee7b24a25675de40d5bb4de6e41b0df07bc9856295e7e2b3a3600c400c2"
dependencies = [
"libc",
]
@@ -637,15 +637,15 @@ dependencies = [
[[package]]
name = "unicode-width"
version = "0.1.8"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479"
[[package]]
name = "unicode-xid"
version = "0.2.1"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
[[package]]
name = "vec_map"
+1 -1
View File
@@ -7,7 +7,7 @@ license = "MIT/Apache-2.0"
name = "hyperfine"
readme = "README.md"
repository = "https://github.com/sharkdp/hyperfine"
version = "1.11.0"
version = "1.10.0"
edition = "2018"
build = "build.rs"
+3 -3
View File
@@ -101,8 +101,8 @@ The JSON output is useful if you want to analyze the benchmark results in more d
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/v1.11.0/hyperfine_1.11.0_amd64.deb
sudo dpkg -i hyperfine_1.11.0_amd64.deb
wget https://github.com/sharkdp/hyperfine/releases/download/v1.10.0/hyperfine_1.10.0_amd64.deb
sudo dpkg -i hyperfine_1.10.0_amd64.deb
```
### On Fedora
@@ -191,7 +191,7 @@ Download the corresponding archive from the [Release page](https://github.com/sh
## Alternative tools
Hyperfine is inspired by [bench](https://github.com/Gabriel439/bench).
## Integration with other tools
[Chronologer](https://github.com/dandavison/chronologer) is a tool that uses `hyperfine` to
+6 -64
View File
@@ -11,25 +11,17 @@ pack() {
local tempdir
local out_dir
local package_name
local gcc_prefix
tempdir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp)
out_dir=$(pwd)
package_name="$PROJECT_NAME-$TRAVIS_TAG-$TARGET"
if [[ $TARGET == arm-unknown-linux-* ]]; then
gcc_prefix="arm-linux-gnueabihf-"
else
gcc_prefix=""
fi
# create a "staging" directory
mkdir "$tempdir/$package_name"
mkdir "$tempdir/$package_name/autocomplete"
# copying the main binary
cp "target/$TARGET/release/$PROJECT_NAME" "$tempdir/$package_name/"
"${gcc_prefix}"strip "$tempdir/$package_name/$PROJECT_NAME"
strip "$tempdir/$package_name/$PROJECT_NAME"
# manpage, readme and license
cp "doc/$PROJECT_NAME.1" "$tempdir/$package_name"
@@ -38,6 +30,7 @@ pack() {
cp LICENSE-APACHE "$tempdir/$package_name"
# various autocomplete
mkdir "$tempdir/$package_name/autocomplete"
cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/"$PROJECT_NAME".bash "$tempdir/$package_name/autocomplete/${PROJECT_NAME}.bash-completion"
cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/"$PROJECT_NAME".fish "$tempdir/$package_name/autocomplete"
cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/_"$PROJECT_NAME" "$tempdir/$package_name/autocomplete"
@@ -55,29 +48,17 @@ make_deb() {
local version
local dpkgname
local conflictname
local homepage
local maintainer
local gcc_prefix
homepage="https://github.com/sharkdp/$PROJECT_NAME"
maintainer="David Peter <mail@david-peter.de>"
case $TARGET in
x86_64*)
architecture=amd64
gcc_prefix=""
;;
i686*)
architecture=i386
gcc_prefix=""
;;
arm*hf)
architecture=armhf
gcc_prefix="arm-linux-gnueabihf-"
;;
*)
echo "make_deb: skipping target '${TARGET}'" >&2
return 0
echo "ERROR: unknown target" >&2
return 1
;;
esac
version=${TRAVIS_TAG#v}
@@ -93,7 +74,7 @@ make_deb() {
# copy the main binary
install -Dm755 "target/$TARGET/release/$PROJECT_NAME" "$tempdir/usr/bin/$PROJECT_NAME"
"${gcc_prefix}"strip "$tempdir/usr/bin/$PROJECT_NAME"
strip "$tempdir/usr/bin/$PROJECT_NAME"
# manpage
install -Dm644 "doc/$PROJECT_NAME.1" "$tempdir/usr/share/man/man1/$PROJECT_NAME.1"
@@ -103,44 +84,6 @@ make_deb() {
install -Dm644 README.md "$tempdir/usr/share/doc/$PROJECT_NAME/README.md"
install -Dm644 LICENSE-MIT "$tempdir/usr/share/doc/$PROJECT_NAME/LICENSE-MIT"
install -Dm644 LICENSE-APACHE "$tempdir/usr/share/doc/$PROJECT_NAME/LICENSE-APACHE"
cat > "$tempdir/usr/share/doc/$PROJECT_NAME/copyright" <<EOF
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: $PROJECT_NAME
Source: $homepage
Files: *
Copyright: $maintainer
License: Apache-2.0 or MIT
License: Apache-2.0
On Debian systems, the complete text of the Apache-2.0 can be found in the
file /usr/share/common-licenses/Apache-2.0.
License: MIT
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
.
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
EOF
# completions
install -Dm644 target/$TARGET/release/build/$PROJECT_NAME-*/out/$PROJECT_NAME.bash "$tempdir/usr/share/bash-completion/completions/${PROJECT_NAME}"
@@ -154,11 +97,10 @@ Package: $dpkgname
Version: $version
Section: utils
Priority: optional
Maintainer: $maintainer
Maintainer: David Peter <mail@david-peter.de>
Architecture: $architecture
Provides: $PROJECT_NAME
Conflicts: $conflictname
Homepage: $homepage
Description: A command-line benchmarking tool.
EOF
-26
View File
@@ -1,26 +0,0 @@
#!/usr/bin/env bash
set -ex
if [ "$TRAVIS_OS_NAME" != linux ]; then
exit 0
fi
sudo apt-get update
# needed to build deb packages
sudo apt-get install -y fakeroot
# needed for i686 linux gnu target
if [[ $TARGET == i686-unknown-linux-* ]]; then
sudo apt-get install -y gcc-multilib
fi
# needed for cross-compiling for arm
if [[ $TARGET == arm-unknown-linux-* ]]; then
sudo apt-get install -y \
gcc-4.8-arm-linux-gnueabihf \
binutils-arm-linux-gnueabihf \
libc6-armhf-cross \
libc6-dev-armhf-cross
fi
+1 -3
View File
@@ -143,9 +143,7 @@ fn build_app() -> App<'static, 'static> {
"Perform benchmark runs for each value in the comma-separated list VALUES. \
Replaces the string '{VAR}' in each command by the current parameter value\
.\n\nExample: hyperfine -L compiler gcc,clang '{compiler} -O2 main.cpp'\n\n\
This performs benchmarks for 'gcc -O2 main.cpp' and 'clang -O2 main.cpp'.\n\n\
The option can be specified multiple times to run benchmarks for all \
possible parameter combinations.\n"
This performs benchmarks for 'gcc -O2 main.cpp' and 'clang -O2 main.cpp'.",
),
)
.arg(
+3 -11
View File
@@ -2,7 +2,6 @@ use rust_decimal::Error as DecimalError;
use std::error::Error;
use std::fmt;
use std::num;
use std::num::ParseIntError;
#[derive(Debug)]
pub enum ParameterScanError {
@@ -47,14 +46,13 @@ impl fmt::Display for ParameterScanError {
impl Error for ParameterScanError {}
#[derive(Debug)]
pub enum OptionsError<'a> {
pub enum OptionsError {
RunsBelowTwo,
EmptyRunsRange,
TooManyCommandNames(usize),
NumericParsingError(&'a str, ParseIntError),
}
impl<'a> fmt::Display for OptionsError<'a> {
impl fmt::Display for OptionsError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
OptionsError::EmptyRunsRange => write!(f, "Empty runs range"),
@@ -62,14 +60,8 @@ impl<'a> fmt::Display for OptionsError<'a> {
OptionsError::TooManyCommandNames(n) => {
write!(f, "Too many --command-name options: expected {} at most", n)
}
OptionsError::NumericParsingError(cmd, ref err) => write!(
f,
"Could not read numeric argument to '--{cmd}': {err}",
cmd = cmd,
err = err
),
}
}
}
impl<'a> Error for OptionsError<'a> {}
impl Error for OptionsError {}
+6 -11
View File
@@ -86,25 +86,20 @@ fn main() {
}
/// Build the HyperfineOptions that correspond to the given ArgMatches
fn build_hyperfine_options<'a>(
matches: &ArgMatches<'a>,
) -> Result<HyperfineOptions, OptionsError<'a>> {
fn build_hyperfine_options(matches: &ArgMatches<'_>) -> Result<HyperfineOptions, OptionsError> {
let mut options = HyperfineOptions::default();
let param_to_u64 = |param| {
matches
.value_of(param)
.map(|n| {
u64::from_str_radix(n, 10).map_err(|e| OptionsError::NumericParsingError(param, e))
})
.transpose()
.and_then(|n| u64::from_str_radix(n, 10).ok())
};
options.warmup_count = param_to_u64("warmup")?.unwrap_or(options.warmup_count);
options.warmup_count = param_to_u64("warmup").unwrap_or(options.warmup_count);
let mut min_runs = param_to_u64("min-runs")?;
let mut max_runs = param_to_u64("max-runs")?;
let mut min_runs = param_to_u64("min-runs");
let mut max_runs = param_to_u64("max-runs");
if let Some(runs) = param_to_u64("runs")? {
if let Some(runs) = param_to_u64("runs") {
min_runs = Some(runs);
max_runs = Some(runs);
}