OpenMPI  0.1.1
vt_unify_hooks_tdb.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_TDB_H_
14 #define _VT_UNIFY_HOOKS_TDB_H_
15 
16 #include "vt_unify_hooks_base.h"
17 
18 #include "vt_inttypes.h"
19 
20 #include <map>
21 #include <vector>
22 
23 //
24 // HooksTdbC class
25 //
26 class HooksTdbC : public HooksBaseC
27 {
28 public:
29 
30  // constructor
31  HooksTdbC();
32 
33  // destructor
34  ~HooksTdbC();
35 
36  // is this hook enabled?
37  static bool isEnabled();
38 
39 private:
40 
41  //
42  // CollOpC sub-class
43  //
44  class CollOpC
45  {
46  public:
47 
48  CollOpC();
49  CollOpC( uint64_t _num, uint64_t _bytes_sent, uint64_t _bytes_recv );
50 
51  CollOpC operator+=( const CollOpC & cs );
52 
53  uint64_t num;
54  uint64_t bytes_sent;
55  uint64_t bytes_recv;
56 
57  };
58 
59  //
60  // IoC sub-class
61  //
62  class IoC
63  {
64  public:
65 
66  IoC();
67 // IoC( uint64_t _num_read, uint64_t _bytes_read, uint64_t _num_written,
68 // uint64_t _bytes_written, uint64_t _num_open, uint64_t _num_close,
69 // uint64_t _num_seek );
70 
71  IoC operator+=( const IoC & is );
72 
73  uint64_t num_read;
74  uint64_t bytes_read;
75  uint64_t num_written;
76  uint64_t bytes_written;
77  uint64_t num_open;
78  uint64_t num_close;
79  uint64_t num_seek;
80 
81  };
82 
83  //
84  // MasterDataC sub-class
85  // (is only used on rank 0 for definitions)
86  //
87  class MasterDataC
88  {
89  public:
90 
91  MasterDataC();
92 
93  ~MasterDataC();
94 
95  uint64_t calcFilesize();
96 
97  int setFilepath( std::string file_prefix );
98 
99  int setHostname();
100 
101  void setOtfVersion();
102 
103  std::string otf_version;
104  std::string creator;
105  std::string filename;
106  std::string filepath;
107  std::string hostname;
108 
109  uint64_t starttime;
110  uint64_t runtime;
111  uint64_t filesize;
112  uint64_t num_streams;
113 
114  uint32_t num_processes;
115  uint32_t num_active_processes;
116  uint32_t num_threads;
117 
118  bool is_compressed;
119 
120  bool create_output;
121 
122 
123  std::map<std::string, std::string> vt_env;
124  std::vector<std::string> counter;
125 
126  // stores all function group definitions
127  // fgroup_id, fgroup_name
128  std::map<uint32_t, std::string> fgroup;
129 
130  // stores the fgroup_id for all "flush"-functions,
131  // necessary to check later if it was a vt_flush
132  // function_id, fgroup_id
133  std::map<uint32_t, uint32_t> flush_fgroup_ids;
134 
135  // save function_id fpr vt_flush here
136  uint32_t vt_flush_id;
137 
138  // collop, type
139  std::map<uint32_t, uint32_t> collop_def;
140 
141  // type, values
142  std::map<uint32_t, CollOpC> collop;
143 
144  private:
145 
146  std::string intToHex( int i );
147  std::string safeCwd();
148 
149  };
150 
151  //
152  // ThreadDataC
153  //
154  class ThreadDataC
155  {
156  public:
157 
158  ThreadDataC();
159 
160  ThreadDataC operator+=( const ThreadDataC & td );
161 
162  bool toBuffer( uint64_t * buf );
163 
164  ThreadDataC fromBuffer( const uint64_t * buf,
165  const uint64_t * num_bytes );
166 
167  uint64_t num_events;
168 
169  uint64_t num_enter;
170  uint64_t num_leave;
171  uint64_t num_sent;
172  uint64_t num_recv;
173  uint64_t bytes_sent;
174  uint64_t bytes_recv;
175 
176  uint64_t num_rma;
177  uint64_t bytes_rma;
178 
179  uint64_t num_marker;
180  uint64_t num_stats;
181  uint64_t num_snaps;
182 
183  uint64_t num_vt_flushes;
184 
185  // collop, values
186  std::map<uint32_t, CollOpC> collop;
187 
188  // ioflag, values
189  std::map<uint32_t, IoC> io;
190 
191  };
192 
193  // vvvvvvvvvvvvvvvvvvvv HOOK METHODS vvvvvvvvvvvvvvvvvvvv
194 
195  // initialization/finalization hooks
196  //
197 
198  void initHook();
199  void finalizeHook( const bool & error );
200 
201  // phase hooks
202  //
203 
204  void phaseHook_GetUnifyControls_post();
205  void phaseHook_UnifyDefinitions_post();
206  void phaseHook_UnifyEvents_pre();
207 
208  // record hooks
209  //
210 
211  void writeRecHook_DefComment( HooksC::VaArgsT & args );
212  void writeRecHook_DefCreator( HooksC::VaArgsT & args );
213  void writeRecHook_DefProcess( HooksC::VaArgsT & args );
214  void writeRecHook_DefFunctionGroup( HooksC::VaArgsT & args );
215  void writeRecHook_DefFunction( HooksC::VaArgsT & args );
216  void writeRecHook_DefCollOp( HooksC::VaArgsT & args );
217  void writeRecHook_DefCounter( HooksC::VaArgsT & args );
218  void writeRecHook_FunctionSummary( HooksC::VaArgsT & args );
219  void writeRecHook_MessageSummary( HooksC::VaArgsT & args );
220  void writeRecHook_CollOpSummary( HooksC::VaArgsT & args );
221  void writeRecHook_FileOpSummary( HooksC::VaArgsT & args );
222  void writeRecHook_MarkerSpot( HooksC::VaArgsT & args );
223  void writeRecHook_Enter( HooksC::VaArgsT & args );
224  void writeRecHook_Leave( HooksC::VaArgsT & args );
225  void writeRecHook_BeginFileOp( HooksC::VaArgsT & args );
226  void writeRecHook_EndFileOp( HooksC::VaArgsT & args );
227  void writeRecHook_SendMsg( HooksC::VaArgsT & args );
228  void writeRecHook_RecvMsg( HooksC::VaArgsT & args );
229  void writeRecHook_BeginCollOp( HooksC::VaArgsT & args );
230  void writeRecHook_EndCollOp( HooksC::VaArgsT & args );
231  void writeRecHook_RMAPut( HooksC::VaArgsT & args );
232  void writeRecHook_RMAPutRemoteEnd( HooksC::VaArgsT & args );
233  void writeRecHook_RMAGet( HooksC::VaArgsT & args );
234  void writeRecHook_RMAEnd( HooksC::VaArgsT & args );
235  void writeRecHook_Counter( HooksC::VaArgsT & args );
236  void writeRecHook_EventComment( HooksC::VaArgsT & args );
237 
238  // generic hook
239  void genericHook( const uint32_t & id, HooksC::VaArgsT & args );
240 
241  // ^^^^^^^^^^^^^^^^^^^^ HOOK METHODS ^^^^^^^^^^^^^^^^^^^^
242 
243  void handleFileOperation( uint32_t *operation, uint64_t *bytes);
244 
245  MasterDataC RootData;
246  std::vector<ThreadDataC> ThreadVector;
247 
248  uint64_t MinStartTimeEpoch;
249  uint64_t MaxStopTimeEpoch;
250 
251 };
252 
253 #endif // _VT_UNIFY_HOOKS_TDB_H_
VampirTrace http://www.tu-dresden.de/zih/vampirtrace.
Definition: vt_unify_hooks_base.h:23
VampirTrace http://www.tu-dresden.de/zih/vampirtrace.
Definition: vt_unify_hooks_tdb.h:26