您当前的位置: 首页 >  ar

mutourend

暂无认证

  • 1浏览

    0关注

    661博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

cargo bench用于package基准测试

mutourend 发布时间:2019-06-25 19:07:48 ,浏览量:1

cargo bench用于在代码中以#{bench]标识(代码目录下有benches文件夹),类似于测试用例#[test]标识(代码目录下有tests文件夹)

支持的子命令如下:

# cargo bench --help
cargo-bench
Execute all benchmarks of a local package

USAGE:
    cargo bench [OPTIONS] [BENCHNAME] [-- ...]

OPTIONS:
    -q, --quiet                     No output printed to stdout
        --lib                       Benchmark only this package's library
        --bin ...             Benchmark only the specified binary
        --bins                      Benchmark all binaries
        --example ...         Benchmark only the specified example
        --examples                  Benchmark all examples
        --test ...            Benchmark only the specified test target
        --tests                     Benchmark all tests
        --bench ...           Benchmark only the specified bench target
        --benches                   Benchmark all benches
        --all-targets               Benchmark all targets
        --no-run                    Compile, but don't run benchmarks
    -p, --package ...         Package to run benchmarks for
        --all                       Benchmark all packages in the workspace
        --exclude ...         Exclude packages from the benchmark
    -j, --jobs                   Number of parallel jobs, defaults to # of CPUs
        --features        Space-separated list of features to activate
        --all-features              Activate all available features
        --no-default-features       Do not activate the `default` feature
        --target            Build for the target triple
        --target-dir     Directory for all generated artifacts
        --manifest-path       Path to Cargo.toml
        --message-format       Error format [default: human]  [possible values: human, json, short]
        --no-fail-fast              Run all benchmarks regardless of failure
    -v, --verbose                   Use verbose output (-vv very verbose/build.rs output)
        --color               Coloring: auto, always, never
        --frozen                    Require Cargo.lock and cache are up to date
        --locked                    Require Cargo.lock is up to date
    -Z ...                    Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details
    -h, --help                      Prints help information

ARGS:
        If specified, only run benches containing this string in their names
    ...      Arguments for the bench binary

The benchmark filtering argument BENCHNAME and all the arguments following the
two dashes (`--`) are passed to the benchmark binaries and thus to libtest
(rustc's built in unit-test and micro-benchmarking framework). If you're
passing arguments to both Cargo and the binary, the ones after `--` go to the
binary, the ones before go to Cargo. For details about libtest's arguments see
the output of `cargo bench -- --help`.

If the `--package` argument is given, then SPEC is a package ID specification
which indicates which package should be benchmarked. If it is not given, then
the current package is benchmarked. For more information on SPEC and its format,
see the `cargo help pkgid` command.

All packages in the workspace are benchmarked if the `--all` flag is supplied. The
`--all` flag is automatically assumed for a virtual manifest.
Note that `--exclude` has to be specified in conjunction with the `--all` flag.

The `--jobs` argument affects the building of the benchmark executable but does
not affect how many jobs are used when running the benchmarks.

Compilation can be customized with the `bench` profile in the manifest.

关注
打赏
1664532908
查看更多评论
立即登录/注册

微信扫码登录

0.0723s