blob: 6c7e42da193f8cb3f23bf3d265d0c0e2afd4db85 (
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
27
28
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "counter_aggregator.h"
#include <assert.h>
#include <map>
namespace vespalib {
namespace metrics {
CounterAggregator::CounterAggregator(MetricIdentifier id)
: idx(id), count(0)
{}
void
CounterAggregator::merge(const Counter::Increment &increment)
{
assert(idx == increment.idx);
count += increment.value;
}
void
CounterAggregator::merge(const CounterAggregator &other)
{
assert(idx == other.idx);
count += other.count;
}
} // namespace vespalib::metrics
} // namespace vespalib
|