20 lines
450 B
C++
20 lines
450 B
C++
#pragma once
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <deque>
|
|
|
|
typedef struct {
|
|
uint64_t tstart, tend, interval;
|
|
std::deque<float> data;
|
|
const char *unit;
|
|
const char *format;
|
|
} timeseries_t;
|
|
|
|
void timeseries_init(timeseries_t *ts, uint64_t tstart, uint64_t interval, const char *unit, const char *format);
|
|
|
|
void timeseries_append(timeseries_t *ts, float value);
|
|
|
|
// remove oldest values
|
|
void timeseries_prune(timeseries_t *ts, float duration);
|