blob: afcc895fd3917cb4299bd89399c58f7f9bd2c531 (
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
#pragma once
#include <util/generic/ptr.h>
namespace NMonitoring {
class ISummaryDoubleSnapshot: public TAtomicRefCount<ISummaryDoubleSnapshot> {
public:
virtual ~ISummaryDoubleSnapshot() = default;
// TODO: write documentation
virtual ui64 GetCount() const = 0;
virtual double GetSum() const = 0;
virtual double GetMin() const = 0;
virtual double GetMax() const = 0;
virtual double GetLast() const = 0;
virtual ui64 MemorySizeBytes() const = 0;
};
using ISummaryDoubleSnapshotPtr = TIntrusivePtr<ISummaryDoubleSnapshot>;
class TSummaryDoubleSnapshot final: public ISummaryDoubleSnapshot {
public:
TSummaryDoubleSnapshot(double sum, double min, double max, double last, ui64 count)
: Sum_(sum)
, Min_(min)
, Max_(max)
, Last_(last)
, Count_(count)
{}
ui64 GetCount() const noexcept override {
return Count_;
}
double GetSum() const noexcept override {
return Sum_;
}
double GetMin() const noexcept override {
return Min_;
}
double GetMax() const noexcept override {
return Max_;
}
virtual double GetLast() const noexcept override {
return Last_;
}
ui64 MemorySizeBytes() const noexcept override {
return sizeof(*this);
}
private:
double Sum_;
double Min_;
double Max_;
double Last_;
ui64 Count_;
};
}
std::ostream& operator<<(std::ostream& os, const NMonitoring::ISummaryDoubleSnapshot& s);
|