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

Side by Side Diff: base/metrics/histogram_base.cc

Issue 2616613004: Warn about but ignore multiple attempts to create activity-report histogram. (Closed)
Patch Set: rebased Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/metrics/histogram_base.h" 5 #include "base/metrics/histogram_base.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 root.SetInteger("flags", flags()); 118 root.SetInteger("flags", flags());
119 root.Set("params", std::move(parameters)); 119 root.Set("params", std::move(parameters));
120 root.Set("buckets", std::move(buckets)); 120 root.Set("buckets", std::move(buckets));
121 root.SetInteger("pid", GetUniqueIdForProcess()); 121 root.SetInteger("pid", GetUniqueIdForProcess());
122 serializer.Serialize(root); 122 serializer.Serialize(root);
123 } 123 }
124 124
125 // static 125 // static
126 void HistogramBase::EnableActivityReportHistogram( 126 void HistogramBase::EnableActivityReportHistogram(
127 const std::string& process_type) { 127 const std::string& process_type) {
128 DCHECK(!report_histogram_); 128 if (report_histogram_)
129 return;
130
129 size_t existing = StatisticsRecorder::GetHistogramCount(); 131 size_t existing = StatisticsRecorder::GetHistogramCount();
130 if (existing != 0) { 132 if (existing != 0) {
131 DVLOG(1) << existing 133 DVLOG(1) << existing
132 << " histograms were created before reporting was enabled."; 134 << " histograms were created before reporting was enabled.";
133 } 135 }
134 136
135 std::string name = 137 std::string name =
136 "UMA.Histograms.Activity" + 138 "UMA.Histograms.Activity" +
137 (process_type.empty() ? process_type : "." + process_type); 139 (process_type.empty() ? process_type : "." + process_type);
138 140
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 report_histogram_->Add(HISTOGRAM_REPORT_FLAG_UMA_TARGETED); 221 report_histogram_->Add(HISTOGRAM_REPORT_FLAG_UMA_TARGETED);
220 break; 222 break;
221 223
222 case HISTOGRAM_LOOKUP: 224 case HISTOGRAM_LOOKUP:
223 report_histogram_->Add(HISTOGRAM_REPORT_HISTOGRAM_LOOKUP); 225 report_histogram_->Add(HISTOGRAM_REPORT_HISTOGRAM_LOOKUP);
224 break; 226 break;
225 } 227 }
226 } 228 }
227 229
228 } // namespace base 230 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698