OpenMPI  0.1.1
vt_unify_hooks.h
1 /**
2  * VampirTrace
3  * http://www.tu-dresden.de/zih/vampirtrace
4  *
5  * Copyright (c) 2005-2012, ZIH, TU Dresden, Federal Republic of Germany
6  *
7  * Copyright (c) 1998-2005, Forschungszentrum Juelich, Juelich Supercomputing
8  * Centre, Federal Republic of Germany
9  *
10  * See the file COPYING in the package base directory for details
11  **/
12 
13 #ifndef _VT_UNIFY_HOOKS_H_
14 #define _VT_UNIFY_HOOKS_H_
15 
16 #include "config.h"
17 
18 #include "vt_inttypes.h"
19 
20 #include <vector>
21 
22 // generic hooks' identifier bits
23 //
24 enum
25 {
26  // HooksRawC's (example; not used)
27  //
28  VT_UNIFY_HOOKS_RAW_GENID__SOMETHING1 = 1<<0,
29  VT_UNIFY_HOOKS_RAW_GENID__SOMETHING2 = 1<<1,
30 
31  // HooksAsyncEventsC's
32  //
33  VT_UNIFY_HOOKS_AEVENTS_GENID__EVENT_STREAM_OPEN = 1<<2,
34  VT_UNIFY_HOOKS_AEVENTS_GENID__EVENT_STREAM_CLOSE = 1<<3,
35 
36  // HooksTdbC's
37  //
38  VT_UNIFY_HOOKS_TDB_GENID__STARTSTOPTIME_EPOCH = 1<<4,
39 
40  // HooksProcessMarginsC's
41  //
42  VT_UNIFY_HOOKS_MARGINS_GENID__EVENT_STREAM_OPEN = 1<<5,
43  VT_UNIFY_HOOKS_MARGINS_GENID__EVENT_STREAM_CLOSE = 1<<6
44 
45 };
46 
47 //
48 // HooksC class
49 //
50 
51 // forward declaration
52 class HooksBaseC;
53 
54 class HooksC
55 {
56 public:
57 
58  // maximum number of variable arguments for record and generic hooks
59  static const uint32_t MAX_VA_ARGS = 12;
60 
61  //
62  // variable hook arguments type
63  //
64  typedef void *VaArgsT[MAX_VA_ARGS];
65 
66  //
67  // phase hooks
68  //
69  typedef enum
70  {
71  Phase_GetUnifyControls_pre, Phase_GetUnifyControls_post,
72  Phase_UnifyDefinitions_pre, Phase_UnifyDefinitions_post,
73  Phase_UnifyMarkers_pre, Phase_UnifyMarkers_post,
74  Phase_UnifyStatistics_pre, Phase_UnifyStatistics_post,
75  Phase_UnifyEvents_pre, Phase_UnifyEvents_post,
76  Phase_WriteMasterControl_pre, Phase_WriteMasterControl_post,
77  Phase_CleanUp_pre, Phase_CleanUp_post,
78  Phase_Num
79  } PhaseTypeT;
80 
81  //
82  // record hooks
83  //
84  typedef enum
85  {
86  // definition records
87  //
88  Record_DefComment,
89  Record_DefCreator,
90  Record_DefTimerResolution,
91  Record_DefTimeRange,
92  Record_DefProcessGroup,
93  Record_DefProcessGroupAttributes,
94  Record_DefProcess,
95  Record_DefSclFile,
96  Record_DefScl,
97  Record_DefFileGroup,
98  Record_DefFile,
99  Record_DefFunctionGroup,
100  Record_DefFunction,
101  Record_DefCollOp,
102  Record_DefCounterGroup,
103  Record_DefCounter,
104  Record_DefCounterAssignments,
105  Record_DefKeyValue,
106 
107  // summary records
108  //
109  Record_FunctionSummary,
110  Record_MessageSummary,
111  Record_CollOpSummary,
112  Record_FileOpSummary,
113 
114  // marker records
115  //
116  Record_DefMarker,
117  Record_MarkerSpot,
118 
119  // event records
120  //
121  Record_Enter,
122  Record_Leave,
123  Record_BeginFileOp,
124  Record_EndFileOp,
125  Record_SendMsg,
126  Record_RecvMsg,
127  Record_BeginCollOp,
128  Record_EndCollOp,
129  Record_RMAPut,
130  Record_RMAPutRemoteEnd,
131  Record_RMAGet,
132  Record_RMAEnd,
133  Record_Counter,
134  Record_EventComment,
135 
136  // number of records
137  Record_Num
138  } RecordTypeT;
139 
140  // constructor
141  HooksC();
142 
143  // destructor
144  ~HooksC();
145 
146  // register hook classes
147  void registerHooks();
148 
149  // trigger init hook
150  void triggerInitHook();
151 
152  // trigger finalize hook
153  void triggerFinalizeHook( const bool & error );
154 
155  // trigger phase hook
156  void triggerPhaseHook( const PhaseTypeT & phase );
157 
158  // trigger read record hook
159  void triggerReadRecordHook( const RecordTypeT & rectype, const uint32_t & n,
160  void * a0 = 0, void * a1 = 0, void * a2 = 0,
161  void * a3 = 0, void * a4 = 0, void * a5 = 0,
162  void * a6 = 0, void * a7 = 0, void * a8 = 0,
163  void * a9 = 0, void * a10 = 0, void * a11 = 0 );
164 
165  // trigger write record hook
166  void triggerWriteRecordHook( const RecordTypeT & rectype, const uint32_t & n,
167  void * a0 = 0, void * a1 = 0, void * a2 = 0,
168  void * a3 = 0, void * a4 = 0, void * a5 = 0,
169  void * a6 = 0, void * a7 = 0, void * a8 = 0,
170  void * a9 = 0, void * a10 = 0, void * a11 = 0 );
171 
172  // trigger generic hook
173  void triggerGenericHook( const uint32_t & id, const uint32_t & n,
174  void * a0 = 0, void * a1 = 0, void * a2 = 0,
175  void * a3 = 0, void * a4 = 0, void * a5 = 0,
176  void * a6 = 0, void * a7 = 0, void * a8 = 0,
177  void * a9 = 0, void * a10 = 0, void * a11 = 0 );
178 
179 private:
180 
181  // vector of hook class instances
182  std::vector<HooksBaseC*> m_hooks;
183 
184 };
185 
186 // instance of class Hooks
187 extern HooksC * theHooks;
188 
189 #endif // _VT_UNIFY_HOOKS_H_
Definition: vt_unify_hooks.h:54
VampirTrace http://www.tu-dresden.de/zih/vampirtrace.
Definition: vt_unify_hooks_base.h:23