4

Using

valgrind --tool=callgrind

on Linux

.....I would like to pass canned messages into my process. However for the first eg 90% of the messages I would like to process as normal, with no grinding, in order to build up a map. Then I would like to activate valgrind/callgrind only for the last 10% messages.

Is this possible?

Maybe there is a way to increment a counter in my C++ code and when it reaches a certain threshold, activate valgrind/callgrind.

Your feedback is much appreciated.

1 Answers1

4

Yes, it is possible. You have to use a mix of --instr-atstart=no along with either a callgrind_control or a "toggle function" (--toggle-collect). The later seems more applicable to your scenario. See ยง6.2.2 "Limiting the range of collected events" of the Valgrind manual for more information.