aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/metrics/current_samples.h
blob: 4056a4bb6aa73e24964fe1f36173fe4b5b2ad3fd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <mutex>
#include "stable_store.h"
#include "counter.h"
#include "gauge.h"

namespace vespalib {
namespace metrics {

// internal
struct CurrentSamples {
    std::mutex lock;
    StableStore<Counter::Increment> counterIncrements;
    StableStore<Gauge::Measurement> gaugeMeasurements;

    ~CurrentSamples() {}

    void add(Counter::Increment inc);
    void sample(Gauge::Measurement value);
    void extract(CurrentSamples &into);
};

} // namespace vespalib::metrics
} // namespace vespalib