next up previous
Next: C/C++ OpenMP Pragma Up: OpenMP Performance Tool Previous: User Code Instrumentation

Context Descriptors


An important aspect of the performance instrumentation is how the performance tool interface routines get access to context information, in order to relate the collected performance information back to the source code and OpenMP constructs.

We propose the following: For each instrumented OpenMP construct, user function, and user-specified region, the instrumentor generates a context descriptor in the global static memory segment of the compilation unit which contains the construct or region. All monitoring function calls related to this construct or region are passed the address of this descriptor (called d in Tables 1 and 2). The proposed definition of the context descriptor (in C syntax) is:

  typedef struct ompregdescr {
      char* name;
      char* sub_name;
      int   num_sections;
      char* file_name;
      int   begin_line1, begin_lineN;
      int   end_line1, end_lineN;
      WORD  data[4];
      struct ompregdescr* next;
  } OMPRegDescr;

The fields of the context descriptor have the following meaning: name contains the name of the OpenMP construct or the string "region" for user functions and regions. sub_name stores the name of named critical regions or the name of user functions and regions. In case of the sections OpenMP directives, num_sections provides the number of sections, otherwise it is set to 0. The next five fields (file_name, begin_line1, begin_lineN, end_line1, end_lineN) describe the source code location of the OpenMP construct or user region: the source file name, and the first and last line number of the opening and of the corresponding END OpenMP directive. The field data can be used by the performance tool interface functions to store performance data related to this construct or region (e.g., counters or timers). Finally, the next component allows for chaining context descriptors together at run-time, so that at the end of the program the list of descriptors can be traversed and the collected performance data can be stored away and analyzed.

This approach has many advantages over other methods (e.g., using unique identifiers):

Sameer Suresh Shende
Thu Aug 23 11:19:57 PDT 2001