| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/persistent_sample_map.h" | 5 #include "base/metrics/persistent_sample_map.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/metrics/persistent_histogram_allocator.h" | 10 #include "base/metrics/persistent_histogram_allocator.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 reason = PERSISTENT_SPARSE_ACCUMULATE_WENT_NEGATIVE; | 132 reason = PERSISTENT_SPARSE_ACCUMULATE_WENT_NEGATIVE; |
| 133 *local_count_ptr += count; | 133 *local_count_ptr += count; |
| 134 } else { | 134 } else { |
| 135 *local_count_ptr += count; | 135 *local_count_ptr += count; |
| 136 if (*local_count_ptr < 0) | 136 if (*local_count_ptr < 0) |
| 137 reason = PERSISTENT_SPARSE_ACCUMULATE_OVERFLOW; | 137 reason = PERSISTENT_SPARSE_ACCUMULATE_OVERFLOW; |
| 138 } | 138 } |
| 139 if (reason != MAX_NEGATIVE_SAMPLE_REASONS) { | 139 if (reason != MAX_NEGATIVE_SAMPLE_REASONS) { |
| 140 UMA_HISTOGRAM_ENUMERATION("UMA.NegativeSamples.Reason", reason, | 140 UMA_HISTOGRAM_ENUMERATION("UMA.NegativeSamples.Reason", reason, |
| 141 MAX_NEGATIVE_SAMPLE_REASONS); | 141 MAX_NEGATIVE_SAMPLE_REASONS); |
| 142 UMA_HISTOGRAM_CUSTOM_COUNTS("UMA.NegativeSamples.Increment", count, 1, |
| 143 1 << 30, 100); |
| 144 UMA_HISTOGRAM_SPARSE_SLOWLY("UMA.NegativeSamples.Histogram", |
| 145 static_cast<int32_t>(id())); |
| 142 } | 146 } |
| 143 #endif | 147 #endif |
| 144 IncreaseSumAndCount(strict_cast<int64_t>(count) * value, count); | 148 IncreaseSumAndCount(strict_cast<int64_t>(count) * value, count); |
| 145 } | 149 } |
| 146 | 150 |
| 147 Count PersistentSampleMap::GetCount(Sample value) const { | 151 Count PersistentSampleMap::GetCount(Sample value) const { |
| 148 // Have to override "const" to make sure all samples have been loaded before | 152 // Have to override "const" to make sure all samples have been loaded before |
| 149 // being able to know what value to return. | 153 // being able to know what value to return. |
| 150 Count* count_pointer = | 154 Count* count_pointer = |
| 151 const_cast<PersistentSampleMap*>(this)->GetSampleCountStorage(value); | 155 const_cast<PersistentSampleMap*>(this)->GetSampleCountStorage(value); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 found_count = &record->count; | 314 found_count = &record->count; |
| 311 if (!import_everything) | 315 if (!import_everything) |
| 312 break; | 316 break; |
| 313 } | 317 } |
| 314 } | 318 } |
| 315 | 319 |
| 316 return found_count; | 320 return found_count; |
| 317 } | 321 } |
| 318 | 322 |
| 319 } // namespace base | 323 } // namespace base |
| OLD | NEW |