OpenMPI  0.1.1
vt_unify_hooks_margins.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_MARGINS_H_
14 #define _VT_UNIFY_HOOKS_MARGINS_H_
15 
16 #include "vt_unify.h"
17 #include "vt_unify_hooks_base.h"
18 
19 #include "otf.h"
20 
21 //
22 // HooksProcessMarginsC class
23 //
25 {
26 public:
27 
28  // constructor
30 
31  // destructor
33 
34  // is this hook enabled?
35  static bool isEnabled() { return true; }
36 
37 private:
38 
39  //
40  // thread context structure
41  //
42  struct ThreadContextS
43  {
44  ThreadContextS()
45  : wstream( 0 ), streamid( 0 ), first_event( true ), last_time( 0 ) {}
46 
47  OTF_WStream * wstream; // OTF writer stream
48  uint32_t streamid; // stream id
49  bool first_event; // flag: first event record to write?
50  uint64_t last_time; // last written timestamp
51 
52  };
53 
54  // vvvvvvvvvvvvvvvvvvvv HOOK METHODS vvvvvvvvvvvvvvvvvvvv
55 
56  // initialization/finalization hooks
57  //
58 
59  void initHook();
60  void finalizeHook( const bool & error );
61 
62  // phase hooks
63  //
64 
65  void phaseHook_UnifyEvents_pre();
66  void phaseHook_UnifyEvents_post();
67 
68  // record hooks
69  //
70 
71  // event records
72 
73  // common stuff for write event record hooks
74  void writeRecHook_Event( OTF_WStream ** wstream, uint64_t * time,
75  uint32_t * streamid, bool * dowrite );
76 
77  void writeRecHook_EventComment( HooksC::VaArgsT & args )
78  {
79  writeRecHook_Event( (OTF_WStream**)args[0], (uint64_t*)args[1],
80  (uint32_t*)args[2], (bool*)args[5] );
81  }
82 
83  void writeRecHook_Enter( HooksC::VaArgsT & args )
84  {
85  writeRecHook_Event( (OTF_WStream**)args[0], (uint64_t*)args[1],
86  (uint32_t*)args[3], (bool*)args[6] );
87  }
88 
89  void writeRecHook_Leave( HooksC::VaArgsT & args )
90  {
91  writeRecHook_Event( (OTF_WStream**)args[0], (uint64_t*)args[1],
92  (uint32_t*)args[3], (bool*)args[6] );
93  }
94 
95  void writeRecHook_Counter( HooksC::VaArgsT & args )
96  {
97  writeRecHook_Event( (OTF_WStream**)args[0], (uint64_t*)args[1],
98  (uint32_t*)args[2], (bool*)args[7] );
99  }
100 
101  void writeRecHook_BeginFileOp( HooksC::VaArgsT & args )
102  {
103  writeRecHook_Event( (OTF_WStream**)args[0], (uint64_t*)args[1],
104  (uint32_t*)args[2], (bool*)args[6] );
105  }
106 
107  void writeRecHook_EndFileOp( HooksC::VaArgsT & args )
108  {
109  writeRecHook_Event( (OTF_WStream**)args[0], (uint64_t*)args[1],
110  (uint32_t*)args[2], (bool*)args[10] );
111  }
112 
113  void writeRecHook_SendMsg( HooksC::VaArgsT & args )
114  {
115  writeRecHook_Event( (OTF_WStream**)args[0], (uint64_t*)args[1],
116  (uint32_t*)args[2], (bool*)args[9] );
117  }
118 
119  void writeRecHook_RecvMsg( HooksC::VaArgsT & args )
120  {
121  writeRecHook_Event( (OTF_WStream**)args[0], (uint64_t*)args[1],
122  (uint32_t*)args[2], (bool*)args[9] );
123  }
124 
125  void writeRecHook_BeginCollOp( HooksC::VaArgsT & args )
126  {
127  writeRecHook_Event( (OTF_WStream**)args[0], (uint64_t*)args[1],
128  (uint32_t*)args[2], (bool*)args[11] );
129  }
130 
131  void writeRecHook_EndCollOp( HooksC::VaArgsT & args )
132  {
133  writeRecHook_Event( (OTF_WStream**)args[0], (uint64_t*)args[1],
134  (uint32_t*)args[2], (bool*)args[5] );
135  }
136 
137  void writeRecHook_RMAPut( HooksC::VaArgsT & args )
138  {
139  writeRecHook_Event( (OTF_WStream**)args[0], (uint64_t*)args[1],
140  (uint32_t*)args[2], (bool*)args[10] );
141  }
142 
143  void writeRecHook_RMAPutRemoteEnd( HooksC::VaArgsT & args )
144  {
145  writeRecHook_Event( (OTF_WStream**)args[0], (uint64_t*)args[1],
146  (uint32_t*)args[2], (bool*)args[10] );
147  }
148  void writeRecHook_RMAGet( HooksC::VaArgsT & args )
149  {
150  writeRecHook_Event( (OTF_WStream**)args[0], (uint64_t*)args[1],
151  (uint32_t*)args[2], (bool*)args[10] );
152  }
153 
154  void writeRecHook_RMAEnd( HooksC::VaArgsT & args )
155  {
156  writeRecHook_Event( (OTF_WStream**)args[0], (uint64_t*)args[1],
157  (uint32_t*)args[2], (bool*)args[8] );
158  }
159 
160  // generic hook
161  void genericHook( const uint32_t & id, HooksC::VaArgsT & args );
162 
163  // ^^^^^^^^^^^^^^^^^^^^ HOOK METHODS ^^^^^^^^^^^^^^^^^^^^
164 
165  // maximum number of threads to use for unifying events
166  int m_maxThreads;
167 
168  // array of thread contexts
169  ThreadContextS * m_threadContexts;
170 
171 };
172 
173 #endif // _VT_UNIFY_HOOKS_MARGINS_H_
Main include file for applications using OTF.
VampirTrace http://www.tu-dresden.de/zih/vampirtrace.
Definition: vt_unify_hooks_base.h:23
Definition: OTF_WStream.h:95
HooksProcessMarginsC()
VampirTrace http://www.tu-dresden.de/zih/vampirtrace.
Definition: vt_unify_hooks_margins.cc:21
VampirTrace http://www.tu-dresden.de/zih/vampirtrace.
Definition: vt_unify_hooks_margins.h:24