| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 return BooleanHistogram::DeserializeInfoImpl(iter); | 51 return BooleanHistogram::DeserializeInfoImpl(iter); |
| 52 case CUSTOM_HISTOGRAM: | 52 case CUSTOM_HISTOGRAM: |
| 53 return CustomHistogram::DeserializeInfoImpl(iter); | 53 return CustomHistogram::DeserializeInfoImpl(iter); |
| 54 case SPARSE_HISTOGRAM: | 54 case SPARSE_HISTOGRAM: |
| 55 return SparseHistogram::DeserializeInfoImpl(iter); | 55 return SparseHistogram::DeserializeInfoImpl(iter); |
| 56 default: | 56 default: |
| 57 return NULL; | 57 return NULL; |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 void DeserializeHistogramAndAddSamples(PickleIterator* iter) { | |
| 62 HistogramBase* histogram = DeserializeHistogramInfo(iter); | |
| 63 if (!histogram) | |
| 64 return; | |
| 65 | |
| 66 if (histogram->flags() & base::HistogramBase::kIPCSerializationSourceFlag) { | |
| 67 DVLOG(1) << "Single process mode, histogram observed and not copied: " | |
| 68 << histogram->histogram_name(); | |
| 69 return; | |
| 70 } | |
| 71 histogram->AddSamplesFromPickle(iter); | |
| 72 } | |
| 73 | |
| 74 | |
| 75 const HistogramBase::Sample HistogramBase::kSampleType_MAX = INT_MAX; | 61 const HistogramBase::Sample HistogramBase::kSampleType_MAX = INT_MAX; |
| 76 | 62 |
| 77 HistogramBase::HistogramBase(const std::string& name) | 63 HistogramBase::HistogramBase(const std::string& name) |
| 78 : histogram_name_(name), | 64 : histogram_name_(name), |
| 79 flags_(kNoFlags) {} | 65 flags_(kNoFlags) {} |
| 80 | 66 |
| 81 HistogramBase::~HistogramBase() {} | 67 HistogramBase::~HistogramBase() {} |
| 82 | 68 |
| 83 void HistogramBase::SetFlags(int32 flags) { | 69 void HistogramBase::SetFlags(int32 flags) { |
| 84 flags_ |= flags; | 70 flags_ |= flags; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 return result; | 138 return result; |
| 153 } | 139 } |
| 154 | 140 |
| 155 void HistogramBase::WriteAsciiBucketValue(Count current, | 141 void HistogramBase::WriteAsciiBucketValue(Count current, |
| 156 double scaled_sum, | 142 double scaled_sum, |
| 157 std::string* output) const { | 143 std::string* output) const { |
| 158 StringAppendF(output, " (%d = %3.1f%%)", current, current/scaled_sum); | 144 StringAppendF(output, " (%d = %3.1f%%)", current, current/scaled_sum); |
| 159 } | 145 } |
| 160 | 146 |
| 161 } // namespace base | 147 } // namespace base |
| OLD | NEW |