How TAU works in C++ code (theory of operation)
To profile C++ code, we need to instrument the source code using the TAU Profiling API. Instrumenting the sources involves identifying each function uniquely and associating it with one or more Profile groups.
template <class T> class TemplClass { // class template with Get and Set methods private : T Data; public : T SetData(T d) { Data = d; return Data; } }
What is the time spent in ?
TemplClass::SetData() int(int) TemplClass::SetData() vector<int> (vector<int>) TemplClass::SetData() double(double)
TemplClass<float> obj1; in TemplClass::SetData (T d) CT(d) returns "float"
template <class T> class TemplClass { // class template with Get and Set methods private : T Data; public : T SetData(T d) { TAU_TYPE_STRING(taustr, CT(Data) + " (" + CT(d) + " )" ); TAU_PROFILE("TemplClass::SetData()", taustr, TAU_DEFAULT); Data = d; return Data; } }Adding instrumentation is covered in greater detail in the tutorial .
int f1() { // 100 secs total time inclusive of others f2(); // 10 secs ... f3(); // 10 secs } // 80 secs exclusively spent in f1()Exclusive time referes to the time spent in a function exclusive of the time spent in all profiled functions that it calls. Inclusive time is the total time taken in any given function.
By default the profile data files are generated for each node/context/thread in the current directory (named profile.<node>.<context>.<thread>).
To store the data in some other directory, the environment variable PROFILEDIR
should be set and should point to the appropriate location.
If we're profiling using hardware counters instead of time we need to set an
environment variable T5_EVENT0
on the SGI R10000 platform. The
list of legal values that it can take and the parameter that it represents
can be found here .
pprof
- the parallel profile data display tool which
shows the text output or racy
the graphical user interface to
pprof.