| 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_snapshot_manager.h" | 5 #include "base/metrics/histogram_snapshot_manager.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/debug/alias.h" | 9 #include "base/debug/alias.h" |
| 10 #include "base/metrics/histogram_flattener.h" | 10 #include "base/metrics/histogram_flattener.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 HistogramBase::Sample* ranges_ptr = &ranges_copy[0]; | 55 HistogramBase::Sample* ranges_ptr = &ranges_copy[0]; |
| 56 uint32_t ranges_checksum = ranges->checksum(); | 56 uint32_t ranges_checksum = ranges->checksum(); |
| 57 uint32_t ranges_calc_checksum = ranges->CalculateChecksum(); | 57 uint32_t ranges_calc_checksum = ranges->CalculateChecksum(); |
| 58 const char* histogram_name = histogram->histogram_name().c_str(); | 58 const char* histogram_name = histogram->histogram_name().c_str(); |
| 59 int32_t flags = histogram->flags(); | 59 int32_t flags = histogram->flags(); |
| 60 // The checksum should have caught this, so crash separately if it didn't. | 60 // The checksum should have caught this, so crash separately if it didn't. |
| 61 CHECK_NE(0U, HistogramBase::RANGE_CHECKSUM_ERROR & corruption); | 61 CHECK_NE(0U, HistogramBase::RANGE_CHECKSUM_ERROR & corruption); |
| 62 CHECK(false); // Crash for the bucket order corruption. | 62 CHECK(false); // Crash for the bucket order corruption. |
| 63 // Ensure that compiler keeps around pointers to |histogram| and its | 63 // Ensure that compiler keeps around pointers to |histogram| and its |
| 64 // internal |bucket_ranges_| for any minidumps. | 64 // internal |bucket_ranges_| for any minidumps. |
| 65 base::debug::Alias(ranges_ptr); | 65 base::debug::Alias(&ranges_ptr); |
| 66 base::debug::Alias(&ranges_checksum); | 66 base::debug::Alias(&ranges_checksum); |
| 67 base::debug::Alias(&ranges_calc_checksum); | 67 base::debug::Alias(&ranges_calc_checksum); |
| 68 base::debug::Alias(&histogram_name); | 68 base::debug::Alias(&histogram_name); |
| 69 base::debug::Alias(&flags); | 69 base::debug::Alias(&flags); |
| 70 } | 70 } |
| 71 // Checksum corruption might not have caused order corruption. | 71 // Checksum corruption might not have caused order corruption. |
| 72 CHECK_EQ(0U, HistogramBase::RANGE_CHECKSUM_ERROR & corruption); | 72 CHECK_EQ(0U, HistogramBase::RANGE_CHECKSUM_ERROR & corruption); |
| 73 | 73 |
| 74 // Note, at this point corruption can only be COUNT_HIGH_ERROR or | 74 // Note, at this point corruption can only be COUNT_HIGH_ERROR or |
| 75 // COUNT_LOW_ERROR and they never arise together, so we don't need to extract | 75 // COUNT_LOW_ERROR and they never arise together, so we don't need to extract |
| (...skipping 27 matching lines...) Expand all Loading... |
| 103 | 103 |
| 104 histogram_flattener_->InconsistencyDetectedInLoggedCount(discrepancy); | 104 histogram_flattener_->InconsistencyDetectedInLoggedCount(discrepancy); |
| 105 if (discrepancy > Histogram::kCommonRaceBasedCountMismatch) { | 105 if (discrepancy > Histogram::kCommonRaceBasedCountMismatch) { |
| 106 // Fix logged_samples. | 106 // Fix logged_samples. |
| 107 logged_samples->Subtract(*logged_samples); | 107 logged_samples->Subtract(*logged_samples); |
| 108 logged_samples->Add(new_snapshot); | 108 logged_samples->Add(new_snapshot); |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 | 111 |
| 112 } // namespace base | 112 } // namespace base |
| OLD | NEW |