Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing a code snippet with valgrind

How can I test a particular part of my program using valgrind(and perf, if the same principles apply)? I'm asking this because perf ./progname tests the whole program.

I cannot remove the other parts because the part I need to test depends on them.

Thanks

like image 987
Ascent Avatar asked Jul 17 '26 10:07

Ascent


1 Answers

You can't run part of a program under Valgrind; Valgrind is an all or nothing affair.

What you can do is to tell it to ignore errors you aren't interested in (because they're in a part of the program you can't fix, for example). To do this, check the Valgrind Suppression Howto: http://wiki.wxwidgets.org/Valgrind_Suppression_File_Howto

This won't speed anything up though, so if speed is your motiviation, this won't help.

like image 117
1000 Bites Avatar answered Jul 18 '26 23:07

1000 Bites



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!