Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/metrics/persisted_logs.h" | 5 #include "components/metrics/persisted_logs.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/md5.h" | 10 #include "base/md5.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 saved_log_count >= min_log_count_) { | 124 saved_log_count >= min_log_count_) { |
| 125 break; | 125 break; |
| 126 } | 126 } |
| 127 // Oversized logs won't be persisted, so don't count them. | 127 // Oversized logs won't be persisted, so don't count them. |
| 128 if (log_size > max_log_size_) | 128 if (log_size > max_log_size_) |
| 129 continue; | 129 continue; |
| 130 bytes_used += log_size; | 130 bytes_used += log_size; |
| 131 ++saved_log_count; | 131 ++saved_log_count; |
| 132 } | 132 } |
| 133 | 133 |
| 134 UMA_HISTOGRAM_COUNTS("UMA.UnSentLog.Dropped", start - 1); | |
| 135 | |
| 134 for (size_t i = start; i < list_.size(); ++i) { | 136 for (size_t i = start; i < list_.size(); ++i) { |
| 135 size_t log_size = list_[i].compressed_log_data.length(); | 137 size_t log_size = list_[i].compressed_log_data.length(); |
| 136 if (log_size > max_log_size_) { | 138 if (log_size > max_log_size_) { |
| 137 UMA_HISTOGRAM_COUNTS("UMA.Large Accumulated Log Not Persisted", | 139 UMA_HISTOGRAM_COUNTS("UMA.Large Accumulated Log Not Persisted", |
| 138 static_cast<int>(log_size)); | 140 static_cast<int>(log_size)); |
| 141 UMA_HISTOGRAM_COUNTS("UMA.UnSentLog.Dropped", 1); | |
|
Alexei Svitkine (slow)
2016/04/08 15:08:32
Can you just log the total at the end of the funct
gayane -on leave until 09-2017
2016/04/08 17:19:25
Done.
| |
| 139 continue; | 142 continue; |
| 140 } | 143 } |
| 141 AppendBase64String(list_[i].compressed_log_data, list_value); | 144 AppendBase64String(list_[i].compressed_log_data, list_value); |
| 142 AppendBase64String(list_[i].hash, list_value); | 145 AppendBase64String(list_[i].hash, list_value); |
| 143 } | 146 } |
| 144 } | 147 } |
| 145 | 148 |
| 146 PersistedLogs::LogReadStatus PersistedLogs::ReadLogsFromPrefList( | 149 PersistedLogs::LogReadStatus PersistedLogs::ReadLogsFromPrefList( |
| 147 const base::ListValue& list_value) { | 150 const base::ListValue& list_value) { |
| 148 if (list_value.empty()) | 151 if (list_value.empty()) |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 162 !ReadBase64String(list_value, i * 2 + 1, &list_[i].hash)) { | 165 !ReadBase64String(list_value, i * 2 + 1, &list_[i].hash)) { |
| 163 list_.clear(); | 166 list_.clear(); |
| 164 return MakeRecallStatusHistogram(LOG_STRING_CORRUPTION); | 167 return MakeRecallStatusHistogram(LOG_STRING_CORRUPTION); |
| 165 } | 168 } |
| 166 } | 169 } |
| 167 | 170 |
| 168 return MakeRecallStatusHistogram(RECALL_SUCCESS); | 171 return MakeRecallStatusHistogram(RECALL_SUCCESS); |
| 169 } | 172 } |
| 170 | 173 |
| 171 } // namespace metrics | 174 } // namespace metrics |
| OLD | NEW |