1 |
|
|
#ifndef SRC_HISTOGRAM_H_ |
2 |
|
|
#define SRC_HISTOGRAM_H_ |
3 |
|
|
|
4 |
|
|
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS |
5 |
|
|
|
6 |
|
|
#include "hdr_histogram.h" |
7 |
|
|
#include <functional> |
8 |
|
|
#include <map> |
9 |
|
|
|
10 |
|
|
namespace node { |
11 |
|
|
|
12 |
|
|
class Histogram { |
13 |
|
|
public: |
14 |
|
|
inline Histogram(int64_t lowest, int64_t highest, int figures = 3); |
15 |
|
|
inline virtual ~Histogram(); |
16 |
|
|
|
17 |
|
|
inline bool Record(int64_t value); |
18 |
|
|
inline void Reset(); |
19 |
|
|
inline int64_t Min(); |
20 |
|
|
inline int64_t Max(); |
21 |
|
|
inline double Mean(); |
22 |
|
|
inline double Stddev(); |
23 |
|
|
inline double Percentile(double percentile); |
24 |
|
|
inline void Percentiles(std::function<void(double, double)> fn); |
25 |
|
|
|
26 |
|
|
size_t GetMemorySize() const { |
27 |
|
|
return hdr_get_memory_size(histogram_); |
28 |
|
|
} |
29 |
|
|
|
30 |
|
|
private: |
31 |
|
|
hdr_histogram* histogram_; |
32 |
|
|
}; |
33 |
|
|
|
34 |
|
|
} // namespace node |
35 |
|
|
|
36 |
|
|
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS |
37 |
|
|
|
38 |
|
|
#endif // SRC_HISTOGRAM_H_ |