Add API to get added samples from SamplesStatsCounter

Bug: webrtc:10138
Change-Id: Idf283309b5323d1cb7484bffdf400d62c80a88d2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/133566
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27762}
This commit is contained in:
Artem Titov
2019-04-25 12:23:40 +02:00
committed by Commit Bot
parent be7a0ec2e6
commit 89eaf16701
2 changed files with 7 additions and 0 deletions

View File

@ -603,6 +603,7 @@ rtc_static_library("rtc_numerics") {
":checks",
":rtc_base_approved",
":safe_compare",
"../api:array_view",
"//third_party/abseil-cpp/absl/algorithm:container",
"//third_party/abseil-cpp/absl/types:optional",
]

View File

@ -13,6 +13,7 @@
#include <vector>
#include "api/array_view.h"
#include "rtc_base/checks.h"
#include "rtc_base/numerics/running_statistics.h"
@ -75,6 +76,11 @@ class SamplesStatsCounter {
// |percentile| has to be in [0; 1]. 0 percentile is the min in the array and
// 1 percentile is the max in the array.
double GetPercentile(double percentile);
// Returns array view with all samples added into counter. There are no
// guarantees of order, so samples can be in different order comparing to in
// which they were added into counter. Also return value will be invalidate
// after call to any non const method.
rtc::ArrayView<const double> GetSamples() const { return samples_; }
private:
RunningStatistics<double> stats_;