Commit c9e8eb42 authored by Joseph Hwang's avatar Joseph Hwang Committed by Facebook GitHub Bot

Support arbitrary timepoint granularity QuantileEstimations

Summary: This change should not make a functional difference to any existing callers. The underlying data structure stores a TimePoint.

Reviewed By: yfeldblum

Differential Revision: D34060591

fbshipit-source-id: b2b4d7f0d7fed8220cffb6b1dba5082d21073686
parent 9ee77a54
...@@ -42,7 +42,7 @@ void SimpleQuantileEstimator<ClockT>::addValue(double value, TimePoint now) { ...@@ -42,7 +42,7 @@ void SimpleQuantileEstimator<ClockT>::addValue(double value, TimePoint now) {
template <typename ClockT> template <typename ClockT>
SlidingWindowQuantileEstimator<ClockT>::SlidingWindowQuantileEstimator( SlidingWindowQuantileEstimator<ClockT>::SlidingWindowQuantileEstimator(
std::chrono::seconds windowDuration, size_t nWindows) Duration windowDuration, size_t nWindows)
: bufferedSlidingWindow_(nWindows, windowDuration, 1000, 100) {} : bufferedSlidingWindow_(nWindows, windowDuration, 1000, 100) {}
template <typename ClockT> template <typename ClockT>
......
...@@ -65,9 +65,9 @@ template <typename ClockT = std::chrono::steady_clock> ...@@ -65,9 +65,9 @@ template <typename ClockT = std::chrono::steady_clock>
class SlidingWindowQuantileEstimator { class SlidingWindowQuantileEstimator {
public: public:
using TimePoint = typename ClockT::time_point; using TimePoint = typename ClockT::time_point;
using Duration = typename ClockT::duration;
SlidingWindowQuantileEstimator( SlidingWindowQuantileEstimator(Duration windowDuration, size_t nWindows = 60);
std::chrono::seconds windowDuration, size_t nWindows = 60);
QuantileEstimates estimateQuantiles( QuantileEstimates estimateQuantiles(
Range<const double*> quantiles, TimePoint now = ClockT::now()); Range<const double*> quantiles, TimePoint now = ClockT::now());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment