GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/iojs/build/workspace/node-test-commit-linux-coverage-daily/nodes/benchmark/out/../src/histogram-inl.h Lines: 30 30 100.0 %
Date: 2019-09-23 22:30:09 Branches: 6 10 60.0 %

Line Branch Exec Source
1
#ifndef SRC_HISTOGRAM_INL_H_
2
#define SRC_HISTOGRAM_INL_H_
3
4
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
5
6
#include "histogram.h"
7
#include "node_internals.h"
8
9
namespace node {
10
11
2
inline Histogram::Histogram(int64_t lowest, int64_t highest, int figures) {
12
2
  CHECK_EQ(0, hdr_init(lowest, highest, figures, &histogram_));
13
2
}
14
15
2
inline Histogram::~Histogram() {
16
2
  hdr_close(histogram_);
17
2
}
18
19
2
inline void Histogram::Reset() {
20
2
  hdr_reset(histogram_);
21
2
}
22
23
1862
inline bool Histogram::Record(int64_t value) {
24
1862
  return hdr_record_value(histogram_, value);
25
}
26
27
2
inline int64_t Histogram::Min() {
28
2
  return hdr_min(histogram_);
29
}
30
31
2
inline int64_t Histogram::Max() {
32
2
  return hdr_max(histogram_);
33
}
34
35
2
inline double Histogram::Mean() {
36
2
  return hdr_mean(histogram_);
37
}
38
39
2
inline double Histogram::Stddev() {
40
2
  return hdr_stddev(histogram_);
41
}
42
43
991
inline double Histogram::Percentile(double percentile) {
44
991
  CHECK_GT(percentile, 0);
45
991
  CHECK_LE(percentile, 100);
46
991
  return hdr_value_at_percentile(histogram_, percentile);
47
}
48
49
2
inline void Histogram::Percentiles(std::function<void(double, double)> fn) {
50
  hdr_iter iter;
51
2
  hdr_iter_percentile_init(&iter, histogram_, 1);
52
18
  while (hdr_iter_next(&iter)) {
53
14
    double key = iter.specifics.percentiles.percentile;
54
14
    double value = iter.value;
55
14
    fn(key, value);
56
  }
57
2
}
58
59
}  // namespace node
60
61
#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
62
63
#endif  // SRC_HISTOGRAM_INL_H_