OpenMPI  0.1.1
vt_filter_trc.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_FILTER_TRC_H_
14 #define _VT_FILTER_TRC_H_
15 
16 #include "vt_filter_common.h"
17 
18 #include <map>
19 #include <set>
20 #include <string>
21 #include <vector>
22 
23 //
24 // FilterTraceC class
25 //
27 {
28 public:
29 
30  //
31  // data structure for filter rules
32  //
33  struct FilterS
34  {
35  // check whether a process id is disabled
36  inline bool isProcOff( const uint32_t& proc ) const
37  {
38  return ( procsOff.find( proc ) != procsOff.end() );
39  }
40 
41 #ifdef VT_MPI
42  // The following functions are significant for the MPI-parallel version of
43  // vtfilter to transfer the filter rules to all worker ranks.
44 
45  // get size needed to pack filter information
46  VT_MPI_INT getPackSize( const uint32_t& proc,
47  const MPI_Comm& comm = MPI_COMM_WORLD );
48 
49  // pack filter rules into a buffer
50  void pack( const uint32_t& proc, char*& buffer,
51  const VT_MPI_INT& bufferSize, VT_MPI_INT& bufferPos,
52  const MPI_Comm& comm = MPI_COMM_WORLD );
53 
54  // unpack filter rules from a buffer
55  void unpack( const uint32_t& proc, char*& buffer,
56  const VT_MPI_INT& bufferSize, VT_MPI_INT& bufferPos,
57  const MPI_Comm& comm = MPI_COMM_WORLD );
58 #endif // VT_MPI
59 
60  // set of disabled process ids
61  std::set<uint32_t> procsOff;
62 
63  // map for global and process specific filter rules
64  // (process id 0 holds the global filter rules)
65  std::map<uint32_t, /* process id */
66  std::map<uint32_t, /* function id */
67  int32_t /* call limit */> > procFuncLimits;
68 
69  };
70 
71  // contructor
72  FilterTraceC();
73 
74  // destructor
75  ~FilterTraceC();
76 
77  // filter input trace file
78  bool run();
79 
80 private:
81 
82  // read definitions of input trace file to get processes and functions
83  bool readDefinitions( std::vector<std::pair<uint32_t, uint32_t> >& procs,
84  std::map<uint32_t, std::string>& funcs );
85 
86  // read input filter file to get filter rules of each process and function
87  bool readFilter( const std::vector<std::pair<uint32_t, uint32_t> >& procs,
88  const std::map<uint32_t, std::string>& funcs );
89 
90 #ifdef VT_MPI
91  // share filter rules to worker ranks
92  bool shareFilter( void );
93 #endif // VT_MPI
94 
95  // write OTF master control of output trace file
96  bool writeMasterControl( void );
97 
98  // read/write trace definitions
99  bool processDefinitions( void );
100 
101  // read/write trace markers
102  bool processMarkers( void );
103 
104  // read/write trace events and statistics
105  bool processEventsAndStatistics( void );
106 
107  // get the number of input streams
108  bool getNumStreams( uint32_t& numStreams );
109 
110  // get max. bytes to read (significant only for progress)
111  bool getMaxBytesToRead( uint64_t& maxBytes );
112 
113  // map of output stream/process ids
114  std::map<uint32_t, std::set<uint32_t> > m_streamProcs;
115 
116  // storage of filter rules
117  FilterS m_filter;
118 
119 };
120 
121 #endif // _VT_FILTER_TRC_H_
VampirTrace http://www.tu-dresden.de/zih/vampirtrace.
Definition: vt_filter_trc.h:26
FilterTraceC()
VampirTrace http://www.tu-dresden.de/zih/vampirtrace.
Definition: vt_filter_trc.cc:35
VampirTrace http://www.tu-dresden.de/zih/vampirtrace.
Definition: vt_filter_common.h:26
Definition: communicator.h:118
Definition: vt_filter_trc.h:33