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

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

Issue 1485763002: Merge multiple histogram snapshots into single one for reporting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shared-histograms
Patch Set: addressed remaining review comments by Alexei 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 unified diff | Download patch
« no previous file with comments | « base/metrics/histogram_base.h ('k') | base/metrics/histogram_persistence.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 <utility> 9 #include <utility>
10 10
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 void HistogramBase::AddBoolean(bool value) { 90 void HistogramBase::AddBoolean(bool value) {
91 Add(value ? 1 : 0); 91 Add(value ? 1 : 0);
92 } 92 }
93 93
94 bool HistogramBase::SerializeInfo(Pickle* pickle) const { 94 bool HistogramBase::SerializeInfo(Pickle* pickle) const {
95 if (!pickle->WriteInt(GetHistogramType())) 95 if (!pickle->WriteInt(GetHistogramType()))
96 return false; 96 return false;
97 return SerializeInfoImpl(pickle); 97 return SerializeInfoImpl(pickle);
98 } 98 }
99 99
100 int HistogramBase::FindCorruption(const HistogramSamples& samples) const { 100 uint32_t HistogramBase::FindCorruption(const HistogramSamples& samples) const {
101 // Not supported by default. 101 // Not supported by default.
102 return NO_INCONSISTENCIES; 102 return NO_INCONSISTENCIES;
103 } 103 }
104 104
105 void HistogramBase::WriteJSON(std::string* output) const { 105 void HistogramBase::WriteJSON(std::string* output) const {
106 Count count; 106 Count count;
107 int64_t sum; 107 int64_t sum;
108 scoped_ptr<ListValue> buckets(new ListValue()); 108 scoped_ptr<ListValue> buckets(new ListValue());
109 GetCountAndBucketData(&count, &sum, buckets.get()); 109 GetCountAndBucketData(&count, &sum, buckets.get());
110 scoped_ptr<DictionaryValue> parameters(new DictionaryValue()); 110 scoped_ptr<DictionaryValue> parameters(new DictionaryValue());
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 return result; 157 return result;
158 } 158 }
159 159
160 void HistogramBase::WriteAsciiBucketValue(Count current, 160 void HistogramBase::WriteAsciiBucketValue(Count current,
161 double scaled_sum, 161 double scaled_sum,
162 std::string* output) const { 162 std::string* output) const {
163 StringAppendF(output, " (%d = %3.1f%%)", current, current/scaled_sum); 163 StringAppendF(output, " (%d = %3.1f%%)", current, current/scaled_sum);
164 } 164 }
165 165
166 } // namespace base 166 } // namespace base
OLDNEW
« no previous file with comments | « base/metrics/histogram_base.h ('k') | base/metrics/histogram_persistence.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698