-
Notifications
You must be signed in to change notification settings - Fork 31
Profiling Uhyve
Jonathan edited this page Jun 5, 2025
·
7 revisions
> sudo perf record -g -F 12000 target/release/uhyve path/to/my/bin
> sudo perf script -i perf.data > serial.perfOpen serial.perf in profiler.firefox.com.
Keep in mind that both the kernel and Uhyve should be built in release mode.
-
Add debug info to the release profile in the
Cargo.toml:[profile.release] debug = true
-
Execute Uhyve with valgrind (adapt the kernel and the arguments if necessary)
> valgrind --tool=callgrind --dump-instr=yes --collect-jumps=yes --simulate-cache=yes target/release/uhyve data/ x86_64/hello_world -
Investigate the run with KCachegrind
> kcachegrind callgrind.out.123456(of course: adapt the filename of the callgrind-file)
A nightly version of the Rust toolchain must be used, as it is required by the rftrace dependency.
- Enable the
instrumentsfeature in Uhyve. Make sure that your version contains the changes of Pull Request #991. - Build Uhyve using the
-Z instrument-mcountflag (RUSTFLAGS="-Z instrument-mcount" cargo build), as suggested by the rftrace documentation. - Install
uftraceusing a package manager, or compile a release version of uftrace from source. - Try running
sudo uftrace record -a ./target/debug/uhyve ./data/x86_64/hello_world
After a trace is complete, you should be able to run commands like uftrace graph or inspect such files with other tools, such as the Chrome trace viewer or Firefox Profiler. The documentation of rftrace mentions additional examples that might be useful to the reader.
