2dav / crabgrind Goto Github PK
View Code? Open in Web Editor NEW"Valgrind Client Request" interface for Rust programs
License: MIT License
"Valgrind Client Request" interface for Rust programs
License: MIT License
Hi !
I'm pretty new with valgrind (1 hour ago ^^').
I'd like to output cachegrind file but I don't know how to manage this.
So far, I've done this:
fn run<B: Buffer>(source: Source, save_buffer: &mut B, work_buffer: &mut B) {
let mode = cg::run_mode();
cg::print_stacktrace!("current mode: {mode:?}");
cg::callgrind::toggle_collect();
cg::cachegrind::start_instrumentation();
playground::parsers::preallocated::parser_preallocated(source, save_buffer, work_buffer)
.unwrap();
cg::callgrind::toggle_collect();
cg::cachegrind::stop_instrumentation();
if cg::monitor_command("snapshot mem.snapshot").is_ok() {
println!("snapshot is saved to \"mem.snapshot\"");
} else {
println!("error")
}
}
The main
call run
and does all heavy initialization.
I run everything with a
cargo valgrind run
How can I achieve this ?
With valgrind I've done
valgrind --tool=cachegrinf my_bin
But it profiles the main and poluate my analysis.
Thanks
#1 Added the upcoming 'cachegrind' requests API using a placeholder for doc link, to be updated when the new API's docs becomes available, presumably with the next release at Cachegrind: a high-precision tracing profiler.
Hi, it seems like valgrind/cachegrind.h as introduced in ad39a21 does not exist in the Arch Linux https://archlinux.org/packages/extra/x86_64/valgrind/files/ package. Should this be fixed on the Arch Linux side or in this package?
The following warnings were emitted during compilation:
warning: [email protected]: export.c:2:10: fatal error: valgrind/cachegrind.h: No such file or directory
warning: [email protected]: 2 | #include <valgrind/cachegrind.h>
warning: [email protected]: | ^~~~~~~~~~~~~~~~~~~~~~~
warning: [email protected]: compilation terminated.
error: failed to run custom build command for `crabgrind v0.1.10`
Caused by:
process didn't exit successfully: `/home/moritz/Documents/project/target/release/build/crabgrind-0b7b82b707333898/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-changed=export.c
TARGET = Some("x86_64-unknown-linux-gnu")
OPT_LEVEL = Some("3")
HOST = Some("x86_64-unknown-linux-gnu")
cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
CC_x86_64-unknown-linux-gnu = None
cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
CC_x86_64_unknown_linux_gnu = None
cargo:rerun-if-env-changed=HOST_CC
HOST_CC = None
cargo:rerun-if-env-changed=CC
CC = None
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
CFLAGS_x86_64-unknown-linux-gnu = None
cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
CFLAGS_x86_64_unknown_linux_gnu = None
cargo:rerun-if-env-changed=HOST_CFLAGS
HOST_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = None
running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-o" "/home/moritz/Documents/project/target/release/build/crabgrind-c9c6769248176212/out/export.o" "-c" "export.c"
cargo:warning=export.c:2:10: fatal error: valgrind/cachegrind.h: No such file or directory
cargo:warning= 2 | #include <valgrind/cachegrind.h>
cargo:warning= | ^~~~~~~~~~~~~~~~~~~~~~~
cargo:warning=compilation terminated.
exit status: 1
--- stderr
error occurred: Command "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-o" "/home/moritz/Documents/project/target/release/build/crabgrind-c9c6769248176212/out/export.o" "-c" "export.c" with args "cc" did not execute successfully (status code exit status: 1).
warning: build failed, waiting for other jobs to finish...
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.