Enable support for building mpi-win-x86_64-gcc
[charm.git] / src / ck-core / stats.h
blobac30ad471b76ef5c0549cfd9745b16ef5bc18c70
1 #ifndef _STATS_H
2 #define _STATS_H
4 class Stats {
5 private:
6 UInt pe;
7 UInt charesCreated; // # of new chare msgs sent
8 UInt charesProcessed; // # of new chare msgs processed
9 UInt forCharesCreated; // # of for chare msgs created
10 UInt forCharesProcessed; // # of for chare msgs processed
11 UInt groupInitsCreated; // # of group init msgs created
12 UInt groupInitsProcessed; // # of groupinits processed
13 UInt groupMsgsCreated; // # of for group msgs created
14 UInt groupMsgsProcessed; // # of for group msgs processed
15 UInt nodeGroupInitsCreated; // # of node group init msgs created
16 UInt nodeGroupInitsProcessed; // # of node group inits processed
17 UInt nodeGroupMsgsCreated; // # of for nodegroup msgs created
18 UInt nodeGroupMsgsProcessed; // # of for nodegroup msgs processed
19 public:
20 void *operator new(size_t size) { return _allocMsg(StatMsg, size); }
21 void operator delete(void *ptr) { CkFreeMsg(ptr); }
22 Stats() {
23 pe = CkMyPe();
24 charesCreated = 0;
25 charesProcessed = 0;
26 forCharesCreated = 0;
27 forCharesProcessed = 0;
28 groupInitsCreated = 0;
29 groupInitsProcessed = 0;
30 groupMsgsCreated = 0;
31 groupMsgsProcessed = 0;
32 nodeGroupInitsCreated = 0;
33 nodeGroupInitsProcessed = 0;
34 nodeGroupMsgsCreated = 0;
35 nodeGroupMsgsProcessed = 0;
37 void combine(const Stats* const other) {
38 charesCreated += other->charesCreated;
39 charesProcessed += other->charesProcessed;
40 forCharesCreated += other->forCharesCreated;
41 forCharesProcessed += other->forCharesProcessed;
42 groupInitsCreated += other->groupInitsCreated;
43 groupInitsProcessed += other->groupInitsProcessed;
44 groupMsgsCreated += other->groupMsgsCreated;
45 groupMsgsProcessed += other->groupMsgsProcessed;
46 nodeGroupInitsCreated += other->nodeGroupInitsCreated;
47 nodeGroupInitsProcessed += other->nodeGroupInitsProcessed;
48 nodeGroupMsgsCreated += other->nodeGroupMsgsCreated;
49 nodeGroupMsgsProcessed += other->nodeGroupMsgsProcessed;
51 void recordCreateChare(int x=1) { charesCreated += x; }
52 void recordProcessChare(int x=1) { charesProcessed += x; }
53 void recordSendMsg(int x=1) { forCharesCreated += x; }
54 void recordProcessMsg(int x=1) { forCharesProcessed += x; }
55 void recordCreateGroup(int x=1) { groupInitsCreated += x; }
56 void recordProcessGroup(int x=1) { groupInitsProcessed += x; }
57 void recordSendBranch(int x=1) { groupMsgsCreated += x; }
58 void recordProcessBranch(int x=1) { groupMsgsProcessed += x; }
59 void recordCreateNodeGroup(int x=1) { nodeGroupInitsCreated += x; }
60 void recordProcessNodeGroup(int x=1) { nodeGroupInitsProcessed += x; }
61 void recordSendNodeBranch(int x=1) { nodeGroupMsgsCreated += x; }
62 void recordProcessNodeBranch(int x=1) { nodeGroupMsgsProcessed += x; }
63 UInt getPe(void) const { return pe; }
64 UInt getCharesCreated(void) const { return charesCreated; }
65 UInt getCharesProcessed(void) const { return charesProcessed; }
66 UInt getForCharesCreated(void) const { return forCharesCreated; }
67 UInt getForCharesProcessed(void) const { return forCharesProcessed; }
68 UInt getGroupsCreated(void) const { return groupInitsCreated; }
69 UInt getGroupsProcessed(void) const { return groupInitsProcessed; }
70 UInt getGroupMsgsCreated(void) const { return groupMsgsCreated; }
71 UInt getGroupMsgsProcessed(void) const { return groupMsgsProcessed; }
72 UInt getNodeGroupsCreated(void) const { return nodeGroupInitsCreated; }
73 UInt getNodeGroupsProcessed(void) const { return nodeGroupInitsProcessed; }
74 UInt getNodeGroupMsgsCreated(void) const { return nodeGroupMsgsCreated; }
75 UInt getNodeGroupMsgsProcessed(void) const {return nodeGroupMsgsProcessed;}
78 CkpvExtern(Stats*, _myStats);
80 #if CMK_WITH_STATS
81 #define _STATS_RECORD_CREATE_CHARE_1() \
82 CkpvAccess(_myStats)->recordCreateChare()
83 #define _STATS_RECORD_CREATE_CHARE_N(x) \
84 CkpvAccess(_myStats)->recordCreateChare(x)
85 #define _STATS_RECORD_PROCESS_CHARE_1() \
86 CkpvAccess(_myStats)->recordProcessChare()
87 #define _STATS_RECORD_PROCESS_CHARE_N(x) \
88 CkpvAccess(_myStats)->recordProcessChare(x)
89 #define _STATS_RECORD_SEND_MSG_1() \
90 CkpvAccess(_myStats)->recordSendMsg()
91 #define _STATS_RECORD_SEND_MSG_N(x) \
92 CkpvAccess(_myStats)->recordSendMsg(x)
93 #define _STATS_RECORD_PROCESS_MSG_1() \
94 CkpvAccess(_myStats)->recordProcessMsg()
95 #define _STATS_RECORD_PROCESS_MSG_N(x) \
96 CkpvAccess(_myStats)->recordProcessMsg(x)
97 #define _STATS_RECORD_CREATE_GROUP_1() \
98 CkpvAccess(_myStats)->recordCreateGroup()
99 #define _STATS_RECORD_CREATE_GROUP_N(x) \
100 CkpvAccess(_myStats)->recordCreateGroup(x)
101 #define _STATS_RECORD_PROCESS_GROUP_1() \
102 CkpvAccess(_myStats)->recordProcessGroup()
103 #define _STATS_RECORD_PROCESS_GROUP_N(x) \
104 CkpvAccess(_myStats)->recordProcessGroup(x)
105 #define _STATS_RECORD_SEND_BRANCH_1() \
106 CkpvAccess(_myStats)->recordSendBranch()
107 #define _STATS_RECORD_SEND_BRANCH_N(x) \
108 CkpvAccess(_myStats)->recordSendBranch(x)
109 #define _STATS_RECORD_PROCESS_BRANCH_1() \
110 CkpvAccess(_myStats)->recordProcessBranch()
111 #define _STATS_RECORD_PROCESS_BRANCH_N(x) \
112 CkpvAccess(_myStats)->recordProcessBranch(x)
113 #define _STATS_RECORD_CREATE_NODE_GROUP_1() \
114 CkpvAccess(_myStats)->recordCreateNodeGroup()
115 #define _STATS_RECORD_CREATE_NODE_GROUP_N(x) \
116 CkpvAccess(_myStats)->recordCreateNodeGroup(x)
117 #define _STATS_RECORD_PROCESS_NODE_GROUP_1() \
118 CkpvAccess(_myStats)->recordProcessNodeGroup()
119 #define _STATS_RECORD_PROCESS_NODE_GROUP_N(x) \
120 CkpvAccess(_myStats)->recordProcessNodeGroup(x)
121 #define _STATS_RECORD_SEND_NODE_BRANCH_1() \
122 CkpvAccess(_myStats)->recordSendNodeBranch()
123 #define _STATS_RECORD_SEND_NODE_BRANCH_N(x) \
124 CkpvAccess(_myStats)->recordSendNodeBranch(x)
125 #define _STATS_RECORD_PROCESS_NODE_BRANCH_1() \
126 CkpvAccess(_myStats)->recordProcessNodeBranch()
127 #define _STATS_RECORD_PROCESS_NODE_BRANCH_N(x) \
128 CkpvAccess(_myStats)->recordProcessNodeBranch(x)
129 #else
130 #define _STATS_RECORD_CREATE_CHARE_1() do{}while(0)
131 #define _STATS_RECORD_CREATE_CHARE_N(x) do{}while(0)
132 #define _STATS_RECORD_PROCESS_CHARE_1() do{}while(0)
133 #define _STATS_RECORD_PROCESS_CHARE_N(x) do{}while(0)
134 #define _STATS_RECORD_SEND_MSG_1() do{}while(0)
135 #define _STATS_RECORD_SEND_MSG_N(x) do{}while(0)
136 #define _STATS_RECORD_PROCESS_MSG_1() do{}while(0)
137 #define _STATS_RECORD_PROCESS_MSG_N(x) do{}while(0)
138 #define _STATS_RECORD_CREATE_GROUP_1() do{}while(0)
139 #define _STATS_RECORD_CREATE_GROUP_N(x) do{}while(0)
140 #define _STATS_RECORD_PROCESS_GROUP_1() do{}while(0)
141 #define _STATS_RECORD_PROCESS_GROUP_N(x) do{}while(0)
142 #define _STATS_RECORD_SEND_BRANCH_1() do{}while(0)
143 #define _STATS_RECORD_SEND_BRANCH_N(x) do{}while(0)
144 #define _STATS_RECORD_PROCESS_BRANCH_1() do{}while(0)
145 #define _STATS_RECORD_PROCESS_BRANCH_N(x) do{}while(0)
146 #define _STATS_RECORD_CREATE_NODE_GROUP_1() do{}while(0)
147 #define _STATS_RECORD_CREATE_NODE_GROUP_N(x) do{}while(0)
148 #define _STATS_RECORD_PROCESS_NODE_GROUP_1() do{}while(0)
149 #define _STATS_RECORD_PROCESS_NODE_GROUP_N(x) do{}while(0)
150 #define _STATS_RECORD_SEND_NODE_BRANCH_1() do{}while(0)
151 #define _STATS_RECORD_SEND_NODE_BRANCH_N(x) do{}while(0)
152 #define _STATS_RECORD_PROCESS_NODE_BRANCH_1() do{}while(0)
153 #define _STATS_RECORD_PROCESS_NODE_BRANCH_N(x) do{}while(0)
154 #endif
155 #endif