Prism 6.0 User's Guide

Inserting TNF Probes Into User Code.

While Sun HPC ClusterTools libraries have TNF probes for performance profiling, user code probably will not. You can add probes manually, but since they are C macros you can add them only to C and C++ code. To use TNF probes from Fortran code, you must make calls to C code, such as in this C file, probes.c:

#include <tnf/probe.h>
void my_probe_start_(char *label_val) {
   TNF_PROBE_1(my_probe_start,"user_probes","",tnf_string,label,
label_val);
}
void my_probe_end_  (double *ops_val) {
   TNF_PROBE_1(my_probe_end  ,"user_probes","",tnf_double,ops,
*ops_val);
}

The start routine accepts a descriptive string, while the end routine takes a double-precision operation count.Then, using Fortran, you might write in main.f:

DOUBLE PRECISION OPERATION_COUNT
OPERATION_COUNT = 2.D0 * N
CALL MY_PROBE_START("DOTPRODUCT")
XSUM = 0.D0
DO I = 1, N
   XSUM = XSUM + X(I) * Y(I)
END DO
CALL MY_PROBE_END(OPERATION_COUNT)


Note -

Fortran will convert routine names to lowercase and append an underscore character.


To compile and link, use

% cc -c probes.c
% f77 main.f probes.o -ltnfprobe

By default, the Prism command tnfcollection on enables all probes. Alternatively, these sample probes could be controlled through their probe group user_probes. Profile analysis can use the interval my_probe.

For more information on TNF probes, consult the man page for TNF_PROBE(3X).