13 #ifndef __PROCESS_METRICS_METRIC_HPP__ 14 #define __PROCESS_METRICS_METRIC_HPP__ 39 const std::string&
name()
const 48 if (data->history.isSome()) {
49 synchronized (data->lock) {
60 : data(new Data(name, window)) {}
64 if (data->history.isSome()) {
67 synchronized (data->lock) {
68 data->history.get()->set(value, now);
85 const std::string
name;
87 std::atomic_flag lock = ATOMIC_FLAG_INIT;
92 std::shared_ptr<Data> data;
98 #endif // __PROCESS_METRICS_METRIC_HPP__
Definition: option.hpp:29
Metric(const std::string &name, const Option< Duration > &window)
Definition: metric.hpp:59
Definition: metric.hpp:33
Option< Statistics< double > > statistics() const
Definition: metric.hpp:44
virtual Future< double > value() const =0
bool isSome() const
Definition: option.hpp:116
virtual ~Metric()
Definition: metric.hpp:35
static Option< Statistics< T > > from(const TimeSeries< T > ×eries)
Definition: statistics.hpp:43
const T & get() const &
Definition: option.hpp:119
const std::string & name() const
Definition: metric.hpp:39
Definition: executor.hpp:48
static Time now()
The current clock time for either the current process that makes this call or the global clock time i...
void push(double value)
Definition: metric.hpp:63
PID< MetricsProcess > metrics
Definition: timeseries.hpp:52
Definition: future.hpp:58