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

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

Issue 2382503002: Cleanup histograms from message loop, as well as kHexRangePrintingFlag. (Closed)
Patch Set: make flag comment nicer Created 4 years, 2 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 | « base/metrics/histogram_base.h ('k') | base/metrics/sparse_histogram.cc » ('j') | 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 while (0 < x_count--) 167 while (0 < x_count--)
168 output->append("-"); 168 output->append("-");
169 output->append("O"); 169 output->append("O");
170 while (0 < x_remainder--) 170 while (0 < x_remainder--)
171 output->append(" "); 171 output->append(" ");
172 } 172 }
173 173
174 const std::string HistogramBase::GetSimpleAsciiBucketRange( 174 const std::string HistogramBase::GetSimpleAsciiBucketRange(
175 Sample sample) const { 175 Sample sample) const {
176 std::string result; 176 return StringPrintf("%d", sample);
177 if (kHexRangePrintingFlag & flags())
178 StringAppendF(&result, "%#x", sample);
179 else
180 StringAppendF(&result, "%d", sample);
181 return result;
182 } 177 }
183 178
184 void HistogramBase::WriteAsciiBucketValue(Count current, 179 void HistogramBase::WriteAsciiBucketValue(Count current,
185 double scaled_sum, 180 double scaled_sum,
186 std::string* output) const { 181 std::string* output) const {
187 StringAppendF(output, " (%d = %3.1f%%)", current, current/scaled_sum); 182 StringAppendF(output, " (%d = %3.1f%%)", current, current/scaled_sum);
188 } 183 }
189 184
190 // static 185 // static
191 void HistogramBase::ReportHistogramActivity(const HistogramBase& histogram, 186 void HistogramBase::ReportHistogramActivity(const HistogramBase& histogram,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 report_histogram_->Add(HISTOGRAM_REPORT_FLAG_UMA_TARGETED); 219 report_histogram_->Add(HISTOGRAM_REPORT_FLAG_UMA_TARGETED);
225 break; 220 break;
226 221
227 case HISTOGRAM_LOOKUP: 222 case HISTOGRAM_LOOKUP:
228 report_histogram_->Add(HISTOGRAM_REPORT_HISTOGRAM_LOOKUP); 223 report_histogram_->Add(HISTOGRAM_REPORT_HISTOGRAM_LOOKUP);
229 break; 224 break;
230 } 225 }
231 } 226 }
232 227
233 } // namespace base 228 } // namespace base
OLDNEW
« no previous file with comments | « base/metrics/histogram_base.h ('k') | base/metrics/sparse_histogram.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698