13 #ifndef __PROCESS_METRICS_TIMER_HPP__ 14 #define __PROCESS_METRICS_TIMER_HPP__ 42 :
Metric(name +
"_" + T::units(), window),
49 synchronized (data->lock) {
50 if (data->lastValue.isSome()) {
51 value = data->lastValue.get();
63 synchronized (data->lock) {
77 synchronized (data->lock) {
78 t = T(stop - data->start);
80 data->lastValue = t.value();
82 value = data->lastValue.get();
105 std::atomic_flag lock = ATOMIC_FLAG_INIT;
116 synchronized (that.data->lock) {
117 that.data->lastValue = T(stop - start).value();
118 value = that.data->lastValue.get();
124 std::shared_ptr<Data> data;
130 #endif // __PROCESS_METRICS_TIMER_HPP__
void start()
Definition: timer.hpp:61
Definition: future.hpp:668
Definition: metric.hpp:33
T stop()
Definition: timer.hpp:69
Future< U > time(const Future< U > &future)
Definition: timer.hpp:92
const Future< T > & onAny(AnyCallback &&callback) const
Definition: future.hpp:1442
Timer(const std::string &name, const Option< Duration > &window=None())
Definition: timer.hpp:41
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
Try< Nothing > bind(int_fd s, const Address &address)
Definition: network.hpp:46
PID< MetricsProcess > metrics
Future< double > value() const override
Definition: timer.hpp:45
Definition: future.hpp:58