forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhistogram.h
38 lines (28 loc) · 832 Bytes
/
histogram.h
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
#ifndef SRC_HISTOGRAM_H_
#define SRC_HISTOGRAM_H_
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#include "hdr_histogram.h"
#include <functional>
#include <map>
namespace node {
class Histogram {
public:
inline Histogram(int64_t lowest, int64_t highest, int figures = 3);
inline virtual ~Histogram();
inline bool Record(int64_t value);
inline void Reset();
inline int64_t Min();
inline int64_t Max();
inline double Mean();
inline double Stddev();
inline double Percentile(double percentile);
inline void Percentiles(std::function<void(double, double)> fn);
size_t GetMemorySize() const {
return hdr_get_memory_size(histogram_);
}
private:
hdr_histogram* histogram_;
};
} // namespace node
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#endif // SRC_HISTOGRAM_H_