OpenMPI  0.1.1
vt_unify_markers.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_MARKERS_H_
14 #define _VT_UNIFY_MARKERS_H_
15 
16 #include "config.h"
17 
18 #include "vt_inttypes.h"
19 
20 #include "vt_unify.h"
21 #include "vt_unify_defs_recs.h"
22 #include "vt_unify_lvector.hh"
23 #include "vt_unify_tkfac.h"
24 
25 #include <set>
26 
27 //
28 // MarkersC class
29 //
30 class MarkersC
31 {
32 public:
33 
34  //
35  // marker spot structure
36  //
37  struct MarkerSpotS
38  {
39  MarkerSpotS()
40  : proc( 0 ), time( 0 ), marker( 0 ) {}
41  MarkerSpotS( const uint32_t & _proc, const uint64_t & _time,
42  const uint32_t & _marker, const std::string & _text )
43  : proc( _proc ), time( _time ), marker( _marker ), text( _text ) {}
44 
45 #ifdef VT_MPI
46  // get size needed to pack marker spot
47  VT_MPI_INT getPackSize();
48  // pack marker spot into a buffer
49  void pack( char *& buffer, const VT_MPI_INT & bufferSize,
50  VT_MPI_INT & bufferPos );
51  // unpack marker spot from a buffer
52  void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
53  VT_MPI_INT & bufferPos );
54 #endif // VT_MPI
55 
56  // operator for sorting global marker spots
57  // (not really necessary - but it can't hurt)
58  bool operator<( const MarkerSpotS & a ) const
59  {
60  if( proc == a.proc )
61  return time < a.time;
62  else
63  return proc < a.proc;
64  }
65 
66  uint32_t proc; // process id
67  uint64_t time; // timestamp
68  uint32_t marker; // marker id
69  std::string text; // marker text
70 
71  };
72 
73  // constructor
74  MarkersC();
75 
76  // destructor
77  ~MarkersC();
78 
79  // unify markers
80  bool run();
81 
82  // rename temporary output files
83  bool cleanUp();
84 
85 private:
86 
87  // read local markers
88  bool readLocal();
89 
90  // read local markers of certain stream
91  bool readLocal( const uint32_t & streamId,
92  LargeVectorC<DefRec_DefMarkerS*> & locDefs,
93  LargeVectorC<MarkerSpotS*> & locSpots );
94 
95  // write global markers
96  bool writeGlobal();
97 
98 #ifdef VT_MPI
99 
100  // gather either local marker defs. or spots
101  typedef enum { GATHER_TYPE_DEFS, GATHER_TYPE_SPOTS } GatherTypeT;
102  bool gatherLocal( const GatherTypeT & type, void * locRecs );
103 
104 #endif // VT_MPI
105 
106  // token factory scope for marker definitions
108 
109  // global marker definitions
110  std::set<DefRec_DefMarkerS> m_globDefs;
111 
112  // global marker spots
113  LargeVectorC<MarkerSpotS> m_globSpots;
114 
115 };
116 
117 // instance of class MarkersC
118 extern MarkersC * theMarkers;
119 
120 #endif // _VT_UNIFY_MARKERS_H_
Definition: vt_unify_markers.h:37
VampirTrace http://www.tu-dresden.de/zih/vampirtrace.
Definition: vt_unify_markers.h:30