cmyr / cargo-instruments Goto Github PK
View Code? Open in Web Editor NEWA cargo plugin to generate Xcode Instruments trace files
License: MIT License
A cargo plugin to generate Xcode Instruments trace files
License: MIT License
Given:
cargo-features = ['named-profiles']
[workspace]
members = [
"foo",
]
I get the error:
ndmitchell@ndmitchell-mbp buck2 % cargo instruments
failed to parse manifest at `/Users/ndmitchell/fbsource/fbcode/buck2/Cargo.toml`
It would be great if this tool could properly parse such manifest files.
Given the following code
fn main() {
let arg = std::env::args().nth(1).unwrap();
if arg.contains(" ") {
loop{}
}
}
profiling it with cargo instruments "space here"
completes in few seconds as the single argument appears to get split and passed as two arguments "space" and "here" separately.
hungkhoaitay@Hungs-MacBook-Air in-summer-we-render % cargo instruments -t time --release --bin ply_to_png -- -i $plySource/binary_longdress/longdress_vox10_1223.ply -x 600 -w 400 -h 800 -o ouput.png
Compiling in-summer-we-render v0.1.0 (/Users/hungkhoaitay/Documents/Uni/Summer Y1/CP3108B/in-summer-we-render)
Finished release [optimized + debuginfo] target(s) in 3.32s
Profiling target/release/ply_to_png with template 'Time Profiler'
2021-10-10 22:21:11.467991+0800 ply_to_png[79442:7334462] +[MTLIOAccelDevice registerDevices]: Zero Metal services found
Image saved to "ouput.png"
Failed instruments errored: [ERROR] Run issues detected (trace is still ready to be viewed):
* Failed to pause recording session: Cannot pause session session unless it's running. Current state: kSessionError
* Failed to start the recording: ktrace cannot trace the system under Rosetta translation
* No configuration information received, will have to guess. Data may be misleading.
* Data stream: Time Mapping
* Failed to resume recording session: Cannot resume session session unless it's paused. Current state: kSessionError
Thank you
I'm trying to debug a memory leak (see inejge/ldap3#47) but I always need to run cargo instruments
twice to get data in Instruments.
cargo instruments --limit 25000 --template Leaks --open
I think the problem happens when cargo rebuilds the binary before profiling it. This behaviour is consistent. I touch src/main.rs
and run cargo instruments
. The package gets rebuilt, but when Instruments launches, there is no profiling information. If I re-run cargo instruments
I do get the profiling information.
I will attach a screencast of the behaviour soon.
Screencast: https://vimeo.com/422466785
I'm trying to profile some code, but whenever I run cargo-instruments
I encounter this error:
The document “Launch_simple_agent-0f8bddef344bdebb_2021-07-27_18.16.23_D2914DDE.trace” could not be opened.
*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil
When building on macOS with Rust 1.49 (from cargo install cargo-instruments
):
error[E0283]: type annotations needed
--> /Users/djc/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-0.47.0/src/cargo/util/config/de.rs:491:63
|
491 | seed.deserialize(Tuple2Deserializer(1i32, env.as_ref()))
| ----^^^^^^--
| | |
| | cannot infer type for type parameter `T` declared on the trait `AsRef`
| this method call resolves to `&T`
|
= note: cannot satisfy `std::string::String: AsRef<_>`
I'm trying to run a command like this:
cargo instruments --all-features --bench $bench -t time --profile-time 5
Where --profile-time 5
is supposed to be an argument to the benchmark for criterion: https://bheisler.github.io/criterion.rs/book/user_guide/profiling.html.
However, I get an error:
error: Found argument '--profile-time' which wasn't expected, or isn't valid in this context
I tried the classic --
e.g.
cargo instruments --all-features --bench $bench -t time -- --profile-time 5
I didn't get an error, but the benchmark definitely didn't run for 5 seconds. I'm not sure exactly what happened.
When trying to install cargo-instruments, it bails out with a linker error.
Versions and logs below.
thyme:diffusion vidstige$ rustc --version
rustc 1.35.0 (3c235d560 2019-05-20)
thyme:diffusion vidstige$ cargo version
cargo 1.35.0 (6f3e9c367 2019-04-04)
$ cargo install cargo-instruments
Updating crates.io index
Installing cargo-instruments v0.2.1
Compiling proc-macro2 v1.0.6
Compiling unicode-xid v0.2.0
Compiling syn v1.0.8
Compiling maybe-uninit v2.0.0
Compiling serde v1.0.102
Compiling autocfg v0.1.7
Compiling libc v0.2.65
Compiling pkg-config v0.3.17
Compiling cc v1.0.47
Compiling memchr v2.2.1
Compiling getrandom v0.1.13
Compiling cfg-if v0.1.10
Compiling proc-macro2 v0.4.30
Compiling semver-parser v0.7.0
Compiling matches v0.1.8
Compiling unicode-xid v0.1.0
Compiling bitflags v1.2.1
Compiling lazy_static v1.4.0
Compiling failure_derive v0.1.6
Compiling typenum v1.11.2
Compiling ppv-lite86 v0.2.6
Compiling log v0.4.8
Compiling ryu v1.0.2
Compiling curl v0.4.25
Compiling regex-syntax v0.6.12
Compiling core-foundation-sys v0.6.2
Compiling crc32fast v1.2.0
Compiling rustc-demangle v0.1.16
Compiling percent-encoding v1.0.1
Compiling syn v0.15.44
Compiling fnv v1.0.6
Compiling quick-error v1.2.2
Compiling unicode-segmentation v1.6.0
Compiling same-file v1.0.5
Compiling adler32 v1.0.4
Compiling byteorder v1.3.2
Compiling itoa v0.4.4
Compiling unicode-width v0.1.6
Compiling termcolor v1.0.5
Compiling ansi_term v0.11.0
Compiling hex v0.3.2
Compiling strsim v0.8.0
Compiling vec_map v0.8.1
Compiling remove_dir_all v0.5.2
Compiling lazycell v1.2.1
Compiling shell-escape v0.1.4
Compiling bytesize v1.0.0
Compiling home v0.3.4
Compiling rustc-workspace-hack v1.0.0
Compiling glob v0.2.11
Compiling num-traits v0.2.9
Compiling num-integer v0.1.41
Compiling unicode-bidi v0.3.4
Compiling thread_local v0.3.6
Compiling crossbeam-utils v0.6.6
Compiling libz-sys v1.0.25
Compiling openssl-sys v0.9.52
Compiling libnghttp2-sys v0.1.2
Compiling backtrace-sys v0.1.32
Compiling curl-sys v0.4.24
Compiling libssh2-sys v0.2.13
Compiling libgit2-sys v0.7.11
Compiling c2-chacha v0.2.3
Compiling humantime v1.3.0
Compiling walkdir v2.2.9
Compiling miniz_oxide v0.3.5
Compiling heck v0.3.1
Compiling textwrap v0.11.0
Compiling crossbeam-channel v0.3.9
Compiling smallvec v0.6.13
Compiling commoncrypto-sys v0.2.0
Compiling socket2 v0.3.11
Compiling atty v0.2.13
Compiling filetime v0.2.8
Compiling fs2 v0.4.3
Compiling num_cpus v1.11.1
Compiling time v0.1.42
Compiling aho-corasick v0.7.6
Compiling bstr v0.2.8
Compiling jobserver v0.1.17
Compiling core-foundation v0.6.4
Compiling sized-chunks v0.1.3
Compiling quote v1.0.2
Compiling quote v0.6.13
Compiling unicode-normalization v0.1.9
Compiling rand_core v0.5.1
Compiling clap v2.33.0
Compiling commoncrypto v0.2.0
Compiling tar v0.4.26
Compiling flate2 v1.0.13
Compiling regex v1.3.1
Compiling backtrace v0.3.40
Compiling rand_chacha v0.2.1
Compiling crypto-hash v0.3.4
Compiling idna v0.1.5
Compiling chrono v0.4.9
Compiling globset v0.4.4
Compiling env_logger v0.6.2
Compiling rand v0.7.2
Compiling url v1.7.2
Compiling structopt-derive v0.2.18
Compiling serde_derive v1.0.102
Compiling synstructure v0.12.3
Compiling tempfile v3.1.0
Compiling ignore v0.4.10
Compiling structopt v0.2.18
Compiling git2 v0.8.0
Compiling failure v0.1.6
Compiling opener v0.3.2
Compiling git2-curl v0.9.0
Compiling semver v0.9.0
Compiling serde_json v1.0.41
Compiling url_serde v0.2.0
Compiling serde_ignored v0.0.4
Compiling toml v0.4.10
Compiling rustc_version v0.2.3
Compiling im-rc v12.3.4
Compiling crates-io v0.22.0
Compiling rustfix v0.4.6
Compiling cargo v0.34.0
Compiling cargo-instruments v0.2.1
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-m64" "-L" "/Users/vidstige/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/cargo_instruments-c322ae0ee4e4ddae.cargo_instruments.2dl7exyk-cgu.0.rcgu.o" "/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/cargo_instruments-c322ae0ee4e4ddae.cargo_instruments.2dl7exyk-cgu.1.rcgu.o" "/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/cargo_instruments-c322ae0ee4e4ddae.cargo_instruments.2dl7exyk-cgu.10.rcgu.o" "/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/cargo_instruments-c322ae0ee4e4ddae.cargo_instruments.2dl7exyk-cgu.11.rcgu.o" "/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/cargo_instruments-c322ae0ee4e4ddae.cargo_instruments.2dl7exyk-cgu.12.rcgu.o" "/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/cargo_instruments-c322ae0ee4e4ddae.cargo_instruments.2dl7exyk-cgu.13.rcgu.o" "/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/cargo_instruments-c322ae0ee4e4ddae.cargo_instruments.2dl7exyk-cgu.14.rcgu.o" "/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/cargo_instruments-c322ae0ee4e4ddae.cargo_instruments.2dl7exyk-cgu.15.rcgu.o" "/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/cargo_instruments-c322ae0ee4e4ddae.cargo_instruments.2dl7exyk-cgu.2.rcgu.o" "/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/cargo_instruments-c322ae0ee4e4ddae.cargo_instruments.2dl7exyk-cgu.3.rcgu.o" "/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/cargo_instruments-c322ae0ee4e4ddae.cargo_instruments.2dl7exyk-cgu.4.rcgu.o" "/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/cargo_instruments-c322ae0ee4e4ddae.cargo_instruments.2dl7exyk-cgu.5.rcgu.o" "/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/cargo_instruments-c322ae0ee4e4ddae.cargo_instruments.2dl7exyk-cgu.6.rcgu.o" "/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/cargo_instruments-c322ae0ee4e4ddae.cargo_instruments.2dl7exyk-cgu.7.rcgu.o" "/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/cargo_instruments-c322ae0ee4e4ddae.cargo_instruments.2dl7exyk-cgu.8.rcgu.o" "/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/cargo_instruments-c322ae0ee4e4ddae.cargo_instruments.2dl7exyk-cgu.9.rcgu.o" "-o" "/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/cargo_instruments-c322ae0ee4e4ddae" "/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/cargo_instruments-c322ae0ee4e4ddae.452gc1iycagiuhpo.rcgu.o" "-Wl,-dead_strip" "-nodefaultlibs" "-L" "/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps" "-L" "/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/build/curl-sys-cc5b6e4706d1b64e/out/build" "-L" "/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/build/libnghttp2-sys-7a33fad19053d633/out/i/lib" "-L" "/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/build/backtrace-sys-bba161a73b3f67ce/out" "-L" "/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/build/libgit2-sys-ff5738f15f32050f/out/build" "-L" "/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/build/libssh2-sys-9a81d0f2d1b2bf72/out/build" "-L" "/opt/local/lib" "-L" "/Users/vidstige/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libstructopt-84cd54a34e845281.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libchrono-19b94a02d477b810.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libnum_integer-3e5c81866f747a7a.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libnum_traits-70402ab88d57ccdc.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libtime-61cfe2b3ed5ab8e4.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libcargo-81844cf9593990e5.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libhome-aa54f7c481c2fd92.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/liburl_serde-d8826f0248d6b1af.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libnum_cpus-b0d4cf14ac87f891.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libserde_ignored-e6fc166046a97e92.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libcrypto_hash-f27ea485f2fc816f.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libcommoncrypto-28ac2794207bd2ca.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libcommoncrypto_sys-d60cb1e82ac2a216.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libshell_escape-0719734477c29d25.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libfs2-1f55bae2f73ad11f.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libclap-0cbac4f15e8bb459.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libvec_map-cc81e61bdd284386.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libtextwrap-a7d00072fdc654e9.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libunicode_width-9c246a5aae7920d3.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libstrsim-bdfb754359e5892c.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libansi_term-6ecf8980d58b26d9.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libhex-ca9f47ca41e6f715.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libignore-5e8b76edada3c8b4.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libwalkdir-624052935c971d79.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libglobset-54710edff42b2e0a.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libregex-f4680a457cbf1768.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libthread_local-e80c220f6a99c1a7.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libregex_syntax-04cc7b6c1b36a9fb.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libfnv-1fff3f96ea60fc7b.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libbstr-f3aabc10239d16ba.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libaho_corasick-da4fe85938c6a351.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libmemchr-b79bf003907737f4.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libcrossbeam_channel-b6ffea780245a0c2.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libcrates_io-934a0c268a3078e4.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/librustfix-4e2a7c9487299026.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libtar-cd80c2671a7f52e0.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libserde_json-dbb1d424c3aa0823.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libryu-7c93104639dbc8da.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libitoa-f93cfce5fee57079.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libflate2-1085b0dd7dda7a20.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libcrc32fast-b647ea0b367ce25a.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libtoml-7da39edc9096094f.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libgit2-632383d72fedc4f1.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libbitflags-d99bc7b1e637160b.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/liblibgit2_sys-67c028ac18fa56b6.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/liblibssh2_sys-0416b12e399d02c2.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libopenssl_sys-211f42d4ed047f18.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libtempfile-25dcb2de9c9d0895.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/librand-1ad0426fe006f188.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/librand_chacha-7521349818d2a58e.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libc2_chacha-db9da48fdbec9296.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libppv_lite86-4e375b9859a567df.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/librand_core-f96693e6441cb275.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libgetrandom-89f068c185f60a97.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libremove_dir_all-bc756a2217166ad1.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libopener-b64e07a9d29a1e0c.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libglob-67159c227cee1afb.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libtermcolor-1490f8a91643dc2b.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libatty-c679e49eddf5d8f1.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libim_rc-37c072810aadb687.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libsized_chunks-d9e5fe06109ef112.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libtypenum-0306922ce72cb6b1.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libcurl-a9dad29fa2080448.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libsocket2-3b1535634bd7ef8c.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libcurl_sys-6473282adb1b55e4.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/liblibz_sys-ed3cd9cabd72b017.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/liblibnghttp2_sys-3437c04724f6b5df.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libbytesize-3ea2c42e7d4a8420.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/liburl-9614a198d69373b9.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libpercent_encoding-846f3cafc27dfd20.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libidna-3652700f088fee16.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libunicode_normalization-e3b4b4aa47a12051.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libsmallvec-5e3fde77e0ae80ff.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libmaybe_uninit-66537896117dc49f.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libunicode_bidi-bafc4ecdb0334967.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libmatches-31019cec36bf7ce1.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libcore_foundation-a65f743d57f910cf.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libcore_foundation_sys-1b31ffeca7b3914b.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libcrossbeam_utils-ef0cfbd8abed7066.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/liblazy_static-d5e001334e526fa1.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libfiletime-dcb0c09f6434f081.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/liblazycell-52c519bf3bc40540.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libjobserver-8bb21b1eb26df595.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libsemver-07ae811d62b1d200.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libsemver_parser-3ac69a871d4a5ee8.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libsame_file-93609a10a4f3aa46.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libserde-35b23d74cae7df31.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/liblog-45fd1fa8cc468ff1.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libfailure-191173a877b44ff5.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libbacktrace-018ce674ba451e36.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libbacktrace_sys-f8779df7884377fb.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/liblibc-59d0176fe02b035e.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/libcfg_if-c7288ee47d6a9406.rlib" "/private/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF/release/deps/librustc_demangle-b41fd9c808a6089f.rlib" "/Users/vidstige/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libstd-1dfdd87ff6e60945.rlib" "/Users/vidstige/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_unwind-2afa3d9ef23111d9.rlib" "/Users/vidstige/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libbacktrace_sys-36ad4a075c8befe6.rlib" "/Users/vidstige/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_demangle-5af683adadcc6add.rlib" "/Users/vidstige/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libunwind-11930efa977c702c.rlib" "/Users/vidstige/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liblibc-ebd54b7045c72e75.rlib" "/Users/vidstige/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/liballoc-f9e1c7e0a4778297.rlib" "/Users/vidstige/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/librustc_std_workspace_core-06903edfb4cff5d5.rlib" "/Users/vidstige/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcore-9becee61e6692014.rlib" "/Users/vidstige/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libcompiler_builtins-f3814eca990faded.rlib" "-liconv" "-framework" "Security" "-framework" "CoreFoundation" "-lssl" "-lcrypto" "-framework" "Security" "-framework" "CoreFoundation" "-lz" "-framework" "CoreFoundation" "-lSystem" "-lresolv" "-lc" "-lm"
= note: Undefined symbols for architecture x86_64:
"_iconv", referenced from:
_git_path_iconv in liblibgit2_sys-67c028ac18fa56b6.rlib(path.o)
(maybe you meant: _git_path_iconv_init_precompose, _git_path_iconv , _git_path_iconv_clear )
"_iconv_open", referenced from:
_git_path_direach in liblibgit2_sys-67c028ac18fa56b6.rlib(path.o)
_git_path_iconv_init_precompose in liblibgit2_sys-67c028ac18fa56b6.rlib(path.o)
_git_path_diriter_init in liblibgit2_sys-67c028ac18fa56b6.rlib(path.o)
"_iconv_close", referenced from:
_git_path_direach in liblibgit2_sys-67c028ac18fa56b6.rlib(path.o)
_git_path_iconv_clear in liblibgit2_sys-67c028ac18fa56b6.rlib(path.o)
_git_path_diriter_free in liblibgit2_sys-67c028ac18fa56b6.rlib(path.o)
_git_path_dirload in liblibgit2_sys-67c028ac18fa56b6.rlib(path.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: aborting due to previous error
error: failed to compile `cargo-instruments v0.2.1`, intermediate artifacts can be found at `/var/folders/_l/lb2g9v91391f2gsvs53sml5c0000gn/T/cargo-installl6wLqF`
Caused by:
Could not compile `cargo-instruments`.
To learn more, run the command again with --verbose.
Right now, I have to cd
into a particular package within my workspace to use cargo-instruments
. Other builtin cargo commands (like cargo run
and cargo build
) support a -p
/--package
argument so that one doesn't need to cd
around. It would be good for cargo-instruments
to support the same option.
I was able to attach directly from the instrument to the PID.
Is this something different? Am I missing something?
Thanks
Thank you for providing this tool! I'm getting the following error:
Finished dev [unoptimized + debuginfo] target(s) in 0.04s
Profiling target/debug/run_example with template 'Allocations'
Failed instruments errored: xcrun: error: unable to find utility "xctrace", not a developer tool or in PATH
I installed through brew install cargo-instruments
. Then I tried running the following command:
cargo instruments -t Allocations --bin <bin name>
I tried to install the carg-instrumensts package both via brew
and directly via cargo
on an Apple M1 with a Silicon cpu.
First, the brew
installation gave a red herring error
failed to parse manifest at `/path/to/Cargo.toml`
which seemed very odd when looking at the source code and seeing it uses functions from the cargo
crate, so I tried importing the manifest file myself with the same calls and it worked fine
Second, the installation via cargo
cargo install cargo-instruments
failed with an architecture error
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Tried switching to the x86 rust toolchain which will compile the binary and attempt to run it through Rosetta (I am using nightly
)
$ rustup default nightly-x86_64-apple-darwin
Compilation was fine, but profiling doesn't work
Profiling target/release/simulator with template 'Time Profiler'
Failed instruments errored: Run issues were detected (trace is still ready to be viewed):
* [Error] Failed to start the recording: ktrace cannot trace the system under Rosetta translation
* [Error] Unexpected failure: Data source agent failed to arm.
* [Error] Unexpected failure: Couriers have returned unexpectedly.
Hi, what I'd like to do is to be able to profile running a Cargo-based project from a different working directory. From a little reading it looks like the standard argument to Cargo subcommands to achieve that is --manifest-path ../path/to/Cargo.toml
, eg I'm able to do cargo run --manifest-path ../path/to/Cargo.toml
from my desired working directory. So would it make sense for cargo instruments
to also support being invoked with --manifest-path
eg cargo instruments --manifest-path ../path/to/Cargo.toml -t alloc
?
I'm trying in vain to run cargo instruments --bench <name>
inside a workspace containing multiple members, each with multiple test and bench targets. Unfortunately, the only error I ever get is
Failed missing target bench <name>
I cannot find a single example of how to specify a given bench target, or really any target that isn't just the main.rs file, nor does there appear to be a way to get the list of available targets.
Given that to throw the error, the app first collects a list of all available targets here, it would be extremely helpful to have the ability to just print that particular list.
The command report the following error:
cargo instruments -t Allocations --bin struct_with_string_test
Finished dev [unoptimized + debuginfo] target(s) in 0.00s
Profiling target/debug/struct_with_string_test with template 'Allocations'
Failed instruments errored: Run issues were detected (trace is still ready to be viewed):
* [Error] Failed to attach to target process
* [Error] Failed to execute loader thread for /Applications/Xcode.app/Contents/SharedFrameworks/DVTInstrumentsFoundation.framework/Resources/liboainject.dylib in target; target process 97865 likely exited
The instruments file are generated, and I can open the file with instruments
. instruments
showed the same error. I'm not familiar with instruments
and xcode
, could you provide me with some information so I can debug the problem?
Hello!
I wanted to try this tool, but when I install it with cargo install
and try to monitor my program, it doesn’t work.
Here is the error message I receive;
Updating crates.io index
Failed no matching package named `charabia` found
location searched: registry `crates-io`
required by package `milli v0.29.3 (https://github.com/meilisearch/milli.git?tag=v0.29.3#f1d848bb)`
... which satisfies git dependency `milli` (locked to 0.29.3) of package `meilisearch-auth v0.28.0 (/Users/irevoire/MeiliSearch/meilisearch-auth)`
... which satisfies path dependency `meilisearch-auth` (locked to 0.28.0) of package `meilisearch-http v0.28.0 (/Users/irevoire/MeiliSearch/meilisearch-http)`
no matching package named `charabia` found
location searched: registry `crates-io`
required by package `milli v0.29.3 (https://github.com/meilisearch/milli.git?tag=v0.29.3#f1d848bb)`
... which satisfies git dependency `milli` (locked to 0.29.3) of package `meilisearch-auth v0.28.0 (/Users/irevoire/MeiliSearch/meilisearch-auth)`
... which satisfies path dependency `meilisearch-auth` (locked to 0.28.0) of package `meilisearch-http v0.28.0 (/Users/irevoire/MeiliSearch/meilisearch-http)`
BUT, if I build it from the source, it works. Thus, maybe we just need to do a new release?
When I try to run an Allocations profile I get the following error:
Failed instruments errored: [ERROR] Run issues detected (trace is still ready to be viewed):
* Failed to gain authorization
I'm on an M1 Mac running macOS Big Sur 11.4.
I suspect that it's related to this issue: https://developer.apple.com/forums/thread/681687
But if that were the case then it seems likely other users of cargo-instruments
would be hitting it as well. Is anyone else hitting this issue?
I am trying to get cargo-instruments
running like this:
cargo instruments -t time
Finished dev [unoptimized + debuginfo] target(s) in 0.96s
Profiling target/debug/cli with template 'Time Profiler'
<Prints my application logs>
Failed instruments errored:
I have tried searching the issues here for that error, but I can't find anything.
I have xcode installed through Xcodes
and I have verified that I can start the Instruments app.
I have used Instruments to instrument iOS applications previously.
Thanks <3
When running with cargo instruments I can't see any output on the screen, is there a way to enable stdout?
Hello, thanks again for the crate.
After upgrading to Ventura, every time I launched cargo instruments
it would hang forever. I then realised I didn't restarted Xcode
since the upgrade and bingo, it asks for my password to finish completion I guess. After it, cargo instrument resumed smoothly.
I'm not sure at which point the process was hanging and If it's catchable for the crate, but thought to report it nevertheless, feel free to close if considered out-of-scope.
I am trying to run cargo-instruments via:
cargo instruments -t alloc
When I do, everything seems to run:
Finished dev [unoptimized + debuginfo] target(s) in 1.45s
Profiling target/debug/tmp-exp-01 with template 'Allocations'
and I see a new .trace
file generated in ./target/instruments
, but if I try to open the file, Instruments fails with the error:
The document “tmp-exp-01_Allocations_2023-07-21_162620-077.trace” could not be opened. Document Missing Template Error
I'm using:
Instruments: Version 14.3.1 (14E300c)
cargo-instruments: 0.4.8
rustc: 1.70.0
Any ideas what might be going on?
Thanks!
I am trying to run agains a binary which is part of a workspace, it fails with this message:
manifest path `/path/to/project/root/Cargo.toml` is a virtual manifest, but this command requires running against an actual package in this workspace
How should I proceed?
Thanks!
hadn't intended to leave this in; I didn't get around to figuring out how to programatically enable debug symbols.
Hello,
I have the problem where the source viewer only works for main.rs
and any other code is unavailable.
1.36 s 99.8% 0 s foo_rs::main::he70bb0403010c57b
1.36 s 99.4% 540.00 ms vm::VM::run::h17ad8734cf0cc68c
1.00 ms 0.0% 1.00 ms _$LT$vm..Object$u20$as$u20$core..clone..Clone$GT$::clone::h54aee501194c726f
1.00 ms 0.0% 1.00 ms core::option::Option$LT$T$GT$::expect::hbe2c0641a3e2d7e0
1.00 ms 0.0% 1.00 ms core::slice::_$LT$impl$u20$$u5b$T$u5d$$GT$::get::h5d5c173e759664a6
1.00 ms 0.0% 1.00 ms alloc::vec::Vec$LT$T$C$A$GT$::push::hf5b5c1b6053794b4
1.00 ms 0.0% 1.00 ms core::option::Option$LT$T$GT$::expect::h21b34825060683ed
The error is can't find source code for selected symbol
It seems it is not possible to run cargo instruments
on a benchmark target (i.e. what gets executed by cargo bench
). I think this would be a very useful addition!
A more generic solution might be to make it possible to just pass in a path to an arbitrary executable file.
Neither cargo install cargo-instruments
nor the Nix instructions worked for me for the same reason: openssl-sys
expects openssl to have been installed via Homebrew. It would be good to mention this requirement as well as mention that
$ cargo install --features vendored-openssl -- cargo-instruments
works if you don't have Homebrew installed.
--features vendored-openssl
flag to the Nix instructions did not work for me.
error: failed to run custom build command for `openssl-sys v0.9.75`
Caused by:
process didn't exit successfully: `/tmp/cargo-installrmUUH3/release/build/openssl-sys-d14eba0fcebfd515/build-script-main` (exit status: 101)
--- stdout
cargo:rustc-cfg=const_fn
cargo:rerun-if-env-changed=AARCH64_APPLE_DARWIN_OPENSSL_NO_VENDOR
AARCH64_APPLE_DARWIN_OPENSSL_NO_VENDOR unset
cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
OPENSSL_NO_VENDOR unset
CC_aarch64-apple-darwin = None
CC_aarch64_apple_darwin = None
HOST_CC = None
CC = Some("clang")
CFLAGS_aarch64-apple-darwin = None
CFLAGS_aarch64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
running "perl" "./Configure" "--prefix=/tmp/cargo-installrmUUH3/release/build/openssl-sys-1b841185aab54a66/out/openssl-build/install" "--openssldir=/usr/local/ssl" "no-dso" "no-shared" "no-ssl3" "no-unit-test" "no-comp" "no-zlib" "no-zlib-dynamic" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "darwin64-arm64-cc" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=arm64-apple-darwin"
--- stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /Users/steve/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-src-111.22.0+1.1.1q/src/lib.rs:488:39
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-instruments v0.4.7`, intermediate artifacts can be found at `/tmp/cargo-installrmUUH3`
Caused by:
build failed
When a custom template is present on the system isntruments -s templates
will include it in the list twith the full path, e.g. "~/Library/Application Support/Instruments/Templates/my-template-name.tracetemplate"
which breaks the assumption of max 64 chars long template names. The result is a panic when running cargo instruments --list
.
@cmyr, thanks so much for this crate, makes profiling Rust apps on OSX a real joy!
At first I ran cargo instruments without templates (time
by default), but then I wanted to have allocations and syscalls as additional tracks, but:
$ cargo instruments --limit 10000 -t alloc -t time -t sys --open
error: The argument '--template <TEMPLATE>' was provided more than once, but cannot be used multiple times
USAGE:
cargo instruments --limit <MILLIS> --open --template <TEMPLATE>
For more information try --help
$ cargo instruments --list
Instruments provides the following built-in templates.
Aliases are indicated in parentheses.
"Allocations" (alloc)
"File Activity" (io)
"System Trace" (sys)
"Time Profiler" (time)
"Activity Monitor"
"App Launch"
"Blank"
"Core Animation"
"Core Data"
"Counters"
"Energy Log"
"Game Performance"
"Leaks"
"Metal System Trace"
"Network"
"SceneKit"
"SwiftUI"
"Zombies"
I'm eager to know which cargo instruments
CLI flags did you run to get the screenshot shown in the README.md? It contains all the information I need:
With my current time
CLI, I just get part of the trace information and the added tracks are empty (see "No Data" in syscall and alloc rows):
I am using the latest cargo instruments
crate and OSX 10.15.2 Catalina. When I run with -t alloc
(as the only parameter), I can see the allocations fine, I just would like to have a "combined" view with all the information.
This tool may well save me a lot of pain as I'm not a frequent user of instruments
.
I ran into the following: Despite being able to run xctrace in the terminal, I get the following error.
> cargo instruments --template sys
> Failed instruments errored: xcrun: error: unable to find utility "xctrace", not a developer tool or in PATH
Any ideas?
I watched the first video you linked to in the Readme to learn about instruments, that was great!
Unfortunately, the middle 2 links don't seem to go to specific videos anymore:
https://developer.apple.com/videos/play/wwdc2016/418/
https://developer.apple.com/videos/play/wwdc2016/411/
So I guess it would be good to remove them, and potentially replace by newer videos.
I'd be interested in talks similar to the first one. Thanks!
Running cargo instruments
on my project fails with the error below.
$ cargo instruments
Finished dev [unoptimized + debuginfo] target(s) in 0.30s
Profiling target/debug/documents
Failed instruments errored: xcode-select: error: tool 'instruments' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
Versions:
OSX: 10.15.2
Xcode/Instruments: 11.3
xcode-select: 2373
rust: 1.40.0
Installing cargo-instruments through cargo install
on 1.72.0 on macOS Sonoma gives the following error on every execution (even for things like --list-templates
.)
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString stringByStandardizingPath]: unrecognized selector sent to instance 0x6000012943c0'
*** First throw call stack:
(
0 CoreFoundation 0x0000000187f908c0 __exceptionPreprocess + 176
1 libobjc.A.dylib 0x0000000187a89eb4 objc_exception_throw + 60
2 CoreFoundation 0x00000001880423dc -[NSObject(NSObject) __retain_OA] + 0
3 CoreFoundation 0x0000000187efa9e4 ___forwarding___ + 1572
4 CoreFoundation 0x0000000187efa300 _CF_forwarding_prep_0 + 96
5 Foundation 0x0000000188fcf4f0 -[NSProcessInfo arguments] + 188
6 CoreFoundation 0x000000018800bff8 __getDefaultArguments_block_invoke + 96
7 libdispatch.dylib 0x0000000187c91910 _dispatch_client_callout + 20
8 libdispatch.dylib 0x0000000187c9314c _dispatch_once_callout + 32
9 CoreFoundation 0x000000018800b994 _addBackstopValuesForIdentifierAndSource + 640
10 CoreFoundation 0x0000000187ec6254 __81-[_CFXPreferences(SourceAdditions) withNamedVolatileSourceForIdentifier:perform:]_block_invoke + 144
11 CoreFoundation 0x000000018800b63c -[_CFXPreferences withNamedVolatileSourceForIdentifier:perform:] + 272
12 CoreFoundation 0x0000000187ecc5c4 -[CFPrefsSearchListSource addNamedVolatileSourceForIdentifier:] + 136
13 CoreFoundation 0x000000018804a8bc __108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:]_block_invoke.155 + 296
14 CoreFoundation 0x000000018804a564 -[_CFXPreferences withSearchLists:] + 84
15 CoreFoundation 0x0000000187ec7b18 __108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:]_block_invoke + 300
16 CoreFoundation 0x000000018804a710 -[_CFXPreferences withSearchListForIdentifier:container:cloudConfigurationURL:perform:] + 384
17 CoreFoundation 0x0000000187ec7440 -[_CFXPreferences copyAppValueForKey:identifier:container:configurationURL:] + 156
18 CoreFoundation 0x0000000187ec7368 _CFPreferencesCopyAppValueWithContainerAndConfiguration + 112
19 SystemConfiguration 0x0000000188c57478 SCDynamicStoreCopyProxiesWithOptions + 180
20 cargo-instruments 0x000000010485cafc Curl_macos_init + 16
21 cargo-instruments 0x000000010484acc0 curl_global_init + 176
22 cargo-instruments 0x000000010483693c _ZN3std4sync4once4Once9call_once28_$u7b$$u7b$closure$u7d$$u7d$17h9fb355ead9167cb8E + 36
23 cargo-instruments 0x00000001049c2178 _ZN3std10sys_common4once5queue4Once4call17h5a4bf65a856a857dE + 1056
24 cargo-instruments 0x0000000104836d04 _ZN4curl9INIT_CTOR9init_ctor17hd245fe9553527954E + 96
25 dyld 0x0000000187ae15c8 ___ZZNK5dyld46Loader25findAndRunAllInitializersERNS_12RuntimeStateEENK3$_0clEv_block_invoke + 168
26 dyld 0x0000000187b26920 ___ZNK5dyld313MachOAnalyzer18forEachInitializerER11DiagnosticsRKNS0_15VMAddrConverterEU13block_pointerFvjEPKv_block_invoke.209 + 340
27 dyld 0x0000000187b19c60 ___ZNK5dyld39MachOFile14forEachSectionEU13block_pointerFvRKNS0_11SectionInfoEbRbE_block_invoke + 496
28 dyld 0x0000000187ac12fc _ZNK5dyld39MachOFile18forEachLoadCommandER11DiagnosticsU13block_pointerFvPK12load_commandRbE + 300
29 dyld 0x0000000187b18c98 _ZNK5dyld39MachOFile14forEachSectionEU13block_pointerFvRKNS0_11SectionInfoEbRbE + 192
30 dyld 0x0000000187b26434 _ZNK5dyld313MachOAnalyzer18forEachInitializerER11DiagnosticsRKNS0_15VMAddrConverterEU13block_pointerFvjEPKv + 516
31 dyld 0x0000000187add798 _ZNK5dyld46Loader25findAndRunAllInitializersERNS_12RuntimeStateE + 448
32 dyld 0x0000000187ae3b14 _ZNK5dyld416JustInTimeLoader15runInitializersERNS_12RuntimeStateE + 36
33 dyld 0x0000000187addb4c _ZNK5dyld46Loader23runInitializersBottomUpERNS_12RuntimeStateERN5dyld35ArrayIPKS0_EE + 220
34 dyld 0x0000000187ae1654 _ZZNK5dyld46Loader38runInitializersBottomUpPlusUpwardLinksERNS_12RuntimeStateEENK3$_1clEv + 112
35 dyld 0x0000000187addccc _ZNK5dyld46Loader38runInitializersBottomUpPlusUpwardLinksERNS_12RuntimeStateE + 304
36 dyld 0x0000000187b02ad4 _ZN5dyld44APIs25runAllInitializersForMainEv + 464
37 dyld 0x0000000187ac5f34 _ZN5dyld4L7prepareERNS_4APIsEPKN5dyld313MachOAnalyzerE + 3192
38 dyld 0x0000000187ac4f44 start + 1948
)
I'm just curious why this tool does not have a --test
flag to analyse tests?
Cheers!
As of version 0.4.1, running cargo instruments
without additional arguments yields the following output:
error: The following required arguments were not provided:
--template <TEMPLATE>
USAGE:
cargo instruments [FLAGS] [OPTIONS] --template <TEMPLATE> [ARGS]...
For more information try --help
Meanwhile, according to the README.md file, the expected behaviour is described as:
# omitting to provide a template will display an interactive menu
# to choose which template to use for profiling
$ cargo instruments
This seems to have been introduced in commit 4d3ebc4.
When I try $ brew install cargo-instruments
==> Downloading https://ghcr.io/v2/homebrew/core/cargo-instruments/manifests/0.4
Already downloaded: /Users/hungkhoaitay/Library/Caches/Homebrew/downloads/8717425197d784f85cb583ed0257a6db5d1ab31d884d078be2245d01dcd72e49--cargo-instruments-0.4.2.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/cargo-instruments/blobs/sha256:
Already downloaded: /Users/hungkhoaitay/Library/Caches/Homebrew/downloads/39d3e1a46c7bd00f9504e33747a1d43acf4c1932d3c44af58e85965b71b02637--cargo-instruments--0.4.2.arm64_big_sur.bottle.tar.gz
==> Pouring cargo-instruments--0.4.2.arm64_big_sur.bottle.tar.gz
🍺 /opt/homebrew/Cellar/cargo-instruments/0.4.2: 7 files, 9.1MB
Then $ cargo instruments -t Allocations
, I have the error
cannot parse version: `11.5.1
`, because of unexpected character '\n' after patch version number
Also when I try $ cargo install cargo-instruments
ld: warning: ignoring file /opt/homebrew/opt/[email protected]/lib/libcrypto.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
Undefined symbols for architecture x86_64:
"_EVP_cast5_cbc", referenced from:
_libssh2_crypt_method_cast128_cbc in liblibssh2_sys-5d3d3fe8a549babf.rlib(crypt.o)
Please help me :)
I have a simple project with a benchmark using Rust's built-in #[bench]
functionality written alongside unit tests, in the same file as the code I'm testing.
Usually I run benchmarks using:
cargo bench
Or if I only want to run some functions:
cargo bench <name_of_function>
But when I try to run cargo-instruments
, I get the following error:
$ cargo instruments -t time --bench
error: The argument '--bench <NAME>' requires a value but none was supplied
USAGE:
cargo instruments --template <TEMPLATE> <--example <NAME>|--bin <NAME>|--bench <NAME>>
For more information try --help
I don't know what I should put in as the <NAME> since the none of the following work:
cargo instruments -t time --bench <name_of_function>
cargo instruments -t time --bench <name_of_crate>
cargo instruments -t time --bench <name_of_crate>-test
cargo instruments -t time --bench <name_of_crate>-bench
cargo instruments -t time --bench crate
cargo instruments -t time --bench libtest
cargo instruments -t time --bench test
cargo instruments -t time --bench bench
cargo instruments -t time --bench benches
cargo instruments -t time --bench ''
cargo instruments -t time --bench -
I always get the following error:
Failed no bench target named `<the_name_i_tried>`.
no bench target named `<the_name_i_tried>`.
I get a similar error if I try to specify a name when with --bench
using cargo bench
:
$ cargo bench --bench <name_of_crate>
error: no bench target named `<name_of_crate>`.
However I can call cargo bench
without arguments, or specify --bins
, --bin <name_of_crate>
, or --benches
to run my benchmark without profiling.
Any ideas?
I would love to be able to run some basic profiling on my integration test targets using this tool, but for now it only supports --bin
and --bench
. Would it be viable to add support for --test
?
The command
open target/instruments/xyz.trace
Causes the following error: "The document “xyz.trace” could not be opened. Document Missing Template Error".
I am running the cargo instruments with the following command:
cargo instruments --package backend --template alloc --bin backend --release
Debug info for the release profile is enabled.
Os version: macOS Sonoma 14.0
Chip: Apple M2
Latest XCode tools installed.
I have a customtarget-dir
in ~/.cargo/config
(I like to build on a ram drive to lessen the wear and tear on the persistent storage).
Running cargo instruments --example many_once
yields:
Failed failed to remove file `/Users/jan/tmp/bld/cargo/debug/examples/many_once.dSYM`
Unsetting target-dir
in the global config makes it work.
I'm working on a project using Bevy on macOS. Attempting to run cargo instruments
produces the following result:
% cargo instruments -t "Game Performance"
Finished dev [optimized + debuginfo] target(s) in 0.80s
Profiling target/debug/render-test with template 'Game Performance'
dyld[4563]: Library not loaded: '@rpath/libstd-997c4eb22009d353.dylib'
Referenced from: '/Users/REDACTED/render-test/target/debug/render-test'
Reason: tried: '/usr/local/lib/libstd-997c4eb22009d353.dylib' (no such file), '/usr/lib/libstd-997c4eb22009d353.dylib' (no such file)
Trace file target/instruments/render-test_Game-Performance_2022-09-24_211925-582.trace
When running the executable directly, I get the same error unless I pass DYLD_FALLBACK_LIBRARY_PATH=$HOME/.rustup/toolchains/stable-x86_64-apple-darwin/lib
. However, this does not seem to fix the issue with cargo instruments
.
In any Rust project with Cargo.toml
:
[package]
name = "foobar"
version = "0.1.0"
authors = ["Foo Bar <[email protected]>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
flame = { git = "ssh://[email protected]/llogiq/flame" }
run $ RUST_BACKTRACE=full cargo instruments run -t alloc --bin foobar
, gives error below:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ()', /Users/kai/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-0.42.0/src/cargo/util/canonical_url.rs:42:13
stack backtrace:
0: 0x10332abef - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h15e9d43c311e2e8b
1: 0x103356afe - core::fmt::write::h26bd57c1fd6e9c98
2: 0x103324cc7 - std::io::Write::write_fmt::hec39d9b928a7dd96
3: 0x10332e4fa - std::panicking::default_hook::{{closure}}::h0f5acc2c9ebbd23b
4: 0x10332e23c - std::panicking::default_hook::heb20615097dfd012
5: 0x10332eabe - std::panicking::rust_panic_with_hook::hfa6e15127794f7f1
6: 0x10332e692 - rust_begin_unwind
7: 0x1033aaa6f - core::panicking::panic_fmt::hab6ef1464e9720aa
8: 0x1033aa975 - core::result::unwrap_failed::hb5a510096a5fc85f
9: 0x102e6a0f9 - cargo::util::canonical_url::CanonicalUrl::new::h0ab27e391853a09f
10: 0x102f9d342 - cargo::core::source::source_id::SourceId::new::h9b227cb292ddc016
11: 0x102efa4f3 - cargo::util::toml::DetailedTomlDependency::to_dependency::hc77db343f6fde475
12: 0x102ef9362 - cargo::util::toml::TomlDependency::to_dependency::hfe28f05777afe0be
13: 0x102ef778a - cargo::util::toml::TomlManifest::to_real_manifest::process_dependencies::hb19df712d0e950f9
14: 0x102ef371a - cargo::util::toml::TomlManifest::to_real_manifest::hc31eeb64c8ab11fe
15: 0x102eed31d - cargo::util::toml::read_manifest::h5972f1049e4c6e0d
16: 0x1030bfb64 - cargo::core::workspace::Packages::load::ha076f78ca943bea8
17: 0x1030bbb08 - cargo::core::workspace::Workspace::find_root::hd2ebfb5d65327e20
18: 0x1030b9367 - cargo::core::workspace::Workspace::new::h0fbdf1a6e80effd3
19: 0x102d7e97e - cargo_instruments::app::run::h67fa75ce7d3353ba
20: 0x102d6f223 - cargo_instruments::main::h326b607d3eec3c1b
21: 0x102d6a5f6 - std::rt::lang_start::{{closure}}::h863cb5381b98991b
22: 0x10332ee69 - std::rt::lang_start_internal::h2d2d7c5f224149f7
23: 0x102d6f2f9 - main
Looks like Cargo
failed to parse flame = { git = "ssh://[email protected]/llogiq/flame" }
I want to profile this command line:
riff < /tmp/glp.txt > /dev/null
How can I do that using cargo instruments
?
Riff is a filter that reads data from stdin
and prints it to stdout
.
If I just start riff
using cargo instruments
, ptop says that riff
's stdin
and stdout
are both connected to instruments
, which is not what I want.
How do I tell cargo instruments
how to set up stdin
and stdout
for the profiled binary?
I'm not sure whether this is a mistake on my side or a missing feature.
I have Big Sur (11.5.1) and when trying to run some cargo-instruments it fails saying "xctrace" is missing. Indeed, I can't find that binary.
% xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
% brew install cargo-instruments
Warning: cargo-instruments 0.4.1 is already installed and up-to-date.
% cargo instruments -t Allocations
Failed instruments errored: xcrun: error: unable to find utility "xctrace", not a developer tool or in PATH
% ls /Library/Developer/CommandLineTools/usr/bin/xtr*
zsh: no matches found
Is there something I can do to run cargo-instruments on this machine (it's an Intel machine, not M1).
nix-shell --command 'cargo install cargo-instruments' --pure -p llvmPackages_13.libclang libiconv darwin.apple_sdk.frameworks.SystemConfiguration rustc cargo sccache libgit2 pkg-config darwin.apple_sdk.frameworks.CoreServices
Might be useful for folks using nix. Could be good to have something like this in the readme.
I know of --args
, but is there a way to pass flags to the target binary?
For example, lets say my binary have start
command and --verbose
flag, so usually I run it using cargo:
$ cargo run -- start --verbose
How should I do that with cargo instruments?
Howdy! I get the following error when I try to run cargo instruments
(no arguments):
Failed failed to parse lock file at: /[redacted but correct]/Cargo.lock
.
The Cargo.lock
is freshly generated from a new project created a couple weeks ago.
cargo
version: cargo 1.42.0-nightly (9d32b7b01 2020-01-26)
.
rustc
version: rustc 1.42.0-nightly (3761dcd34 2020-01-28)
.
Environment: macOS Mojave 10.14.6.
Initial guess is that the cargo
crate in this crate needs to be updated to the current version, 0.42.0
.
Glad to provide additional info as needed. Thanks!
In my own usage, I find I generally want to open the generated traces directly, so this feels very slightly more ergonomic.
I'm attempting to update Homebrew's version of Rust (Homebrew/homebrew-core#66285).
While testing the new version, CI produced the following error:
==> brew install --build-from-source cargo-instruments
==> FAILED
==> Downloading https://github.com/cmyr/cargo-instruments/archive/v0.3.3.tar.gz
==> Downloading from https://codeload.github.com/cmyr/cargo-instruments/tar.gz/v0.3.3
Error: SHA256 mismatch
Expected: 7f6f095af8029e70cb0f7d52d1480fc827fe463362b30523fc3a221825b8f207
Actual: 0da09ac0ebc78f60aa84abc7d67adb4e6eb30df692cb5c1d2d385b91e7163151
I can update the sha256 associated with cargo-instruments, but CI will come back to me with the following error:
cargo-instruments:
* stable sha256 changed without the url/version also changing; please create an issue upstream to rule out malicious circumstances and to find out why the file changed.
Can I confirm that nothing is amiss here?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.