|
If you are interested in getting more detailed profiling
information for a single function, you can add TAU timers
to that function. This is how they work:
First, make sure to include the tau header for SCIRun:
#include <TauProfilerForSCIRun.h>
Now declare one or more timers at the top of your function:
TAU_PROFILE_TIMER(<timer>, "<timer name>", "", TAU_USER)
You start and stop the timer around the section of code
that you are interested in profiling:
TAU_PROFILE_START(<timer>, "<timer name>", "", TAU_USER)
/* code */
TAU_PROFILE_STOP(<timer>, "<timer name>", "", TAU_USER)
Here is an example:
#include <TauProfilerForSCIRun.h>
void foo()
{
TAU_PROFILE_TIMER(looptimer, "foo: loop" , "", TAU_USER);
TAU_PROFILE_TIMER(sendtimer, "foo: send" , "", TAU_USER);
TAU_PROFILE_START(looptimer);
for (int i = 0; i < 100; i++)
{
/* do something */
}
TAU_PROFILE_STOP(looptimer);
TAU_PROFILE_START(sendtimer);
/* send results to someone */
TAU_PROFILE_STOP(sendtimer);
}
If you don't stop a timer that has started, you will
get strange TAU profiles!
|