NVIDIA DeepStream SDK API Reference

9.0 Release
9.0/sources/includes/prometheus/detail/ckms_quantiles.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <array>
4 #include <cstddef>
5 #include <functional>
6 #include <vector>
7 
8 #include "prometheus/detail/core_export.h"
9 
10 // IWYU pragma: private, include "prometheus/summary.h"
11 
12 namespace prometheus {
13 namespace detail {
14 
15 class PROMETHEUS_CPP_CORE_EXPORT CKMSQuantiles {
16  public:
17  struct PROMETHEUS_CPP_CORE_EXPORT Quantile {
18  Quantile(double quantile, double error);
19 
20  double quantile;
21  double error;
22  double u;
23  double v;
24  };
25 
26  private:
27  struct Item {
28  double value;
29  int g;
30  int delta;
31 
32  Item(double value, int lower_delta, int delta);
33  };
34 
35  public:
36  explicit CKMSQuantiles(const std::vector<Quantile>& quantiles);
37 
38  void insert(double value);
39  double get(double q);
40  void reset();
41 
42  private:
43  double allowableError(int rank);
44  bool insertBatch();
45  void compress();
46 
47  private:
48  const std::reference_wrapper<const std::vector<Quantile>> quantiles_;
49 
50  std::size_t count_;
51  std::vector<Item> sample_;
52  std::array<double, 500> buffer_;
53  std::size_t buffer_count_;
54 };
55 
56 } // namespace detail
57 } // namespace prometheus
prometheus
Definition: sources/includes/prometheus/check_names.h:8
PROMETHEUS_CPP_CORE_EXPORT
#define PROMETHEUS_CPP_CORE_EXPORT
Definition: sources/includes/prometheus/detail/core_export.h:15