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

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

Issue 1002103004: NOT FOR REVIEW - Slow Reports Reference Implementation Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: JSON serialization. Created 5 years, 7 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
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 <climits> 7 #include <climits>
8 8
9 #include "base/json/json_string_value_serializer.h" 9 #include "base/json/json_string_value_serializer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 79 }
80 80
81 void HistogramBase::AddTime(const TimeDelta& time) { 81 void HistogramBase::AddTime(const TimeDelta& time) {
82 Add(static_cast<Sample>(time.InMilliseconds())); 82 Add(static_cast<Sample>(time.InMilliseconds()));
83 } 83 }
84 84
85 void HistogramBase::AddBoolean(bool value) { 85 void HistogramBase::AddBoolean(bool value) {
86 Add(value ? 1 : 0); 86 Add(value ? 1 : 0);
87 } 87 }
88 88
89 void HistogramBase::SetCallback(const HistogramBase::ModifiedCallback& cb) {
90 callback_ = cb;
91 }
92
89 bool HistogramBase::SerializeInfo(Pickle* pickle) const { 93 bool HistogramBase::SerializeInfo(Pickle* pickle) const {
90 if (!pickle->WriteInt(GetHistogramType())) 94 if (!pickle->WriteInt(GetHistogramType()))
91 return false; 95 return false;
92 return SerializeInfoImpl(pickle); 96 return SerializeInfoImpl(pickle);
93 } 97 }
94 98
95 int HistogramBase::FindCorruption(const HistogramSamples& samples) const { 99 int HistogramBase::FindCorruption(const HistogramSamples& samples) const {
96 // Not supported by default. 100 // Not supported by default.
97 return NO_INCONSISTENCIES; 101 return NO_INCONSISTENCIES;
98 } 102 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 return result; 146 return result;
143 } 147 }
144 148
145 void HistogramBase::WriteAsciiBucketValue(Count current, 149 void HistogramBase::WriteAsciiBucketValue(Count current,
146 double scaled_sum, 150 double scaled_sum,
147 std::string* output) const { 151 std::string* output) const {
148 StringAppendF(output, " (%d = %3.1f%%)", current, current/scaled_sum); 152 StringAppendF(output, " (%d = %3.1f%%)", current, current/scaled_sum);
149 } 153 }
150 154
151 } // namespace base 155 } // namespace base
OLDNEW
« no previous file with comments | « base/metrics/histogram_base.h ('k') | chrome/browser/performance_monitor/performance_monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698