32 // the magnitude of the value being stored, and the second array maintains
33 // the low resolution histogram within that magnitude. For example, storing
34 // 4.352819 * 10^3 increments the bucket _hdr[3][435]. This allows for
35 // memory efficient storage of huge amount of samples.
36 //
37 // Accepts positive numbers only.
38 class HdrSeq: public NumberSeq {
39 private:
40 enum PrivateConstants {
41 ValBuckets = 512,
42 MagBuckets = 24,
43 MagMinimum = -12
44 };
45 int** _hdr;
46
47 public:
48 HdrSeq();
49 ~HdrSeq();
50
51 virtual void add(double val);
52 double percentile(double level) const;
53 };
54
55 // Binary magnitude sequence stores the power-of-two histogram.
56 // It has very low memory requirements, and is thread-safe. When accuracy
57 // is not needed, it is preferred over HdrSeq.
58 class BinaryMagnitudeSeq : public CHeapObj<mtGC> {
59 private:
60 size_t _sum;
61 size_t* _mags;
62
63 public:
64 BinaryMagnitudeSeq();
65 ~BinaryMagnitudeSeq();
66
67 void add(size_t val);
68 size_t num() const;
69 size_t level(int level) const;
70 size_t sum() const;
71 int min_level() const;
72 int max_level() const;
|
32 // the magnitude of the value being stored, and the second array maintains
33 // the low resolution histogram within that magnitude. For example, storing
34 // 4.352819 * 10^3 increments the bucket _hdr[3][435]. This allows for
35 // memory efficient storage of huge amount of samples.
36 //
37 // Accepts positive numbers only.
38 class HdrSeq: public NumberSeq {
39 private:
40 enum PrivateConstants {
41 ValBuckets = 512,
42 MagBuckets = 24,
43 MagMinimum = -12
44 };
45 int** _hdr;
46
47 public:
48 HdrSeq();
49 ~HdrSeq();
50
51 virtual void add(double val);
52 void add(const HdrSeq& other);
53 double percentile(double level) const;
54 void clear();
55 };
56
57 // Binary magnitude sequence stores the power-of-two histogram.
58 // It has very low memory requirements, and is thread-safe. When accuracy
59 // is not needed, it is preferred over HdrSeq.
60 class BinaryMagnitudeSeq : public CHeapObj<mtGC> {
61 private:
62 size_t _sum;
63 size_t* _mags;
64
65 public:
66 BinaryMagnitudeSeq();
67 ~BinaryMagnitudeSeq();
68
69 void add(size_t val);
70 size_t num() const;
71 size_t level(int level) const;
72 size_t sum() const;
73 int min_level() const;
74 int max_level() const;
|