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

Unified Diff: base/metrics/histogram_persistence.cc

Issue 1537743006: Persist setup metrics and have Chrome report them during UMA upload. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shared-histograms
Patch Set: move AccessResult to .h and add histogram to .xml Created 4 years, 10 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
« no previous file with comments | « no previous file | base/metrics/histogram_samples.cc » ('j') | base/metrics/histogram_samples.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/histogram_persistence.cc
diff --git a/base/metrics/histogram_persistence.cc b/base/metrics/histogram_persistence.cc
index 535d11409276ea117357676c64061ca7c3eb3f7b..75df2860ed8d639d7eb56950fe09af7d6d95a576 100644
--- a/base/metrics/histogram_persistence.cc
+++ b/base/metrics/histogram_persistence.cc
@@ -53,6 +53,9 @@ enum CreateHistogramResultType {
CREATE_HISTOGRAM_MAX
};
+// Name of histogram for storing results of local operations.
+const char kResultHistogram[] = "UMA.CreatePersistentHistogram.Result";
+
// Type identifiers used when storing in persistent memory so they can be
// identified during extraction; the first 4 bytes of the SHA1 of the name
// is used as a unique integer. A "version number" is added to the base
@@ -159,8 +162,7 @@ HistogramBase* GetCreateHistogramResultHistogram() {
}
histogram_pointer = LinearHistogram::FactoryGet(
- "UMA.CreatePersistentHistogram.Result",
- 1, CREATE_HISTOGRAM_MAX, CREATE_HISTOGRAM_MAX + 1,
+ kResultHistogram, 1, CREATE_HISTOGRAM_MAX, CREATE_HISTOGRAM_MAX + 1,
HistogramBase::kUmaTargetedHistogramFlag);
base::subtle::Release_Store(
&atomic_histogram_pointer,
@@ -210,6 +212,10 @@ ReleasePersistentHistogramMemoryAllocatorForTesting() {
ref, kTypeIdHistogram);
DCHECK(histogram_data);
StatisticsRecorder::ForgetHistogramForTesting(histogram_data->name);
+
+ // Fix by calling GetCreateHistogramResultHistogram() before setting
Alexei Svitkine (slow) 2016/02/19 16:57:00 I don't understand this comment. Is it meant to be
bcwhite 2016/02/19 19:50:14 Done.
+ // the (temporary) persistent memory allocator.
+ DCHECK_NE(kResultHistogram, histogram_data->name);
}
}
@@ -480,7 +486,7 @@ HistogramBase* AllocatePersistentHistogram(
void ImportPersistentHistograms() {
// The lock protects against concurrent access to the iterator and is created
// in a thread-safe manner when needed.
- static base::LazyInstance<base::Lock> lock = LAZY_INSTANCE_INITIALIZER;
+ static base::LazyInstance<base::Lock>::Leaky lock = LAZY_INSTANCE_INITIALIZER;
if (g_allocator) {
base::AutoLock auto_lock(lock.Get());
@@ -492,7 +498,7 @@ void ImportPersistentHistograms() {
if (iter.is_clear())
g_allocator->CreateIterator(&iter);
- for (;;) {
+ while (true) {
HistogramBase* histogram = GetNextPersistentHistogram(g_allocator, &iter);
if (!histogram)
break;
« no previous file with comments | « no previous file | base/metrics/histogram_samples.cc » ('j') | base/metrics/histogram_samples.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698