Debian Codegraph @

Source/Scheduler/CTaskProcessingStatistics.cpp

raw
1 /*
2 * Copyright (C) 2013-2015, 2019 by the Konclude Developer Team.
3 *
4 * This file is part of the reasoning system Konclude.
5 * For details and support, see <http://konclude.com/>.
6 *
7 * Konclude is free software: you can redistribute it and/or modify
8 * it under the terms of version 3 of the GNU Lesser General Public
9 * License (LGPLv3) as published by the Free Software Foundation.
10 *
11 * Konclude is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU (Lesser) General Public License for more details.
15 *
16 * You should have received a copy of the GNU (Lesser) General Public
17 * License along with Konclude. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20
21 #include "CTaskProcessingStatistics.h"
22
23
24 namespace Konclude {
25
26 namespace Scheduler {
27
28
29
30 CTaskProcessingStatistics::CTaskProcessingStatistics() {
31 mTaskCreatedDepthCountVec.resize(VECCOUNTERSIZE);
32 mTaskProcessedDepthCountVec.resize(VECCOUNTERSIZE);
33 clear();
34 }
35
36 CTaskProcessingStatistics::~CTaskProcessingStatistics() {
37 }
38
39
40 CTaskProcessingStatistics* CTaskProcessingStatistics::clear() {
41 mStatTasksProcessed = 0;
42 mStatTasksAdded = 0;
43 mStatTasksCreated = 0;
44 mStatTasksCompleted = 0;
45 mStatTasksUpdated = 0;
46 mStatEventsProcessed = 0;
47 mStatTasksRequested = 0;
48 mStatThreadBlocked = 0;
49 mStatCallbacksExecuted = 0;
50 for (cint64 i = 0; i < VECCOUNTERSIZE; ++i) {
51 mTaskCreatedDepthCountVec[i] = 0;
52 mTaskProcessedDepthCountVec[i] = 0;
53 }
54 return this;
55 }
56
57
58 CTaskProcessingStatistics* CTaskProcessingStatistics::incStatisticTasksProcessedCount(cint64 incCount) {
59 mStatTasksProcessed += incCount;
60 return this;
61 }
62
63 CTaskProcessingStatistics* CTaskProcessingStatistics::incStatisticTasksAddedCount(cint64 incCount) {
64 mStatTasksAdded += incCount;
65 return this;
66 }
67
68 CTaskProcessingStatistics* CTaskProcessingStatistics::incStatisticTasksCreatedCount(cint64 incCount) {
69 mStatTasksCreated += incCount;
70 return this;
71 }
72
73 CTaskProcessingStatistics* CTaskProcessingStatistics::incStatisticTasksCompletedCount(cint64 incCount) {
74 mStatTasksCompleted += incCount;
75 return this;
76 }
77
78 CTaskProcessingStatistics* CTaskProcessingStatistics::incStatisticTasksUpdatedCount(cint64 incCount) {
79 mStatTasksUpdated += incCount;
80 return this;
81 }
82
83 CTaskProcessingStatistics* CTaskProcessingStatistics::incStatisticEventsProcessedCount(cint64 incCount) {
84 mStatEventsProcessed += incCount;
85 return this;
86 }
87
88
89 CTaskProcessingStatistics* CTaskProcessingStatistics::incStatisticTasksRequestedCount(cint64 incCount) {
90 mStatTasksRequested += incCount;
91 return this;
92 }
93
94 CTaskProcessingStatistics* CTaskProcessingStatistics::incStatisticThreadsBlockedCount(cint64 incCount) {
95 mStatThreadBlocked += incCount;
96 return this;
97 }
98
99 CTaskProcessingStatistics* CTaskProcessingStatistics::incStatisticCallbacksExecutedCount(cint64 incCount) {
100 mStatCallbacksExecuted += incCount;
101 return this;
102 }
103
104
105 cint64 CTaskProcessingStatistics::getStatisticTasksProcessedCount() {
106 return mStatTasksProcessed;
107 }
108
109 cint64 CTaskProcessingStatistics::getStatisticTasksAddedCount() {
110 return mStatTasksAdded;
111 }
112
113 cint64 CTaskProcessingStatistics::getStatisticTasksCreatedCount() {
114 return mStatTasksCreated;
115 }
116
117 cint64 CTaskProcessingStatistics::getStatisticTasksCompletedCount() {
118 return mStatTasksCompleted;
119 }
120
121 cint64 CTaskProcessingStatistics::getStatisticTasksUpdatedCount() {
122 return mStatTasksUpdated;
123 }
124
125 cint64 CTaskProcessingStatistics::getStatisticEventsProcessedCount() {
126 return mStatEventsProcessed;
127 }
128
129 cint64 CTaskProcessingStatistics::getStatisticTasksRequestedCount() {
130 return mStatTasksRequested;
131 }
132
133 cint64 CTaskProcessingStatistics::getStatisticThreadsBlockedCount() {
134 return mStatThreadBlocked;
135 }
136
137
138 cint64 CTaskProcessingStatistics::getStatisticCallbacksExecutedCount() {
139 return mStatCallbacksExecuted;
140 }
141
142
143 CTaskProcessingStatistics* CTaskProcessingStatistics::incStatisticTasksCreatedDepthCount(cint64 taskDepth, cint64 incCount) {
144 if (taskDepth >= 0 && taskDepth < VECCOUNTERSIZE) {
145 mTaskCreatedDepthCountVec[taskDepth] += incCount;
146 }
147 return this;
148 }
149
150 CTaskProcessingStatistics* CTaskProcessingStatistics::incStatisticTasksProcessedDepthCount(cint64 taskDepth, cint64 incCount) {
151 if (taskDepth >= 0 && taskDepth < VECCOUNTERSIZE) {
152 mTaskProcessedDepthCountVec[taskDepth] += incCount;
153 }
154 return this;
155 }
156
157 cint64 CTaskProcessingStatistics::getStatisticTasksCreatedDepthCount(cint64 taskDepth) {
158 if (taskDepth >= 0 && taskDepth < VECCOUNTERSIZE) {
159 return mTaskCreatedDepthCountVec[taskDepth];
160 } else {
161 return 0;
162 }
163 }
164
165 cint64 CTaskProcessingStatistics::getStatisticTasksProcessedDepthCount(cint64 taskDepth) {
166 if (taskDepth >= 0 && taskDepth < VECCOUNTERSIZE) {
167 return mTaskProcessedDepthCountVec[taskDepth];
168 } else {
169 return 0;
170 }
171 }
172
173
174 QVector<cint64>* CTaskProcessingStatistics::getStatisticTasksCreatedDepthCountVector() {
175 return &mTaskCreatedDepthCountVec;
176 }
177
178 QVector<cint64>* CTaskProcessingStatistics::getStatisticTasksProcessedDepthCountVector() {
179 return &mTaskProcessedDepthCountVec;
180 }
181
182
183 }; // end namespace Scheduler
184
185 }; // end namespace Konclude