It is a bit misleading.
Consider the following scenario:
void sample_function()
{
std::this_thread::sleep_for(std::chrono::milliseconds(500));
{
PROFILE_FUNCTION();
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
}
Here only the 2nd sleep of 100 ms will be recorded as per the implementation of constructing and destructing of the InstrumentationTimer.
The naming might be a bit misleading. Maybe function profiling can be achieved in a different way and leave this to scope profiling.