1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
//! # cargo-samply
//!
//! A cargo subcommand to automate the process of running [samply](https://github.com/mstange/samply)
//! for profiling Rust project binaries.
//!
//! ## Overview
//!
//! `cargo-samply` simplifies the workflow of profiling Rust applications by:
//! - Automatically building your project with debug symbols
//! - Managing the `samply` profiling profile in `Cargo.toml`
//! - Running `samply` with the correct binary path
//! - Supporting binaries, examples, benches, and tests
//! - Providing flexible feature and profile selection
//!
//! ## Installation
//!
//! ```bash
//! cargo install cargo-samply
//! ```
//!
//! You also need to install `samply`:
//! ```bash
//! cargo install samply
//! ```
//!
//! ## Usage
//!
//! ### Basic Usage
//!
//! Profile the default binary:
//! ```bash
//! cargo samply
//! ```
//!
//! Profile a specific binary:
//! ```bash
//! cargo samply --bin my-binary
//! ```
//!
//! Profile an example:
//! ```bash
//! cargo samply --example my-example
//! ```
//!
//! Profile a benchmark target:
//! ```bash
//! cargo samply --bench throughput -- --sample-size 10
//! ```
//!
//! Profile a test target:
//! ```bash
//! cargo samply --test my-integration-test
//! ```
//!
//! Bench targets must be referenced using their exact Cargo target names—no
//! suffix rewriting or aliasing occurs.
//!
//! When you run with `--bench <target>`, cargo-samply will always execute the
//! final binary with `--bench` so it behaves exactly like
//! `cargo bench`.
//!
//! The current bench flow has only been validated with Criterion-driven setups.
//! Other bespoke runners are untested and may need adjustments.
//!
//! ### Advanced Options
//!
//! Use a different profile:
//! ```bash
//! cargo samply --profile release
//! ```
//!
//! Enable specific features:
//! ```bash
//! cargo samply --features feature1,feature2
//! # or
//! cargo samply --features feature1 --features feature2
//! ```
//!
//! Run without samply (just execute the binary):
//! ```bash
//! cargo samply --no-samply -- arg1 arg2
//! ```
//!
//! Quiet mode (suppress output):
//! ```bash
//! cargo samply --quiet
//! ```
//!
//! Verbose mode (debug output):
//! ```bash
//! cargo samply --verbose
//! ```
//!
//! ### Passing Arguments to the Binary
//!
//! You can pass arguments to the binary being profiled by using `--` to separate
//! cargo-samply options from binary arguments:
//!
//! ```bash
//! # Pass arguments to the default binary
//! cargo samply -- arg1 arg2 --flag value
//! ```
//!
//! ```bash
//! # Pass arguments to a specific binary
//! cargo samply --bin my-binary -- --input file.txt --verbose
//! ```
//!
//! ```bash
//! # Pass arguments to an example
//! cargo samply --example my-example -- --config config.json
//! ```
//!
//! When using `--no-samply` (to just run the binary without profiling),
//! arguments are passed through directly:
//!
//! ```bash
//! # Run binary with arguments but without profiling
//! cargo samply --no-samply --bin my-binary -- --debug --port 8080
//! ```
//!
//! **Note**: All arguments after `--` are passed directly to your binary,
//! so you can use any command-line arguments your binary supports.
//!
//! ## How It Works
//!
//! 1. **Profile Management**: Automatically adds a `samply` profile to your `Cargo.toml` if it doesn't exist
//! 2. **Build**: Compiles your project with the specified profile
//! 3. **Binary Resolution**: Determines which binary to run based on `--bin`, `--example`, or `default-run`
//! 4. **Profiling**: Launches `samply record` with the built binary
//!
//! ## The `samply` Profile
//!
//! The tool automatically adds this profile to your `Cargo.toml`:
//!
//! ```toml
//! [profile.samply]
//! inherits = "release"
//! debug = true
//! ```
//!
//! This provides optimized code with debug symbols for accurate profiling.
pub use ;
pub use ;