OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
IpplMessageCounter.cpp
Go to the documentation of this file.
2
4
6{
7
8}
9
11{
12 if(activeRegion>=0 && (unsigned int) activeRegion<counterRegions.size())
14 else
15 return 0;
16}
17
19{
20 activeRegion = ar;
21}
22
24{
25 activeRegion = -1;
26}
27
29{
30 counterRegions.push_back(mcr); return counterRegions.size()-1;
31}
32
34{
35 if(ison && getActiveRegion())
37}
38
40 : name(n), count(0), total_size(0)
41{
43}
44
46{
48}
49
51{
53}
54
56{
57 count++;
58 total_size += size;
59 //std::cout << "node " << Ippl::myNode() << " sent message of size " << size << std::endl;
60}
61
62
64{
65 Inform msg("MsgCounter");
66 msg << "Message Counts------------------------------------------------\n";
67 for(unsigned int i=0;i<counterRegions.size();++i)
68 {
69 counterRegions[i]->print(msg);
70 }
71 msg << "--------------------------------------------------------------\n";
72}
73
75{
76 unsigned total_count=0, total_total_size=0;
77 reduce(count, total_count, OpAddAssign());
78 reduce(total_size, total_total_size, OpAddAssign());
79 msg << name << " count = " << total_count << " size = "
80 << total_total_size/(1024.*1024.) << " Mb" << endl;
81}
bool reduce(Communicate &, InputIterator, InputIterator, OutputIterator, const ReduceOp &, bool *IncludeVal=0)
Definition: GlobalComm.hpp:55
Inform & endl(Inform &inf)
Definition: Inform.cpp:42
const std::string name
Definition: Inform.h:42
IpplMessageCounterRegion(const std::string &)
IpplMessageCounterRegion * getActiveRegion()
std::vector< IpplMessageCounterRegion * > counterRegions
static IpplMessageCounter & getInstance()
int addRegion(IpplMessageCounterRegion *)