Valgrind massif tool reporting same snapshots

433 Views Asked by At

I need to run valgrind with the massif tool in a parallel code that takes a long time to finish. I want to take snapshots periodically.

I do the following:

valgrind --tool=massif --massif-out-file=outFile.txt --vgdb=yes ./app

And in another terminal, I run a loop with the following:

vgdb all_snapshot snapshots.txt

Yet, "snapshots.txt" has always the same content. I tried with different valgrind options such as --time-unit=ms and --time-unit=i. And, if I get all the snapshots at moment X of execution and then at moment X+Y, the two generated files are identical.

What am I doing wrong?

1

There are 1 best solutions below

0
On BEST ANSWER

massif has a logic to store in memory a set of snapshots. The number of snaphots and when to take them is controlled by various options such as --peak-inaccuracy, --max-snapshots, ...

Depending on the behaviour of your application between two moments, new snapshots might or might not have been recorded.

The monitor command 'all_snapshots' just saves the snapshots currently in memory.

If you want to force a new snapshot to be output, use the monitor commands 'snapshot' or 'detailed_snapshot'.