Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(356)

Unified Diff: third_party/WebKit/Source/platform/Histogram.cpp

Issue 2137483003: Add UMA metrics for root scroller intervention to track forcing passive breakage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add ability to test histograms from layout tests Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/Histogram.cpp
diff --git a/third_party/WebKit/Source/platform/Histogram.cpp b/third_party/WebKit/Source/platform/Histogram.cpp
index cdda2dca45740c1d8e3b94f111baa2a32ed9f269..549d53beaceb61b8b16fe1c6c26c8d791988f448 100644
--- a/third_party/WebKit/Source/platform/Histogram.cpp
+++ b/third_party/WebKit/Source/platform/Histogram.cpp
@@ -6,6 +6,7 @@
#include "base/metrics/histogram.h"
#include "base/metrics/sparse_histogram.h"
+#include "base/metrics/statistics_recorder.h"
namespace blink {
@@ -34,6 +35,19 @@ EnumerationHistogram::EnumerationHistogram(const char* name, base::HistogramBase
{
}
+bool EnumerationHistogram::GetHistogramCount(const char* name, base::HistogramBase::Sample bucket, int32_t* count)
Rick Byers 2016/07/11 14:41:52 Probably want someone from uma-team to take a look
dtapuska 2016/07/11 15:46:05 isherman@ can you comment on this? (It is pretty m
Ilya Sherman 2016/07/11 18:52:31 Yeah, the HistogramTester class [1] is what's used
+{
+ base::HistogramBase* histogram = base::StatisticsRecorder::FindHistogram(name);
+ if (!histogram)
+ return false;
+
+ std::unique_ptr<base::HistogramSamples> samples(
+ histogram->SnapshotSamples());
+
+ *count = samples->GetCount(bucket);
+ return true;
+}
+
SparseHistogram::SparseHistogram(const char* name)
{
m_histogram = base::SparseHistogram::FactoryGet(name, base::HistogramBase::kUmaTargetedHistogramFlag);

Powered by Google App Engine
This is Rietveld 408576698