StormByte-Buffer 2.0.0
C++26 buffer module of the StormByte suite
 
Loading...
Searching...
No Matches
telemetry.hxx
Go to the documentation of this file.
1/*
2 * Copyright (C) 2024-2026 David C. Manuelda (StormBytePP)
3 *
4 * This file is part of StormByte-Buffer.
5 *
6 * StormByte-Buffer original source is dual-licensed:
7 *
8 * 1. GNU Lesser General Public License v3.0 (or later)
9 * You may redistribute and/or modify this file under the terms of the
10 * GNU Lesser General Public License as published by the Free Software
11 * Foundation, either version 3 of the License, or (at your option)
12 * any later version.
13 *
14 * 2. Commercial license
15 * Alternatively, this file may be used under the terms of a commercial
16 * license agreement with the copyright holder
17 * (David C. Manuelda <StormByte@gmail.com>).
18 *
19 * Both licenses apply only to original StormByte-Buffer source in this
20 * repository. They do not cover other StormByte modules or any third-party
21 * material shipped with this repository (including everything under
22 * thirdparty/, and in particular the bundled StormByte-Logger tree and
23 * the rest of the StormByte suite it vendors), which remains under its own
24 * license.
25 *
26 * Neither license grants any patent rights. Any patent licenses required
27 * to use this software or third-party components must be obtained separately
28 * from the patent holders.
29 *
30 * StormByte-Buffer is distributed in the hope that it will be useful,
31 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 * GNU Lesser General Public License for more details.
34 *
35 * You should have received a copy of the GNU Lesser General Public License
36 * version 3 along with StormByte-Buffer. If not, see
37 * <https://www.gnu.org/licenses/lgpl-3.0.html>.
38 *
39 * SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-StormByte-Commercial
40 */
41
42#pragma once
43
45
46#include <chrono>
47#include <cstddef>
48
53namespace StormByte {
58 namespace Buffer {
63 namespace Backend {
68 namespace IO {
69 class BufferedReader;
70 class BufferedWriter;
71 }
72 }
73
78 namespace IO {
88 public:
92 ReadTelemetry() noexcept;
93
97 ReadTelemetry(const ReadTelemetry&) = delete;
98
103
107 virtual ~ReadTelemetry() noexcept override;
108
113 ReadTelemetry& operator=(const ReadTelemetry&) = delete;
114
119 ReadTelemetry& operator=(ReadTelemetry&&) = delete;
120
125 StormByte::ByteSize HitAhead() const noexcept;
126
131 StormByte::ByteSize HitBack() const noexcept;
132
137 StormByte::ByteSize Miss() const noexcept;
138
143 StormByte::ByteSize Origin() const noexcept;
144
149 StormByte::ByteSize Cached() const noexcept;
150
155 StormByte::ByteSize CachedPeak() const noexcept;
156
161 StormByte::ByteSize Cap() const noexcept;
162
167 std::size_t SeekLogical() const noexcept;
168
173 std::size_t SeekOrigin() const noexcept;
174
179 std::size_t SeekSavedFull() const noexcept;
180
185 std::size_t SeekSavedPartial() const noexcept;
186
191 std::size_t TryAgain() const noexcept;
192
197 std::size_t Saturated() const noexcept;
198
203 std::size_t Evicted() const noexcept;
204
209 std::chrono::nanoseconds WaitMin() const noexcept;
210
215 std::chrono::nanoseconds WaitMax() const noexcept;
216
221 std::chrono::nanoseconds WaitTotal() const noexcept;
222
227 std::size_t WaitSamples() const noexcept;
228
233 operator StormByte::String::String() const override;
234
235 protected:
236 friend class StormByte::Buffer::Backend::IO::BufferedReader;
237
238 StormByte::ByteSize m_hit_ahead;
239 StormByte::ByteSize m_hit_back;
241 StormByte::ByteSize m_origin;
242 StormByte::ByteSize m_cached;
243 StormByte::ByteSize m_cached_peak;
245 std::size_t m_seek_logical;
246 std::size_t m_seek_origin;
247 std::size_t m_seek_saved_full;
248 std::size_t m_seek_saved_partial;
249 std::size_t m_try_again;
250 std::size_t m_saturated;
251 std::size_t m_evicted;
252 std::chrono::nanoseconds m_wait_min;
253 std::chrono::nanoseconds m_wait_max;
254 std::chrono::nanoseconds m_wait_total;
255 std::size_t m_wait_samples;
256 };
257
267 public:
271 WriteTelemetry() noexcept;
272
277
282
286 virtual ~WriteTelemetry() noexcept override;
287
292 WriteTelemetry& operator=(const WriteTelemetry&) = delete;
293
298 WriteTelemetry& operator=(WriteTelemetry&&) = delete;
299
304 StormByte::ByteSize Behind() const noexcept;
305
310 StormByte::ByteSize Direct() const noexcept;
311
316 StormByte::ByteSize Origin() const noexcept;
317
322 StormByte::ByteSize Materialized() const noexcept;
323
328 StormByte::ByteSize HighWater() const noexcept;
329
334 StormByte::ByteSize HitAhead() const noexcept;
335
340 StormByte::ByteSize HitBack() const noexcept;
341
346 StormByte::ByteSize Miss() const noexcept;
347
352 StormByte::ByteSize Dirty() const noexcept;
353
358 StormByte::ByteSize DirtyPeak() const noexcept;
359
364 StormByte::ByteSize Cap() const noexcept;
365
370 std::size_t SeekLogical() const noexcept;
371
376 std::size_t SeekOrigin() const noexcept;
377
382 std::size_t SeekSavedFull() const noexcept;
383
388 std::size_t SeekSavedPartial() const noexcept;
389
394 std::size_t TryAgain() const noexcept;
395
400 std::size_t Saturated() const noexcept;
401
406 std::size_t Evicted() const noexcept;
407
412 std::chrono::nanoseconds WaitMin() const noexcept;
413
418 std::chrono::nanoseconds WaitMax() const noexcept;
419
424 std::chrono::nanoseconds WaitTotal() const noexcept;
425
430 std::size_t WaitSamples() const noexcept;
431
436 operator StormByte::String::String() const override;
437
438 protected:
439 friend class StormByte::Buffer::Backend::IO::BufferedWriter;
440
441 StormByte::ByteSize m_behind;
442 StormByte::ByteSize m_direct;
443 StormByte::ByteSize m_origin;
444 StormByte::ByteSize m_materialized;
445 StormByte::ByteSize m_high_water;
446 StormByte::ByteSize m_hit_ahead;
447 StormByte::ByteSize m_hit_back;
450 StormByte::ByteSize m_dirty_peak;
452 std::size_t m_seek_logical;
453 std::size_t m_seek_origin;
454 std::size_t m_seek_saved_full;
455 std::size_t m_seek_saved_partial;
456 std::size_t m_try_again;
457 std::size_t m_saturated;
458 std::size_t m_evicted;
459 std::chrono::nanoseconds m_wait_min;
460 std::chrono::nanoseconds m_wait_max;
461 std::chrono::nanoseconds m_wait_total;
462 std::size_t m_wait_samples;
463 };
464 }
465 }
466}
Private implementation of StormByte::Buffer::IO::BufferedReader.
Private implementation of StormByte::Buffer::IO::BufferedWriter.
Input occupancy cap for Pumper.
Definition pumper.hxx:109
Coordinated binary read source with optional prefetch and cache.
Definition buffered_reader.hxx:211
Coordinated binary write sink with optional chunked write-behind and a delayed-seek page map.
Definition buffered_writer.hxx:231
Reader counters on top of StormByte::Buffer::ReadTelemetry.
Definition telemetry.hxx:87
ReadTelemetry() noexcept
Construct all counters at 0.
Writer counters on top of StormByte::Buffer::WriteTelemetry.
Definition telemetry.hxx:266
WriteTelemetry() noexcept
Construct all counters at 0.
Basic read counters.
Definition telemetry.hxx:141
Root namespace of the StormByte C++ suite.
STL namespace.
#define STORMBYTE_BUFFER_PUBLIC
Definition visibility.h:54