mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-11-09 21:30:07 +00:00
dab9f1cf30
Fixes: #5074 Signed-off-by: Rob Bradford <robert.bradford@intel.com>
1.3 KiB
1.3 KiB
Heap profiling
Cloud Hypervisor supports generating a profile using dhat of the heap allocations made during the runtime of the process.
Building a suitable binary
This adds the symbol information to the release binary but does not otherwise affect the performance.
$ cargo build --profile profiling --features "dhat-heap"
Generating output
Cloud Hypervisor can then be run as usual. However it is necessary to run with --seccomp false
as the profiling requires extra syscalls.
$ target/profiling/cloud-hypervisor \
--kernel ~/src/linux/vmlinux \
--pmem file=~/workloads/focal.raw \
--cpus boot=1 --memory size=1G \
--cmdline "root=/dev/pmem0p1 console=ttyS0" \
--serial tty --console off \
--api-socket /tmp/api1 \
--seccomp false
When the VMM exits a message like the following will be shown:
dhat: Total: 384,582 bytes in 3,512 blocks
dhat: At t-gmax: 133,885 bytes in 379 blocks
dhat: At t-end: 12,160 bytes in 20 blocks
dhat: The data has been saved to dhat-heap.json, and is viewable with dhat/dh_view.html
The JSON output can then be uploaded to the dh_view tool for analysis.