Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
kcenon::thread::metrics::SlidingWindowCounter::Bucket Struct Reference

Time bucket structure. More...

Collaboration diagram for kcenon::thread::metrics::SlidingWindowCounter::Bucket:
Collaboration graph

Public Member Functions

 Bucket ()=default
 
 Bucket (const Bucket &other)
 
 Bucket (Bucket &&other) noexcept
 
Bucketoperator= (const Bucket &other)
 
Bucketoperator= (Bucket &&other) noexcept
 

Public Attributes

std::atomic< std::uint64_t > count {0}
 
std::atomic< std::uint64_t > timestamp_ms {0}
 

Detailed Description

Time bucket structure.

Note: Custom constructors are needed because std::atomic is not move/copy constructible by default.

Definition at line 156 of file sliding_window_counter.h.

Constructor & Destructor Documentation

◆ Bucket() [1/3]

kcenon::thread::metrics::SlidingWindowCounter::Bucket::Bucket ( )
default

◆ Bucket() [2/3]

kcenon::thread::metrics::SlidingWindowCounter::Bucket::Bucket ( const Bucket & other)
inline

Definition at line 162 of file sliding_window_counter.h.

163 : count(other.count.load(std::memory_order_relaxed)),
164 timestamp_ms(other.timestamp_ms.load(std::memory_order_relaxed)) {}

◆ Bucket() [3/3]

kcenon::thread::metrics::SlidingWindowCounter::Bucket::Bucket ( Bucket && other)
inlinenoexcept

Definition at line 166 of file sliding_window_counter.h.

167 : count(other.count.load(std::memory_order_relaxed)),
168 timestamp_ms(other.timestamp_ms.load(std::memory_order_relaxed)) {}

Member Function Documentation

◆ operator=() [1/2]

Bucket & kcenon::thread::metrics::SlidingWindowCounter::Bucket::operator= ( Bucket && other)
inlinenoexcept

Definition at line 180 of file sliding_window_counter.h.

180 {
181 if (this != &other) {
182 count.store(other.count.load(std::memory_order_relaxed),
183 std::memory_order_relaxed);
184 timestamp_ms.store(other.timestamp_ms.load(std::memory_order_relaxed),
185 std::memory_order_relaxed);
186 }
187 return *this;
188 }

References count, and timestamp_ms.

◆ operator=() [2/2]

Bucket & kcenon::thread::metrics::SlidingWindowCounter::Bucket::operator= ( const Bucket & other)
inline

Definition at line 170 of file sliding_window_counter.h.

170 {
171 if (this != &other) {
172 count.store(other.count.load(std::memory_order_relaxed),
173 std::memory_order_relaxed);
174 timestamp_ms.store(other.timestamp_ms.load(std::memory_order_relaxed),
175 std::memory_order_relaxed);
176 }
177 return *this;
178 }

References count, and timestamp_ms.

Member Data Documentation

◆ count

std::atomic<std::uint64_t> kcenon::thread::metrics::SlidingWindowCounter::Bucket::count {0}

Definition at line 157 of file sliding_window_counter.h.

157{0};

Referenced by operator=(), and operator=().

◆ timestamp_ms

std::atomic<std::uint64_t> kcenon::thread::metrics::SlidingWindowCounter::Bucket::timestamp_ms {0}

Definition at line 158 of file sliding_window_counter.h.

158{0}; // Bucket start time

Referenced by operator=(), and operator=().


The documentation for this struct was generated from the following file: