OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
IpplMessageCounter.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /***************************************************************************
3  *
4  * The IPPL Framework
5  *
6  *
7  * Visit http://people.web.psi.ch/adelmann/ for more details
8  *
9  ***************************************************************************/
10 
11 #ifndef IPPL_MESSAGE_COUNTER_H
12 #define IPPL_MESSAGE_COUNTER_H
13 
14 /*************************************************************************
15  * IpplMessageCounter counts messages sent inside a region
16  *************************************************************************/
17 #include "Message/GlobalComm.h"
18 #include "Message/Message.h"
19 #include "Utility/Inform.h"
20 
21 #include <vector>
22 #include <string>
23 
25 public:
26  IpplMessageCounterRegion(const std::string&);
27  void begin();
28  void end();
29  void registerMessage(int);
30  void print(Inform&);
31 private:
32  std::string name;
33  unsigned count;
34  unsigned total_size;
35  int index;
36 };
37 
39 {
40 public:
42  {
43  static IpplMessageCounter instance;
44  return instance;
45  }
46 
48 
49  void setActiveRegion(int);
50  void unsetActiveRegion();
51 
53 
54  void registerMessage(int);
55  void on() { ison = true; }
56  void off() { ison = false; }
57 
58  void print();
59 private:
63 
64 
66  std::vector<IpplMessageCounterRegion*> counterRegions;
67  bool ison;
68 };
69 
70 #endif
71 
IpplMessageCounterRegion(const std::string &)
int addRegion(IpplMessageCounterRegion *)
std::vector< IpplMessageCounterRegion * > counterRegions
static IpplMessageCounter & getInstance()
IpplMessageCounterRegion * getActiveRegion()
Definition: Inform.h:41
IpplMessageCounter & operator=(IpplMessageCounter const &copy)