valgrindmassif

Valgrind massif combine snapshots


I'm trying to profile an application with massif tool. I run it with this command:

./valgrind.bin  --tool=massif --stacks=yes --heap=yes --trace-children=yes --vgdb=yes /usr/bin/agl_proxy

The application runs for a very long time. Generally, when application receives interrupt signal it would cleanly finish and massif would generate a profile file with many snapshots:

desc: --stacks=yes --heap=yes
cmd: /usr/bin/app
time_unit: i
#-----------
snapshot=0
#-----------
time=0
mem_heap_B=0
mem_heap_extra_B=0
mem_stacks_B=0
heap_tree=empty
#-----------
snapshot=1
#-----------
time=4501979
mem_heap_B=0
mem_heap_extra_B=0
mem_stacks_B=1480
heap_tree=empty

However, this particular application just dumps stock and hangs without properly exiting and thus without properly generating the result file. I can use vgdb to get a snapshot while the application is running. But it generates only one snapshot.

Is there any way to combine the snapshots? I've tried adding the snapshot into a file with snapshot=# header, but the MassifVisualizer complains about the format. Perhaps there is an option to combine them or some tool.


Solution

  • Using vgdb, you can ask massif to dump all snapshots with the below monitor request:

    all_snapshots [<filename>] requests to take all captured snapshots so far and save them in the given <filename> (default massif.vgdb.out).