
00001 #ifndef _STATS_H 00002 #define _STATS_H 00003 00004 class Stats { 00005 private: 00006 UInt charesCreated; // # of new chare msgs sent 00007 UInt charesProcessed; // # of new chare msgs processed 00008 UInt forCharesCreated; // # of for chare msgs created 00009 UInt forCharesProcessed; // # of for chare msgs processed 00010 UInt groupInitsCreated; // # of group init msgs created 00011 UInt groupInitsProcessed; // # of groupinits processed 00012 UInt groupMsgsCreated; // # of for group msgs created 00013 UInt groupMsgsProcessed; // # of for group msgs processed 00014 UInt nodeGroupInitsCreated; // # of node group init msgs created 00015 UInt nodeGroupInitsProcessed; // # of node group inits processed 00016 UInt nodeGroupMsgsCreated; // # of for nodegroup msgs created 00017 UInt nodeGroupMsgsProcessed; // # of for nodegroup msgs processed 00018 public: 00019 void *operator new(size_t size) { return _allocMsg(StatMsg, size); } 00020 void operator delete(void *ptr) { CkFreeMsg(ptr); } 00021 Stats() { 00022 charesCreated = 0; 00023 charesProcessed = 0; 00024 forCharesCreated = 0; 00025 forCharesProcessed = 0; 00026 groupInitsCreated = 0; 00027 groupInitsProcessed = 0; 00028 groupMsgsCreated = 0; 00029 groupMsgsProcessed = 0; 00030 nodeGroupInitsCreated = 0; 00031 nodeGroupInitsProcessed = 0; 00032 nodeGroupMsgsCreated = 0; 00033 nodeGroupMsgsProcessed = 0; 00034 } 00035 void combine(const Stats* const other) { 00036 charesCreated += other->charesCreated; 00037 charesProcessed += other->charesProcessed; 00038 forCharesCreated += other->forCharesCreated; 00039 forCharesProcessed += other->forCharesProcessed; 00040 groupInitsCreated += other->groupInitsCreated; 00041 groupInitsProcessed += other->groupInitsProcessed; 00042 groupMsgsCreated += other->groupMsgsCreated; 00043 groupMsgsProcessed += other->groupMsgsProcessed; 00044 nodeGroupInitsCreated += other->nodeGroupInitsCreated; 00045 nodeGroupInitsProcessed += other->nodeGroupInitsProcessed; 00046 nodeGroupMsgsCreated += other->nodeGroupMsgsCreated; 00047 nodeGroupMsgsProcessed += other->nodeGroupMsgsProcessed; 00048 } 00049 void recordCreateChare(int x=1) { charesCreated += x; } 00050 void recordProcessChare(int x=1) { charesProcessed += x; } 00051 void recordSendMsg(int x=1) { forCharesCreated += x; } 00052 void recordProcessMsg(int x=1) { forCharesProcessed += x; } 00053 void recordCreateGroup(int x=1) { groupInitsCreated += x; } 00054 void recordProcessGroup(int x=1) { groupInitsProcessed += x; } 00055 void recordSendBranch(int x=1) { groupMsgsCreated += x; } 00056 void recordProcessBranch(int x=1) { groupMsgsProcessed += x; } 00057 void recordCreateNodeGroup(int x=1) { nodeGroupInitsCreated += x; } 00058 void recordProcessNodeGroup(int x=1) { nodeGroupInitsProcessed += x; } 00059 void recordSendNodeBranch(int x=1) { nodeGroupMsgsCreated += x; } 00060 void recordProcessNodeBranch(int x=1) { nodeGroupMsgsProcessed += x; } 00061 UInt getCharesCreated(void) const { return charesCreated; } 00062 UInt getCharesProcessed(void) const { return charesProcessed; } 00063 UInt getForCharesCreated(void) const { return forCharesCreated; } 00064 UInt getForCharesProcessed(void) const { return forCharesProcessed; } 00065 UInt getGroupsCreated(void) const { return groupInitsCreated; } 00066 UInt getGroupsProcessed(void) const { return groupInitsProcessed; } 00067 UInt getGroupMsgsCreated(void) const { return groupMsgsCreated; } 00068 UInt getGroupMsgsProcessed(void) const { return groupMsgsProcessed; } 00069 UInt getNodeGroupsCreated(void) const { return nodeGroupInitsCreated; } 00070 UInt getNodeGroupsProcessed(void) const { return nodeGroupInitsProcessed; } 00071 UInt getNodeGroupMsgsCreated(void) const { return nodeGroupMsgsCreated; } 00072 UInt getNodeGroupMsgsProcessed(void) const {return nodeGroupMsgsProcessed;} 00073 }; 00074 00075 CkpvExtern(Stats*, _myStats); 00076 00077 #if CMK_WITH_STATS 00078 #define _STATS_RECORD_CREATE_CHARE_1() \ 00079 CkpvAccess(_myStats)->recordCreateChare() 00080 #define _STATS_RECORD_CREATE_CHARE_N(x) \ 00081 CkpvAccess(_myStats)->recordCreateChare(x) 00082 #define _STATS_RECORD_PROCESS_CHARE_1() \ 00083 CkpvAccess(_myStats)->recordProcessChare() 00084 #define _STATS_RECORD_PROCESS_CHARE_N(x) \ 00085 CkpvAccess(_myStats)->recordProcessChare(x) 00086 #define _STATS_RECORD_SEND_MSG_1() \ 00087 CkpvAccess(_myStats)->recordSendMsg() 00088 #define _STATS_RECORD_SEND_MSG_N(x) \ 00089 CkpvAccess(_myStats)->recordSendMsg(x) 00090 #define _STATS_RECORD_PROCESS_MSG_1() \ 00091 CkpvAccess(_myStats)->recordProcessMsg() 00092 #define _STATS_RECORD_PROCESS_MSG_N(x) \ 00093 CkpvAccess(_myStats)->recordProcessMsg(x) 00094 #define _STATS_RECORD_CREATE_GROUP_1() \ 00095 CkpvAccess(_myStats)->recordCreateGroup() 00096 #define _STATS_RECORD_CREATE_GROUP_N(x) \ 00097 CkpvAccess(_myStats)->recordCreateGroup(x) 00098 #define _STATS_RECORD_PROCESS_GROUP_1() \ 00099 CkpvAccess(_myStats)->recordProcessGroup() 00100 #define _STATS_RECORD_PROCESS_GROUP_N(x) \ 00101 CkpvAccess(_myStats)->recordProcessGroup(x) 00102 #define _STATS_RECORD_SEND_BRANCH_1() \ 00103 CkpvAccess(_myStats)->recordSendBranch() 00104 #define _STATS_RECORD_SEND_BRANCH_N(x) \ 00105 CkpvAccess(_myStats)->recordSendBranch(x) 00106 #define _STATS_RECORD_PROCESS_BRANCH_1() \ 00107 CkpvAccess(_myStats)->recordProcessBranch() 00108 #define _STATS_RECORD_PROCESS_BRANCH_N(x) \ 00109 CkpvAccess(_myStats)->recordProcessBranch(x) 00110 #define _STATS_RECORD_CREATE_NODE_GROUP_1() \ 00111 CkpvAccess(_myStats)->recordCreateNodeGroup() 00112 #define _STATS_RECORD_CREATE_NODE_GROUP_N(x) \ 00113 CkpvAccess(_myStats)->recordCreateNodeGroup(x) 00114 #define _STATS_RECORD_PROCESS_NODE_GROUP_1() \ 00115 CkpvAccess(_myStats)->recordProcessNodeGroup() 00116 #define _STATS_RECORD_PROCESS_NODE_GROUP_N(x) \ 00117 CkpvAccess(_myStats)->recordProcessNodeGroup(x) 00118 #define _STATS_RECORD_SEND_NODE_BRANCH_1() \ 00119 CkpvAccess(_myStats)->recordSendNodeBranch() 00120 #define _STATS_RECORD_SEND_NODE_BRANCH_N(x) \ 00121 CkpvAccess(_myStats)->recordSendNodeBranch(x) 00122 #define _STATS_RECORD_PROCESS_NODE_BRANCH_1() \ 00123 CkpvAccess(_myStats)->recordProcessNodeBranch() 00124 #define _STATS_RECORD_PROCESS_NODE_BRANCH_N(x) \ 00125 CkpvAccess(_myStats)->recordProcessNodeBranch(x) 00126 #else 00127 #define _STATS_RECORD_CREATE_CHARE_1() do{}while(0) 00128 #define _STATS_RECORD_CREATE_CHARE_N(x) do{}while(0) 00129 #define _STATS_RECORD_PROCESS_CHARE_1() do{}while(0) 00130 #define _STATS_RECORD_PROCESS_CHARE_N(x) do{}while(0) 00131 #define _STATS_RECORD_SEND_MSG_1() do{}while(0) 00132 #define _STATS_RECORD_SEND_MSG_N(x) do{}while(0) 00133 #define _STATS_RECORD_PROCESS_MSG_1() do{}while(0) 00134 #define _STATS_RECORD_PROCESS_MSG_N(x) do{}while(0) 00135 #define _STATS_RECORD_CREATE_GROUP_1() do{}while(0) 00136 #define _STATS_RECORD_CREATE_GROUP_N(x) do{}while(0) 00137 #define _STATS_RECORD_PROCESS_GROUP_1() do{}while(0) 00138 #define _STATS_RECORD_PROCESS_GROUP_N(x) do{}while(0) 00139 #define _STATS_RECORD_SEND_BRANCH_1() do{}while(0) 00140 #define _STATS_RECORD_SEND_BRANCH_N(x) do{}while(0) 00141 #define _STATS_RECORD_PROCESS_BRANCH_1() do{}while(0) 00142 #define _STATS_RECORD_PROCESS_BRANCH_N(x) do{}while(0) 00143 #define _STATS_RECORD_CREATE_NODE_GROUP_1() do{}while(0) 00144 #define _STATS_RECORD_CREATE_NODE_GROUP_N(x) do{}while(0) 00145 #define _STATS_RECORD_PROCESS_NODE_GROUP_1() do{}while(0) 00146 #define _STATS_RECORD_PROCESS_NODE_GROUP_N(x) do{}while(0) 00147 #define _STATS_RECORD_SEND_NODE_BRANCH_1() do{}while(0) 00148 #define _STATS_RECORD_SEND_NODE_BRANCH_N(x) do{}while(0) 00149 #define _STATS_RECORD_PROCESS_NODE_BRANCH_1() do{}while(0) 00150 #define _STATS_RECORD_PROCESS_NODE_BRANCH_N(x) do{}while(0) 00151 #endif 00152 #endif
1.5.5