I’m in need of profiling a specific part of a large C++ project, which has a bunch of unit and integration tests, managed through CTest. I was wondering if it was possible to profile a specific test (with some tool, like perf). If it isn’t, what do you recommend doing?
CTest doesn’t really have a mechanism for this, but you can have it print the command line and environment it uses with ctest -VV -R 'TestNameRegex' and then run it manually.
Alternatively, edit the CMake code to run the test in question under perf as desired.