| 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 // Holds helpers for gathering UMA stats about downloads. | 5 // Holds helpers for gathering UMA stats about downloads. |
| 6 | 6 |
| 7 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ | 7 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ |
| 8 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ | 8 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 // Record the bandwidth seen in DownloadResourceHandler | 154 // Record the bandwidth seen in DownloadResourceHandler |
| 155 // |actual_bandwidth| and |potential_bandwidth| are in bytes/second. | 155 // |actual_bandwidth| and |potential_bandwidth| are in bytes/second. |
| 156 void RecordBandwidth(double actual_bandwidth, double potential_bandwidth); | 156 void RecordBandwidth(double actual_bandwidth, double potential_bandwidth); |
| 157 | 157 |
| 158 // Record the time of both the first open and all subsequent opens since the | 158 // Record the time of both the first open and all subsequent opens since the |
| 159 // download completed. | 159 // download completed. |
| 160 void RecordOpen(const base::Time& end, bool first); | 160 void RecordOpen(const base::Time& end, bool first); |
| 161 | 161 |
| 162 // Record whether or not the server accepts ranges, and the download size. Also | 162 // Record whether or not the server accepts ranges, and the download size. Also |
| 163 // counts if a strong ETag is supplied. The combination of range request support | 163 // counts if a strong validator is supplied. The combination of range request |
| 164 // and ETag indicates downloads that are candidates for partial resumption. | 164 // support and ETag indicates downloads that are candidates for partial |
| 165 void RecordAcceptsRanges(const std::string& accepts_ranges, int64 download_len, | 165 // resumption. |
| 166 const std::string& etag); | 166 void RecordAcceptsRanges(const std::string& accepts_ranges, |
| 167 int64 download_len, |
| 168 bool has_strong_validator); |
| 167 | 169 |
| 168 // Record the number of downloads removed by ClearAll. | 170 // Record the number of downloads removed by ClearAll. |
| 169 void RecordClearAllSize(int size); | 171 void RecordClearAllSize(int size); |
| 170 | 172 |
| 171 // Record the number of completed unopened downloads when a download is opened. | 173 // Record the number of completed unopened downloads when a download is opened. |
| 172 void RecordOpensOutstanding(int size); | 174 void RecordOpensOutstanding(int size); |
| 173 | 175 |
| 174 // Record how long we block the file thread at a time. | 176 // Record how long we block the file thread at a time. |
| 175 void RecordContiguousWriteTime(base::TimeDelta time_blocked); | 177 void RecordContiguousWriteTime(base::TimeDelta time_blocked); |
| 176 | 178 |
| 177 // Record the percentage of time we had to block the network (i.e. | 179 // Record the percentage of time we had to block the network (i.e. |
| 178 // how often, for each download, something other than the network | 180 // how often, for each download, something other than the network |
| 179 // was the bottleneck). | 181 // was the bottleneck). |
| 180 void RecordNetworkBlockage(base::TimeDelta resource_handler_lifetime, | 182 void RecordNetworkBlockage(base::TimeDelta resource_handler_lifetime, |
| 181 base::TimeDelta resource_handler_blocked_time); | 183 base::TimeDelta resource_handler_blocked_time); |
| 182 | 184 |
| 183 // Record overall bandwidth stats at the file end. | 185 // Record overall bandwidth stats at the file end. |
| 184 void RecordFileBandwidth(size_t length, | 186 void RecordFileBandwidth(size_t length, |
| 185 base::TimeDelta disk_write_time, | 187 base::TimeDelta disk_write_time, |
| 186 base::TimeDelta elapsed_time); | 188 base::TimeDelta elapsed_time); |
| 187 | 189 |
| 190 // Record the net errors that map to DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED. |
| 191 void RecordNetErrorForNetworkFailed(int net_error); |
| 192 |
| 188 enum SavePackageEvent { | 193 enum SavePackageEvent { |
| 189 // The user has started to save a page as a package. | 194 // The user has started to save a page as a package. |
| 190 SAVE_PACKAGE_STARTED, | 195 SAVE_PACKAGE_STARTED, |
| 191 | 196 |
| 192 // The save package operation was cancelled. | 197 // The save package operation was cancelled. |
| 193 SAVE_PACKAGE_CANCELLED, | 198 SAVE_PACKAGE_CANCELLED, |
| 194 | 199 |
| 195 // The save package operation finished without being cancelled. | 200 // The save package operation finished without being cancelled. |
| 196 SAVE_PACKAGE_FINISHED, | 201 SAVE_PACKAGE_FINISHED, |
| 197 | 202 |
| 198 // The save package tried to write to an already completed file. | 203 // The save package tried to write to an already completed file. |
| 199 SAVE_PACKAGE_WRITE_TO_COMPLETED, | 204 SAVE_PACKAGE_WRITE_TO_COMPLETED, |
| 200 | 205 |
| 201 // The save package tried to write to an already failed file. | 206 // The save package tried to write to an already failed file. |
| 202 SAVE_PACKAGE_WRITE_TO_FAILED, | 207 SAVE_PACKAGE_WRITE_TO_FAILED, |
| 203 | 208 |
| 204 SAVE_PACKAGE_LAST_ENTRY | 209 SAVE_PACKAGE_LAST_ENTRY |
| 205 }; | 210 }; |
| 206 | 211 |
| 207 void RecordSavePackageEvent(SavePackageEvent event); | 212 void RecordSavePackageEvent(SavePackageEvent event); |
| 208 | 213 |
| 209 } // namespace content | 214 } // namespace content |
| 210 | 215 |
| 211 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ | 216 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ |
| OLD | NEW |