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 "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/debug/alias.h" | 8 #include "base/debug/alias.h" |
9 #include "base/metrics/statistics_recorder.h" | 9 #include "base/metrics/statistics_recorder.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 already_logged->Resize(histogram.bucket_count()); | 89 already_logged->Resize(histogram.bucket_count()); |
90 } else { | 90 } else { |
91 already_logged = &(it->second); | 91 already_logged = &(it->second); |
92 int64 discrepancy(already_logged->TotalCount() - | 92 int64 discrepancy(already_logged->TotalCount() - |
93 already_logged->redundant_count()); | 93 already_logged->redundant_count()); |
94 if (discrepancy) { | 94 if (discrepancy) { |
95 NOTREACHED(); // Already_logged has become corrupt. | 95 NOTREACHED(); // Already_logged has become corrupt. |
96 int problem = static_cast<int>(discrepancy); | 96 int problem = static_cast<int>(discrepancy); |
97 if (problem != discrepancy) | 97 if (problem != discrepancy) |
98 problem = INT_MAX; | 98 problem = INT_MAX; |
99 histogram_flattener_->SnapshotProblemResolved(problem); | 99 histogram_flattener_->InconsistencyDetectedInLoggedCount(problem); |
100 // With no valid baseline, we'll act like we've recorded everything in our | 100 // With no valid baseline, we'll act like we've recorded everything in our |
101 // snapshot. | 101 // snapshot. |
102 already_logged->Subtract(*already_logged); | 102 already_logged->Subtract(*already_logged); |
103 already_logged->Add(snapshot); | 103 already_logged->Add(snapshot); |
104 } | 104 } |
105 // Deduct any stats we've already logged from our snapshot. | 105 // Deduct any stats we've already logged from our snapshot. |
106 snapshot.Subtract(*already_logged); | 106 snapshot.Subtract(*already_logged); |
107 } | 107 } |
108 | 108 |
109 // Snapshot now contains only a delta to what we've already_logged. | 109 // Snapshot now contains only a delta to what we've already_logged. |
110 if (snapshot.redundant_count() > 0) { | 110 if (snapshot.redundant_count() > 0) { |
111 histogram_flattener_->RecordDelta(histogram, snapshot); | 111 histogram_flattener_->RecordDelta(histogram, snapshot); |
112 // Add new data into our running total. | 112 // Add new data into our running total. |
113 already_logged->Add(snapshot); | 113 already_logged->Add(snapshot); |
114 } | 114 } |
115 } | 115 } |
116 } // namespace base | 116 } // namespace base |
OLD | NEW |