QuantumLibrary
quantum_sequence_key_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_SEQUENCE_KEY_STATISTICS_H
17 #define BLOOMBERG_QUANTUM_SEQUENCE_KEY_STATISTICS_H
18 
19 #include <vector>
20 #include <tuple>
21 #include <atomic>
22 #include <memory>
23 
24 namespace Bloomberg {
25 namespace quantum {
26 
27 //==============================================================================================
28 // class SequenceKeyStatistics
29 //==============================================================================================
33 {
34 public:
36  SequenceKeyStatistics() = default;
37 
40 
43 
46 
49 
53  size_t getPostedTaskCount() const;
54 
58  size_t getPendingTaskCount() const;
59 
60 protected:
62  size_t _postedTaskCount{0};
64  std::atomic<size_t> _pendingTaskCount{0};
65 };
66 
67 //==============================================================================================
68 // class SequenceKeyStatisticsWriter
69 //==============================================================================================
73 {
74 public:
78 
81 
84 };
85 
86 }}
87 
88 #include <quantum/util/impl/quantum_sequence_key_statistics_impl.h>
89 
90 #endif //BLOOMBERG_QUANTUM_SEQUENCE_KEY_STATISTICS_H
Definition: quantum_buffer_impl.h:22
void incrementPendingTaskCount()
Increments the total number of pending tasks associated with the key.
Definition: quantum_sequence_key_statistics_impl.h:78
Definition: quantum_sequence_key_statistics.h:72
std::atomic< size_t > _pendingTaskCount
Number of pending tasks associated with the sequence key.
Definition: quantum_sequence_key_statistics.h:64
void incrementPostedTaskCount()
Increments the total number of tasks associated with the key that have been posted to the Sequencer s...
Definition: quantum_sequence_key_statistics_impl.h:71
void decrementPendingTaskCount()
Increments the total number of pending tasks associated with the key.
Definition: quantum_sequence_key_statistics_impl.h:85
SequenceKeyStatistics()=default
Constructor.
Implementation of a statistics collection for a SequenceKey in Sequencer.
Definition: quantum_sequence_key_statistics.h:32
size_t _postedTaskCount
Number of posted tasks associated with the sequence key.
Definition: quantum_sequence_key_statistics.h:62
size_t getPostedTaskCount() const
Gets the total number of tasks associated with the key that have been posted to the Sequencer since t...
Definition: quantum_sequence_key_statistics_impl.h:57
SequenceKeyStatistics & operator=(const SequenceKeyStatistics &that)
Assignment operator.
Definition: quantum_sequence_key_statistics_impl.h:48
size_t getPendingTaskCount() const
Gets the total number of pending tasks associated with the key.
Definition: quantum_sequence_key_statistics_impl.h:64