License
BSD-3-Clause
Historical Data and Time Series
This module provides built-in time-series data collection for trend analysis.
Features:
Platform Availability:
Time-stamped metric entry.
Stores a single metric value with its timestamp.
T | The type of the metric value. |
Trend direction for time-series data.
Time-series data collector with efficient storage and statistical analysis.
This class collects time-stamped metric values and provides windowed aggregations and statistical functions for trend analysis.
T | The type of the metric value (e.g., double, ulong). Example: |
void record(T value, SysTime timestamp = Clock.currTime())Records a metric value with an optional timestamp.T latest()Gets the most recently recorded value.T percentile(Duration window, double p)Gets the percentile value within a time window.size_t length()Returns the number of data points currently stored.void clear()Clears all stored data.Automatic metric collection manager.
This class starts a background thread that periodically collects various system metrics and stores them in MetricCollector instances.
Example:
auto autoCollector = new AutoCollector(2.seconds);
autoCollector.start();
// Let it collect for a while
Thread.sleep(10.seconds);
// Get collected data
auto cpuCollector = autoCollector.cpu();
double avgCpu = cpuCollector.average(5.seconds);
autoCollector.stop();private MetricCollector!double cpuCollectorprivate MetricCollector!ulong memoryCollectorprivate Duration intervalprivate Thread workerprivate Mutex mutexprivate Condition conditionprivate bool runningvoid start()Starts automatic metric collection.void stop()Stops automatic metric collection.MetricCollector!double cpu()Gets the CPU metric collector.MetricCollector!ulong memory()Gets the memory metric collector.void clear()Clears all collected data.~thisCleanup on destruction.Trend detectTrend(T)(MetricCollector!T collector, Duration window)Detects the trend in a metric collector over a time window.