QuantumLibrary
quantum_queue_statistics.h
1 /*
2 ** Copyright 2018 Bloomberg Finance L.P.
3 **
4 ** Licensed under the Apache License, Version 2.0 (the "License");
5 ** you may not use this file except in compliance with the License.
6 ** You may obtain a copy of the License at
7 **
8 ** http://www.apache.org/licenses/LICENSE-2.0
9 **
10 ** Unless required by applicable law or agreed to in writing, software
11 ** distributed under the License is distributed on an "AS IS" BASIS,
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ** See the License for the specific language governing permissions and
14 ** limitations under the License.
15 */
16 #ifndef BLOOMBERG_QUANTUM_QUEUE_STATISTICS_H
17 #define BLOOMBERG_QUANTUM_QUEUE_STATISTICS_H
18 
19 #include <quantum/interface/quantum_iqueue_statistics.h>
20 
21 namespace Bloomberg {
22 namespace quantum {
23 
24 //==============================================================================================
25 // class QueueStatistics
26 //==============================================================================================
31 {
32  friend class TaskQueue;
33  friend class IOQueue;
34 
35 public:
37 
38  //===================================
39  // IQUEUESTATISTICS
40  //===================================
41  void reset() final;
42 
43  size_t numElements() const final;
44 
45  void incNumElements() final;
46 
47  void decNumElements() final;
48 
49  size_t errorCount() const final;
50 
51  void incErrorCount() final;
52 
53  size_t sharedQueueErrorCount() const final;
54 
55  void incSharedQueueErrorCount() final;
56 
57  size_t completedCount() const final;
58 
59  void incCompletedCount() final;
60 
61  size_t sharedQueueCompletedCount() const final;
62 
63  void incSharedQueueCompletedCount() final;
64 
65  size_t postedCount() const final;
66 
67  void incPostedCount() final;
68 
69  size_t highPriorityCount() const final;
70 
71  void incHighPriorityCount() final;
72 
73  void print(std::ostream& out) const final;
74 
75  QueueStatistics& operator+=(const IQueueStatistics& rhs);
76 
77  friend QueueStatistics operator+(QueueStatistics lhs,
78  const IQueueStatistics& rhs);
79 
80 private:
81  size_t _numElements;
82  size_t _errorCount;
83  size_t _sharedQueueErrorCount;
84  size_t _completedCount;
85  size_t _sharedQueueCompletedCount;
86  size_t _postedCount;
87  size_t _highPriorityCount;
88 };
89 
90 }}
91 
92 #include <quantum/impl/quantum_queue_statistics_impl.h>
93 
94 #endif //BLOOMBERG_QUANTUM_QUEUE_STATISTICS_H
Definition: quantum_buffer_impl.h:22
size_t sharedQueueCompletedCount() const final
Count of all IO tasks which were dequeued from the shared queue and completed successfully.
Definition: quantum_queue_statistics_impl.h:98
QueueStatistics()
Definition: quantum_queue_statistics_impl.h:26
void reset() final
Reset all the counters to 0.
Definition: quantum_queue_statistics_impl.h:32
void incHighPriorityCount() final
Increment this counter.
Definition: quantum_queue_statistics_impl.h:128
size_t postedCount() const final
Count of all coroutine and IO tasks which were posted on this queue.
Definition: quantum_queue_statistics_impl.h:110
Definition: quantum_stl_impl.h:23
void incSharedQueueErrorCount() final
Increment this counter.
Definition: quantum_queue_statistics_impl.h:80
friend class IOQueue
Definition: quantum_queue_statistics.h:33
void incPostedCount() final
Increment this counter.
Definition: quantum_queue_statistics_impl.h:116
Provides various counters related to queues and task execution.
Definition: quantum_queue_statistics.h:30
size_t errorCount() const final
Count of all coroutine and IO task execution errors on this queue.
Definition: quantum_queue_statistics_impl.h:62
Thread queue for running coroutines.
Definition: quantum_task_queue.h:45
void incSharedQueueCompletedCount() final
Increment this counter.
Definition: quantum_queue_statistics_impl.h:104
size_t sharedQueueErrorCount() const final
Count of all IO tasks which were dequeued from the shared queue and failed.
Definition: quantum_queue_statistics_impl.h:74
void incCompletedCount() final
Increment this counter.
Definition: quantum_queue_statistics_impl.h:92
size_t highPriorityCount() const final
Count of all coroutine and IO tasks which were posted on this queue at higher priority.
Definition: quantum_queue_statistics_impl.h:122
void incErrorCount() final
Increment this counter.
Definition: quantum_queue_statistics_impl.h:68
size_t completedCount() const final
Count of all coroutine and IO tasks which completed successfully.
Definition: quantum_queue_statistics_impl.h:86
Interface to access and manipulate a QueueStatistics object.
Definition: quantum_iqueue_statistics.h:29
size_t numElements() const final
Gets the current size of the queue.
Definition: quantum_queue_statistics_impl.h:44
void incNumElements() final
Increment this counter.
Definition: quantum_queue_statistics_impl.h:50
void print(std::ostream &out) const final
Print to std::cout the value of all internal counters.
Definition: quantum_queue_statistics_impl.h:134
void decNumElements() final
Decrement this counter.
Definition: quantum_queue_statistics_impl.h:56