Jeff Vander Stoep | 956d143 | 2020-09-18 13:46:24 +0200 | [diff] [blame] | 1 | '\" t |
| 2 | .\" Title: cargo-bench |
| 3 | .\" Author: [see the "AUTHOR(S)" section] |
| 4 | .\" Generator: Asciidoctor 2.0.10 |
| 5 | .\" Date: 2020-06-25 |
| 6 | .\" Manual: \ \& |
| 7 | .\" Source: \ \& |
| 8 | .\" Language: English |
| 9 | .\" |
| 10 | .TH "CARGO\-BENCH" "1" "2020-06-25" "\ \&" "\ \&" |
| 11 | .ie \n(.g .ds Aq \(aq |
| 12 | .el .ds Aq ' |
| 13 | .ss \n[.ss] 0 |
| 14 | .nh |
| 15 | .ad l |
| 16 | .de URL |
| 17 | \fI\\$2\fP <\\$1>\\$3 |
| 18 | .. |
| 19 | .als MTO URL |
| 20 | .if \n[.g] \{\ |
| 21 | . mso www.tmac |
| 22 | . am URL |
| 23 | . ad l |
| 24 | . . |
| 25 | . am MTO |
| 26 | . ad l |
| 27 | . . |
| 28 | . LINKSTYLE blue R < > |
| 29 | .\} |
| 30 | .SH "NAME" |
| 31 | cargo\-bench \- Execute benchmarks of a package |
| 32 | .SH "SYNOPSIS" |
| 33 | .sp |
| 34 | \fBcargo bench [\fIOPTIONS\fP] [BENCHNAME] [\-\- \fIBENCH\-OPTIONS\fP]\fP |
| 35 | .SH "DESCRIPTION" |
| 36 | .sp |
| 37 | Compile and execute benchmarks. |
| 38 | .sp |
| 39 | The benchmark filtering argument \fBBENCHNAME\fP and all the arguments following |
| 40 | the two dashes (\fB\-\-\fP) are passed to the benchmark binaries and thus to |
| 41 | \fIlibtest\fP (rustc\(cqs built in unit\-test and micro\-benchmarking framework). If |
| 42 | you\(cqre passing arguments to both Cargo and the binary, the ones after \fB\-\-\fP go |
| 43 | to the binary, the ones before go to Cargo. For details about libtest\(cqs |
| 44 | arguments see the output of \fBcargo bench \-\- \-\-help\fP. As an example, this will |
| 45 | run only the benchmark named \fBfoo\fP (and skip other similarly named benchmarks |
| 46 | like \fBfoobar\fP): |
| 47 | .sp |
| 48 | .if n .RS 4 |
| 49 | .nf |
| 50 | cargo bench \-\- foo \-\-exact |
| 51 | .fi |
| 52 | .if n .RE |
| 53 | .sp |
| 54 | Benchmarks are built with the \fB\-\-test\fP option to \fBrustc\fP which creates an |
| 55 | executable with a \fBmain\fP function that automatically runs all functions |
| 56 | annotated with the \fB#[bench]\fP attribute. Cargo passes the \fB\-\-bench\fP flag to |
| 57 | the test harness to tell it to run only benchmarks. |
| 58 | .sp |
| 59 | The libtest harness may be disabled by setting \fBharness = false\fP in the target |
| 60 | manifest settings, in which case your code will need to provide its own \fBmain\fP |
| 61 | function to handle running benchmarks. |
| 62 | .RS 3 |
| 63 | .ll -.6i |
| 64 | .sp |
| 65 | \fBNote\fP: The |
| 66 | \c |
| 67 | .URL "https://doc.rust\-lang.org/nightly/unstable\-book/library\-features/test.html" "\fB#[bench]\fP attribute" |
| 68 | is currently unstable and only available on the |
| 69 | .URL "https://doc.rust\-lang.org/book/appendix\-07\-nightly\-rust.html" "nightly channel" "." |
| 70 | There are some packages available on |
| 71 | .URL "https://crates.io/keywords/benchmark" "crates.io" " " |
| 72 | that may help with |
| 73 | running benchmarks on the stable channel, such as |
| 74 | .URL "https://crates.io/crates/criterion" "Criterion" "." |
| 75 | .br |
| 76 | .RE |
| 77 | .ll |
| 78 | .SH "OPTIONS" |
| 79 | .SS "Benchmark Options" |
| 80 | .sp |
| 81 | \fB\-\-no\-run\fP |
| 82 | .RS 4 |
| 83 | Compile, but don\(cqt run benchmarks. |
| 84 | .RE |
| 85 | .sp |
| 86 | \fB\-\-no\-fail\-fast\fP |
| 87 | .RS 4 |
| 88 | Run all benchmarks regardless of failure. Without this flag, Cargo will exit |
| 89 | after the first executable fails. The Rust test harness will run all |
| 90 | benchmarks within the executable to completion, this flag only applies to |
| 91 | the executable as a whole. |
| 92 | .RE |
| 93 | .SS "Package Selection" |
| 94 | .sp |
| 95 | By default, when no package selection options are given, the packages selected |
| 96 | depend on the selected manifest file (based on the current working directory if |
| 97 | \fB\-\-manifest\-path\fP is not given). If the manifest is the root of a workspace then |
| 98 | the workspaces default members are selected, otherwise only the package defined |
| 99 | by the manifest will be selected. |
| 100 | .sp |
| 101 | The default members of a workspace can be set explicitly with the |
| 102 | \fBworkspace.default\-members\fP key in the root manifest. If this is not set, a |
| 103 | virtual workspace will include all workspace members (equivalent to passing |
| 104 | \fB\-\-workspace\fP), and a non\-virtual workspace will include only the root crate itself. |
| 105 | .sp |
| 106 | \fB\-p\fP \fISPEC\fP..., \fB\-\-package\fP \fISPEC\fP... |
| 107 | .RS 4 |
| 108 | Benchmark only the specified packages. See \fBcargo\-pkgid\fP(1) for the |
| 109 | SPEC format. This flag may be specified multiple times. |
| 110 | .RE |
| 111 | .sp |
| 112 | \fB\-\-workspace\fP |
| 113 | .RS 4 |
| 114 | Benchmark all members in the workspace. |
| 115 | .RE |
| 116 | .sp |
| 117 | \fB\-\-all\fP |
| 118 | .RS 4 |
| 119 | Deprecated alias for \fB\-\-workspace\fP. |
| 120 | .RE |
| 121 | .sp |
| 122 | \fB\-\-exclude\fP \fISPEC\fP... |
| 123 | .RS 4 |
| 124 | Exclude the specified packages. Must be used in conjunction with the |
| 125 | \fB\-\-workspace\fP flag. This flag may be specified multiple times. |
| 126 | .RE |
| 127 | .SS "Target Selection" |
| 128 | .sp |
| 129 | When no target selection options are given, \fBcargo bench\fP will build the |
| 130 | following targets of the selected packages: |
| 131 | .sp |
| 132 | .RS 4 |
| 133 | .ie n \{\ |
| 134 | \h'-04'\(bu\h'+03'\c |
| 135 | .\} |
| 136 | .el \{\ |
| 137 | . sp -1 |
| 138 | . IP \(bu 2.3 |
| 139 | .\} |
| 140 | lib — used to link with binaries and benchmarks |
| 141 | .RE |
| 142 | .sp |
| 143 | .RS 4 |
| 144 | .ie n \{\ |
| 145 | \h'-04'\(bu\h'+03'\c |
| 146 | .\} |
| 147 | .el \{\ |
| 148 | . sp -1 |
| 149 | . IP \(bu 2.3 |
| 150 | .\} |
| 151 | bins (only if benchmark targets are built and required features are |
| 152 | available) |
| 153 | .RE |
| 154 | .sp |
| 155 | .RS 4 |
| 156 | .ie n \{\ |
| 157 | \h'-04'\(bu\h'+03'\c |
| 158 | .\} |
| 159 | .el \{\ |
| 160 | . sp -1 |
| 161 | . IP \(bu 2.3 |
| 162 | .\} |
| 163 | lib as a benchmark |
| 164 | .RE |
| 165 | .sp |
| 166 | .RS 4 |
| 167 | .ie n \{\ |
| 168 | \h'-04'\(bu\h'+03'\c |
| 169 | .\} |
| 170 | .el \{\ |
| 171 | . sp -1 |
| 172 | . IP \(bu 2.3 |
| 173 | .\} |
| 174 | bins as benchmarks |
| 175 | .RE |
| 176 | .sp |
| 177 | .RS 4 |
| 178 | .ie n \{\ |
| 179 | \h'-04'\(bu\h'+03'\c |
| 180 | .\} |
| 181 | .el \{\ |
| 182 | . sp -1 |
| 183 | . IP \(bu 2.3 |
| 184 | .\} |
| 185 | benchmark targets |
| 186 | .RE |
| 187 | .sp |
| 188 | The default behavior can be changed by setting the \fBbench\fP flag for the target |
| 189 | in the manifest settings. Setting examples to \fBbench = true\fP will build and |
| 190 | run the example as a benchmark. Setting targets to \fBbench = false\fP will stop |
| 191 | them from being benchmarked by default. Target selection options that take a |
| 192 | target by name ignore the \fBbench\fP flag and will always benchmark the given |
| 193 | target. |
| 194 | .sp |
| 195 | Passing target selection flags will benchmark only the |
| 196 | specified targets. |
| 197 | .sp |
| 198 | \fB\-\-lib\fP |
| 199 | .RS 4 |
| 200 | Benchmark the package\(cqs library. |
| 201 | .RE |
| 202 | .sp |
| 203 | \fB\-\-bin\fP \fINAME\fP... |
| 204 | .RS 4 |
| 205 | Benchmark the specified binary. This flag may be specified multiple times. |
| 206 | .RE |
| 207 | .sp |
| 208 | \fB\-\-bins\fP |
| 209 | .RS 4 |
| 210 | Benchmark all binary targets. |
| 211 | .RE |
| 212 | .sp |
| 213 | \fB\-\-example\fP \fINAME\fP... |
| 214 | .RS 4 |
| 215 | Benchmark the specified example. This flag may be specified multiple times. |
| 216 | .RE |
| 217 | .sp |
| 218 | \fB\-\-examples\fP |
| 219 | .RS 4 |
| 220 | Benchmark all example targets. |
| 221 | .RE |
| 222 | .sp |
| 223 | \fB\-\-test\fP \fINAME\fP... |
| 224 | .RS 4 |
| 225 | Benchmark the specified integration test. This flag may be specified multiple |
| 226 | times. |
| 227 | .RE |
| 228 | .sp |
| 229 | \fB\-\-tests\fP |
| 230 | .RS 4 |
| 231 | Benchmark all targets in test mode that have the \fBtest = true\fP manifest |
| 232 | flag set. By default this includes the library and binaries built as |
| 233 | unittests, and integration tests. Be aware that this will also build any |
| 234 | required dependencies, so the lib target may be built twice (once as a |
| 235 | unittest, and once as a dependency for binaries, integration tests, etc.). |
| 236 | Targets may be enabled or disabled by setting the \fBtest\fP flag in the |
| 237 | manifest settings for the target. |
| 238 | .RE |
| 239 | .sp |
| 240 | \fB\-\-bench\fP \fINAME\fP... |
| 241 | .RS 4 |
| 242 | Benchmark the specified benchmark. This flag may be specified multiple times. |
| 243 | .RE |
| 244 | .sp |
| 245 | \fB\-\-benches\fP |
| 246 | .RS 4 |
| 247 | Benchmark all targets in benchmark mode that have the \fBbench = true\fP |
| 248 | manifest flag set. By default this includes the library and binaries built |
| 249 | as benchmarks, and bench targets. Be aware that this will also build any |
| 250 | required dependencies, so the lib target may be built twice (once as a |
| 251 | benchmark, and once as a dependency for binaries, benchmarks, etc.). |
| 252 | Targets may be enabled or disabled by setting the \fBbench\fP flag in the |
| 253 | manifest settings for the target. |
| 254 | .RE |
| 255 | .sp |
| 256 | \fB\-\-all\-targets\fP |
| 257 | .RS 4 |
| 258 | Benchmark all targets. This is equivalent to specifying \fB\-\-lib \-\-bins |
| 259 | \-\-tests \-\-benches \-\-examples\fP. |
| 260 | .RE |
| 261 | .SS "Feature Selection" |
| 262 | .sp |
| 263 | The feature flags allow you to control the enabled features for the "current" |
| 264 | package. The "current" package is the package in the current directory, or the |
| 265 | one specified in \fB\-\-manifest\-path\fP. If running in the root of a virtual |
| 266 | workspace, then the default features are selected for all workspace members, |
| 267 | or all features if \fB\-\-all\-features\fP is specified. |
| 268 | .sp |
| 269 | When no feature options are given, the \fBdefault\fP feature is activated for |
| 270 | every selected package. |
| 271 | .sp |
| 272 | \fB\-\-features\fP \fIFEATURES\fP |
| 273 | .RS 4 |
| 274 | Space or comma separated list of features to activate. These features only |
| 275 | apply to the current directory\(cqs package. Features of direct dependencies |
| 276 | may be enabled with \fB<dep\-name>/<feature\-name>\fP syntax. This flag may be |
| 277 | specified multiple times, which enables all specified features. |
| 278 | .RE |
| 279 | .sp |
| 280 | \fB\-\-all\-features\fP |
| 281 | .RS 4 |
| 282 | Activate all available features of all selected packages. |
| 283 | .RE |
| 284 | .sp |
| 285 | \fB\-\-no\-default\-features\fP |
| 286 | .RS 4 |
| 287 | Do not activate the \fBdefault\fP feature of the current directory\(cqs |
| 288 | package. |
| 289 | .RE |
| 290 | .SS "Compilation Options" |
| 291 | .sp |
| 292 | \fB\-\-target\fP \fITRIPLE\fP |
| 293 | .RS 4 |
| 294 | Benchmark for the given architecture. The default is the host |
| 295 | architecture. The general format of the triple is |
| 296 | \fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fP. Run \fBrustc \-\-print target\-list\fP for a |
| 297 | list of supported targets. |
| 298 | .sp |
| 299 | This may also be specified with the \fBbuild.target\fP |
| 300 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 301 | .sp |
| 302 | Note that specifying this flag makes Cargo run in a different mode where the |
| 303 | target artifacts are placed in a separate directory. See the |
| 304 | .URL "https://doc.rust\-lang.org/cargo/guide/build\-cache.html" "build cache" " " |
| 305 | documentation for more details. |
| 306 | .RE |
| 307 | .SS "Output Options" |
| 308 | .sp |
| 309 | \fB\-\-target\-dir\fP \fIDIRECTORY\fP |
| 310 | .RS 4 |
| 311 | Directory for all generated artifacts and intermediate files. May also be |
| 312 | specified with the \fBCARGO_TARGET_DIR\fP environment variable, or the |
| 313 | \fBbuild.target\-dir\fP \c |
| 314 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 315 | Defaults |
| 316 | to \fBtarget\fP in the root of the workspace. |
| 317 | .RE |
| 318 | .SS "Display Options" |
| 319 | .sp |
| 320 | By default the Rust test harness hides output from benchmark execution to keep |
| 321 | results readable. Benchmark output can be recovered (e.g., for debugging) by |
| 322 | passing \fB\-\-nocapture\fP to the benchmark binaries: |
| 323 | .sp |
| 324 | .if n .RS 4 |
| 325 | .nf |
| 326 | cargo bench \-\- \-\-nocapture |
| 327 | .fi |
| 328 | .if n .RE |
| 329 | .sp |
| 330 | \fB\-v\fP, \fB\-\-verbose\fP |
| 331 | .RS 4 |
| 332 | Use verbose output. May be specified twice for "very verbose" output which |
| 333 | includes extra output such as dependency warnings and build script output. |
| 334 | May also be specified with the \fBterm.verbose\fP |
| 335 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 336 | .RE |
| 337 | .sp |
| 338 | \fB\-q\fP, \fB\-\-quiet\fP |
| 339 | .RS 4 |
| 340 | No output printed to stdout. |
| 341 | .RE |
| 342 | .sp |
| 343 | \fB\-\-color\fP \fIWHEN\fP |
| 344 | .RS 4 |
| 345 | Control when colored output is used. Valid values: |
| 346 | .sp |
| 347 | .RS 4 |
| 348 | .ie n \{\ |
| 349 | \h'-04'\(bu\h'+03'\c |
| 350 | .\} |
| 351 | .el \{\ |
| 352 | . sp -1 |
| 353 | . IP \(bu 2.3 |
| 354 | .\} |
| 355 | \fBauto\fP (default): Automatically detect if color support is available on the |
| 356 | terminal. |
| 357 | .RE |
| 358 | .sp |
| 359 | .RS 4 |
| 360 | .ie n \{\ |
| 361 | \h'-04'\(bu\h'+03'\c |
| 362 | .\} |
| 363 | .el \{\ |
| 364 | . sp -1 |
| 365 | . IP \(bu 2.3 |
| 366 | .\} |
| 367 | \fBalways\fP: Always display colors. |
| 368 | .RE |
| 369 | .sp |
| 370 | .RS 4 |
| 371 | .ie n \{\ |
| 372 | \h'-04'\(bu\h'+03'\c |
| 373 | .\} |
| 374 | .el \{\ |
| 375 | . sp -1 |
| 376 | . IP \(bu 2.3 |
| 377 | .\} |
| 378 | \fBnever\fP: Never display colors. |
| 379 | .RE |
| 380 | .sp |
| 381 | May also be specified with the \fBterm.color\fP |
| 382 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 383 | .RE |
| 384 | .sp |
| 385 | \fB\-\-message\-format\fP \fIFMT\fP |
| 386 | .RS 4 |
| 387 | The output format for diagnostic messages. Can be specified multiple times |
| 388 | and consists of comma\-separated values. Valid values: |
| 389 | .sp |
| 390 | .RS 4 |
| 391 | .ie n \{\ |
| 392 | \h'-04'\(bu\h'+03'\c |
| 393 | .\} |
| 394 | .el \{\ |
| 395 | . sp -1 |
| 396 | . IP \(bu 2.3 |
| 397 | .\} |
| 398 | \fBhuman\fP (default): Display in a human\-readable text format. |
| 399 | .RE |
| 400 | .sp |
| 401 | .RS 4 |
| 402 | .ie n \{\ |
| 403 | \h'-04'\(bu\h'+03'\c |
| 404 | .\} |
| 405 | .el \{\ |
| 406 | . sp -1 |
| 407 | . IP \(bu 2.3 |
| 408 | .\} |
| 409 | \fBshort\fP: Emit shorter, human\-readable text messages. |
| 410 | .RE |
| 411 | .sp |
| 412 | .RS 4 |
| 413 | .ie n \{\ |
| 414 | \h'-04'\(bu\h'+03'\c |
| 415 | .\} |
| 416 | .el \{\ |
| 417 | . sp -1 |
| 418 | . IP \(bu 2.3 |
| 419 | .\} |
| 420 | \fBjson\fP: Emit JSON messages to stdout. See |
| 421 | \c |
| 422 | .URL "https://doc.rust\-lang.org/cargo/reference/external\-tools.html#json\-messages" "the reference" |
| 423 | for more details. |
| 424 | .RE |
| 425 | .sp |
| 426 | .RS 4 |
| 427 | .ie n \{\ |
| 428 | \h'-04'\(bu\h'+03'\c |
| 429 | .\} |
| 430 | .el \{\ |
| 431 | . sp -1 |
| 432 | . IP \(bu 2.3 |
| 433 | .\} |
| 434 | \fBjson\-diagnostic\-short\fP: Ensure the \fBrendered\fP field of JSON messages contains |
| 435 | the "short" rendering from rustc. |
| 436 | .RE |
| 437 | .sp |
| 438 | .RS 4 |
| 439 | .ie n \{\ |
| 440 | \h'-04'\(bu\h'+03'\c |
| 441 | .\} |
| 442 | .el \{\ |
| 443 | . sp -1 |
| 444 | . IP \(bu 2.3 |
| 445 | .\} |
| 446 | \fBjson\-diagnostic\-rendered\-ansi\fP: Ensure the \fBrendered\fP field of JSON messages |
| 447 | contains embedded ANSI color codes for respecting rustc\(cqs default color |
| 448 | scheme. |
| 449 | .RE |
| 450 | .sp |
| 451 | .RS 4 |
| 452 | .ie n \{\ |
| 453 | \h'-04'\(bu\h'+03'\c |
| 454 | .\} |
| 455 | .el \{\ |
| 456 | . sp -1 |
| 457 | . IP \(bu 2.3 |
| 458 | .\} |
| 459 | \fBjson\-render\-diagnostics\fP: Instruct Cargo to not include rustc diagnostics in |
| 460 | in JSON messages printed, but instead Cargo itself should render the |
| 461 | JSON diagnostics coming from rustc. Cargo\(cqs own JSON diagnostics and others |
| 462 | coming from rustc are still emitted. |
| 463 | .RE |
| 464 | .RE |
| 465 | .SS "Manifest Options" |
| 466 | .sp |
| 467 | \fB\-\-manifest\-path\fP \fIPATH\fP |
| 468 | .RS 4 |
| 469 | Path to the \fBCargo.toml\fP file. By default, Cargo searches for the |
| 470 | \fBCargo.toml\fP file in the current directory or any parent directory. |
| 471 | .RE |
| 472 | .sp |
| 473 | \fB\-\-frozen\fP, \fB\-\-locked\fP |
| 474 | .RS 4 |
| 475 | Either of these flags requires that the \fBCargo.lock\fP file is |
| 476 | up\-to\-date. If the lock file is missing, or it needs to be updated, Cargo will |
| 477 | exit with an error. The \fB\-\-frozen\fP flag also prevents Cargo from |
| 478 | attempting to access the network to determine if it is out\-of\-date. |
| 479 | .sp |
| 480 | These may be used in environments where you want to assert that the |
| 481 | \fBCargo.lock\fP file is up\-to\-date (such as a CI build) or want to avoid network |
| 482 | access. |
| 483 | .RE |
| 484 | .sp |
| 485 | \fB\-\-offline\fP |
| 486 | .RS 4 |
| 487 | Prevents Cargo from accessing the network for any reason. Without this |
| 488 | flag, Cargo will stop with an error if it needs to access the network and |
| 489 | the network is not available. With this flag, Cargo will attempt to |
| 490 | proceed without the network if possible. |
| 491 | .sp |
| 492 | Beware that this may result in different dependency resolution than online |
| 493 | mode. Cargo will restrict itself to crates that are downloaded locally, even |
| 494 | if there might be a newer version as indicated in the local copy of the index. |
| 495 | See the \fBcargo\-fetch\fP(1) command to download dependencies before going |
| 496 | offline. |
| 497 | .sp |
| 498 | May also be specified with the \fBnet.offline\fP \c |
| 499 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 500 | .RE |
| 501 | .SS "Common Options" |
| 502 | .sp |
| 503 | \fB+TOOLCHAIN\fP |
| 504 | .RS 4 |
| 505 | If Cargo has been installed with rustup, and the first argument to \fBcargo\fP |
| 506 | begins with \fB+\fP, it will be interpreted as a rustup toolchain name (such |
| 507 | as \fB+stable\fP or \fB+nightly\fP). |
| 508 | See the \c |
| 509 | .URL "https://github.com/rust\-lang/rustup/" "rustup documentation" |
| 510 | for more information about how toolchain overrides work. |
| 511 | .RE |
| 512 | .sp |
| 513 | \fB\-h\fP, \fB\-\-help\fP |
| 514 | .RS 4 |
| 515 | Prints help information. |
| 516 | .RE |
| 517 | .sp |
| 518 | \fB\-Z\fP \fIFLAG\fP... |
| 519 | .RS 4 |
| 520 | Unstable (nightly\-only) flags to Cargo. Run \fBcargo \-Z help\fP for |
| 521 | details. |
| 522 | .RE |
| 523 | .SS "Miscellaneous Options" |
| 524 | .sp |
| 525 | The \fB\-\-jobs\fP argument affects the building of the benchmark executable but |
| 526 | does not affect how many threads are used when running the benchmarks. The |
| 527 | Rust test harness runs benchmarks serially in a single thread. |
| 528 | .sp |
| 529 | \fB\-j\fP \fIN\fP, \fB\-\-jobs\fP \fIN\fP |
| 530 | .RS 4 |
| 531 | Number of parallel jobs to run. May also be specified with the |
| 532 | \fBbuild.jobs\fP \c |
| 533 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 534 | Defaults to |
| 535 | the number of CPUs. |
| 536 | .RE |
| 537 | .SH "PROFILES" |
| 538 | .sp |
| 539 | Profiles may be used to configure compiler options such as optimization levels |
| 540 | and debug settings. See |
| 541 | \c |
| 542 | .URL "https://doc.rust\-lang.org/cargo/reference/profiles.html" "the reference" |
| 543 | for more details. |
| 544 | .sp |
| 545 | Benchmarks are always built with the \fBbench\fP profile. Binary and lib targets |
| 546 | are built separately as benchmarks with the \fBbench\fP profile. Library targets |
| 547 | are built with the \fBrelease\fP profiles when linked to binaries and benchmarks. |
| 548 | Dependencies use the \fBrelease\fP profile. |
| 549 | .sp |
| 550 | If you need a debug build of a benchmark, try building it with |
| 551 | \fBcargo\-build\fP(1) which will use the \fBtest\fP profile which is by default |
| 552 | unoptimized and includes debug information. You can then run the debug\-enabled |
| 553 | benchmark manually. |
| 554 | .SH "ENVIRONMENT" |
| 555 | .sp |
| 556 | See \c |
| 557 | .URL "https://doc.rust\-lang.org/cargo/reference/environment\-variables.html" "the reference" " " |
| 558 | for |
| 559 | details on environment variables that Cargo reads. |
| 560 | .SH "EXIT STATUS" |
| 561 | .sp |
| 562 | 0 |
| 563 | .RS 4 |
| 564 | Cargo succeeded. |
| 565 | .RE |
| 566 | .sp |
| 567 | 101 |
| 568 | .RS 4 |
| 569 | Cargo failed to complete. |
| 570 | .RE |
| 571 | .SH "EXAMPLES" |
| 572 | .sp |
| 573 | .RS 4 |
| 574 | .ie n \{\ |
| 575 | \h'-04' 1.\h'+01'\c |
| 576 | .\} |
| 577 | .el \{\ |
| 578 | . sp -1 |
| 579 | . IP " 1." 4.2 |
| 580 | .\} |
| 581 | Build and execute all the benchmarks of the current package: |
| 582 | .sp |
| 583 | .if n .RS 4 |
| 584 | .nf |
| 585 | cargo bench |
| 586 | .fi |
| 587 | .if n .RE |
| 588 | .RE |
| 589 | .sp |
| 590 | .RS 4 |
| 591 | .ie n \{\ |
| 592 | \h'-04' 2.\h'+01'\c |
| 593 | .\} |
| 594 | .el \{\ |
| 595 | . sp -1 |
| 596 | . IP " 2." 4.2 |
| 597 | .\} |
| 598 | Run only a specific benchmark within a specific benchmark target: |
| 599 | .sp |
| 600 | .if n .RS 4 |
| 601 | .nf |
| 602 | cargo bench \-\-bench bench_name \-\- modname::some_benchmark |
| 603 | .fi |
| 604 | .if n .RE |
| 605 | .RE |
| 606 | .SH "SEE ALSO" |
| 607 | .sp |
| 608 | \fBcargo\fP(1), \fBcargo\-test\fP(1) |