a simple integration binary that automates the process of running cargo build
with a certain profile and samply
afterwards.
It installs samply if it is not available using cargo install
.
for now you can install it from crates.io or directly from github.com
# crates.io
cargo install cargo-samply
# or from git
cargo install --git https://github.com/PhilippPolterauer/cargo-samply.git
The usage is quite simple
$ cargo new mybinary
$ cd mybinary
$ cargo samply
cargo.toml: ~/rust/mybinary/Cargo.toml
'samply' profile was added to 'Cargo.toml'
Compiling mybinary v0.1.0 (~/rust/mybinary)
Finished samply [optimized + debuginfo] target(s) in 0.18s
Hello, world!
Local server listening at http://127.0.0.1:3001
when opening the server address (127.0.0.1:3001) the output should look like the following.
there is a test package at test/testpackage/
which can be used for highlighting the following options.
cargo-samply
respects the default-run argument:
$ cargo samply
running 'cargo locate-project'
cargo.toml: /home/philipp/rust/cargo-samply/tests/testpackage/Cargo.toml
running 'cargo build --profile samply'
running 'samply record target/samply/main'
cargo-samply
can be targeted at certain binaries e.g. --example
$ cargo samply --example hello
running 'cargo locate-project'
cargo.toml: /home/philipp/rust/cargo-samply/tests/testpackage/Cargo.toml
running 'cargo build --profile samply --example hello'
running 'samply record target/samply/examples/hello'
or --bin
$ cargo samply --bin another
running 'cargo locate-project'
cargo.toml: /home/philipp/rust/cargo-samply/tests/testpackage/Cargo.toml
running 'cargo build --profile samply --bin another'
running 'samply record target/samply/another'
additional arguments can be passed after --
$ cargo samply --bin another -- 'new text'
running 'cargo locate-project'
cargo.toml: /home/philipp/rust/cargo-samply/tests/testpackage/Cargo.toml
running 'cargo build --profile samply --bin another'
running 'samply record target/samply/another "new text"'
Hello, new text!