1
1
# cargo-bench(1)
2
-
3
2
## NAME
4
3
5
4
cargo-bench --- Execute benchmarks of a package
@@ -80,7 +79,6 @@ as a whole.</dd>
80
79
81
80
</dl >
82
81
83
-
84
82
### Package Selection
85
83
86
84
By default, when no package selection options are given, the packages selected
@@ -109,12 +107,10 @@ double quotes around each pattern.</dd>
109
107
<dd class =" option-desc " >Benchmark all members in the workspace.</dd >
110
108
111
109
112
-
113
110
<dt class =" option-term " id =" option-cargo-bench---all " ><a class =" option-anchor " href =" #option-cargo-bench---all " ></a ><code >--all</code ></dt >
114
111
<dd class =" option-desc " >Deprecated alias for <code >--workspace</code >.</dd >
115
112
116
113
117
-
118
114
<dt class =" option-term " id =" option-cargo-bench---exclude " ><a class =" option-anchor " href =" #option-cargo-bench---exclude " ></a ><code >--exclude</code > <em >SPEC</em >…</dt >
119
115
<dd class =" option-desc " >Exclude the specified packages. Must be used in conjunction with the
120
116
<code >--workspace</code > flag. This flag may be specified multiple times and supports
@@ -125,7 +121,6 @@ single quotes or double quotes around each pattern.</dd>
125
121
126
122
</dl >
127
123
128
-
129
124
### Target Selection
130
125
131
126
When no target selection options are given, ` cargo bench ` will build the
@@ -160,7 +155,6 @@ is set when the integration test is built so that it can use the
160
155
[ ` env ` macro] ( https://doc.rust-lang.org/std/macro.env.html ) to locate the
161
156
executable.
162
157
163
-
164
158
Passing target selection flags will benchmark only the specified
165
159
targets.
166
160
@@ -184,7 +178,6 @@ and supports common Unix glob patterns.</dd>
184
178
<dd class =" option-desc " >Benchmark all binary targets.</dd >
185
179
186
180
187
-
188
181
<dt class =" option-term " id =" option-cargo-bench---example " ><a class =" option-anchor " href =" #option-cargo-bench---example " ></a ><code >--example</code > <em >name</em >…</dt >
189
182
<dd class =" option-desc " >Benchmark the specified example. This flag may be specified multiple times
190
183
and supports common Unix glob patterns.</dd >
@@ -230,7 +223,6 @@ manifest settings for the target.</dd>
230
223
231
224
</dl >
232
225
233
-
234
226
### Feature Selection
235
227
236
228
The feature flags allow you to control which features are enabled. When no
@@ -259,7 +251,6 @@ be specified multiple times, which enables all specified features.</dd>
259
251
260
252
</dl >
261
253
262
-
263
254
### Compilation Options
264
255
265
256
<dl >
@@ -275,19 +266,16 @@ target artifacts are placed in a separate directory. See the
275
266
<a href =" ../guide/build-cache.html " >build cache</a > documentation for more details.</dd >
276
267
277
268
278
-
279
269
<dt class =" option-term " id =" option-cargo-bench---profile " ><a class =" option-anchor " href =" #option-cargo-bench---profile " ></a ><code >--profile</code > <em >name</em ></dt >
280
270
<dd class =" option-desc " >Benchmark with the given profile.
281
271
See <a href =" ../reference/profiles.html " >the reference</a > for more details on profiles.</dd >
282
272
283
273
284
-
285
274
<dt class =" option-term " id =" option-cargo-bench---ignore-rust-version " ><a class =" option-anchor " href =" #option-cargo-bench---ignore-rust-version " ></a ><code >--ignore-rust-version</code ></dt >
286
275
<dd class =" option-desc " >Benchmark the target even if the selected Rust compiler is older than the
287
276
required Rust version as configured in the project’s <code >rust-version</code > field.</dd >
288
277
289
278
290
-
291
279
<dt class =" option-term " id =" option-cargo-bench---timings=fmts " ><a class =" option-anchor " href =" #option-cargo-bench---timings=fmts " ></a ><code >--timings=</code ><em >fmts</em ></dt >
292
280
<dd class =" option-desc " >Output information how long each compilation takes, and track concurrency
293
281
information over time. Accepts an optional comma-separated list of output
@@ -306,7 +294,6 @@ information about timing information.</li>
306
294
307
295
308
296
309
-
310
297
</dl >
311
298
312
299
### Output Options
@@ -318,7 +305,6 @@ specified with the <code>CARGO_TARGET_DIR</code> environment variable, or the
318
305
<code >build.target-dir</code > <a href =" ../reference/config.html " >config value</a >.
319
306
Defaults to <code >target</code > in the root of the workspace.</dd >
320
307
321
-
322
308
</dl >
323
309
324
310
### Display Options
@@ -358,7 +344,6 @@ terminal.</li>
358
344
<a href =" ../reference/config.html " >config value</a >.</dd >
359
345
360
346
361
-
362
347
<dt class =" option-term " id =" option-cargo-bench---message-format " ><a class =" option-anchor " href =" #option-cargo-bench---message-format " ></a ><code >--message-format</code > <em >fmt</em ></dt >
363
348
<dd class =" option-desc " >The output format for diagnostic messages. Can be specified multiple times
364
349
and consists of comma-separated values. Valid values:</p >
@@ -382,7 +367,6 @@ coming from rustc are still emitted. Cannot be used with <code>human</code> or <
382
367
</ul ></dd >
383
368
384
369
385
-
386
370
</dl >
387
371
388
372
### Manifest Options
@@ -393,7 +377,6 @@ coming from rustc are still emitted. Cannot be used with <code>human</code> or <
393
377
<code >Cargo.toml</code > file in the current directory or any parent directory.</dd >
394
378
395
379
396
-
397
380
<dt class =" option-term " id =" option-cargo-bench---frozen " ><a class =" option-anchor " href =" #option-cargo-bench---frozen " ></a ><code >--frozen</code ></dt >
398
381
<dt class =" option-term " id =" option-cargo-bench---locked " ><a class =" option-anchor " href =" #option-cargo-bench---locked " ></a ><code >--locked</code ></dt >
399
382
<dd class =" option-desc " >Either of these flags requires that the <code >Cargo.lock</code > file is
@@ -417,7 +400,6 @@ See the <a href="cargo-fetch.html">cargo-fetch(1)</a> command to download depend
417
400
offline.</p >
418
401
<p >May also be specified with the <code >net.offline</code > <a href =" ../reference/config.html " >config value</a >.</dd >
419
402
420
-
421
403
</dl >
422
404
423
405
### Common Options
@@ -460,7 +442,6 @@ requires the <code>-Z unstable-options</code> flag to enable (see
460
442
461
443
</dl >
462
444
463
-
464
445
### Miscellaneous Options
465
446
466
447
The ` --jobs ` argument affects the building of the benchmark executable but
@@ -477,7 +458,6 @@ parallel jobs to the number of logical CPUs plus provided value. If
477
458
a string <code >default</code > is provided, it sets the value back to defaults.
478
459
Should not be 0.</dd >
479
460
480
-
481
461
</dl >
482
462
483
463
While ` cargo bench ` involves compilation, it does not provide a ` --keep-going `
@@ -493,13 +473,11 @@ stopping at the first failure. To "compile" as many benchmarks as possible, use
493
473
See [ the reference] ( ../reference/environment-variables.html ) for
494
474
details on environment variables that Cargo reads.
495
475
496
-
497
476
## EXIT STATUS
498
477
499
478
* ` 0 ` : Cargo succeeded.
500
479
* ` 101 ` : Cargo failed to complete.
501
480
502
-
503
481
## EXAMPLES
504
482
505
483
1 . Build and execute all the benchmarks of the current package:
0 commit comments