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