| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |