summaryrefslogtreecommitdiff
path: root/chromium/base/metrics/histogram_base.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-12 14:27:29 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-13 09:35:20 +0000
commitc30a6232df03e1efbd9f3b226777b07e087a1122 (patch)
treee992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/base/metrics/histogram_base.cc
parent7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff)
downloadqtwebengine-chromium-c30a6232df03e1efbd9f3b226777b07e087a1122.tar.gz
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/base/metrics/histogram_base.cc')
-rw-r--r--chromium/base/metrics/histogram_base.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/chromium/base/metrics/histogram_base.cc b/chromium/base/metrics/histogram_base.cc
index 8d55e92e1dd..ce7fbf16e38 100644
--- a/chromium/base/metrics/histogram_base.cc
+++ b/chromium/base/metrics/histogram_base.cc
@@ -179,6 +179,30 @@ void HistogramBase::FindAndRunCallback(HistogramBase::Sample sample) const {
cb.Run(sample);
}
+void HistogramBase::GetCountAndBucketData(Count* count,
+ int64_t* sum,
+ ListValue* buckets) const {
+ std::unique_ptr<HistogramSamples> snapshot = SnapshotSamples();
+ *count = snapshot->TotalCount();
+ *sum = snapshot->sum();
+ std::unique_ptr<SampleCountIterator> it = snapshot->Iterator();
+ uint32_t index = 0;
+ while (!it->Done()) {
+ std::unique_ptr<DictionaryValue> bucket_value(new DictionaryValue());
+ Sample bucket_min;
+ int64_t bucket_max;
+ Count bucket_count;
+ it->Get(&bucket_min, &bucket_max, &bucket_count);
+
+ bucket_value->SetIntKey("low", bucket_min);
+ bucket_value->SetIntKey("high", bucket_max);
+ bucket_value->SetIntKey("count", bucket_count);
+ buckets->Set(index, std::move(bucket_value));
+ it->Next();
+ ++index;
+ }
+}
+
void HistogramBase::WriteAsciiBucketGraph(double current_size,
double max_size,
std::string* output) const {