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 #pragma once | 9 #pragma once |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 #include "content/public/browser/download_interrupt_reasons.h" | 15 #include "content/public/browser/download_interrupt_reasons.h" |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class Time; | 18 class Time; |
| 19 class TimeDelta; |
19 class TimeTicks; | 20 class TimeTicks; |
20 } | 21 } |
21 | 22 |
22 namespace download_stats { | 23 namespace download_stats { |
23 | 24 |
24 // We keep a count of how often various events occur in the | 25 // We keep a count of how often various events occur in the |
25 // histogram "Download.Counts". | 26 // histogram "Download.Counts". |
26 enum DownloadCountTypes { | 27 enum DownloadCountTypes { |
27 // Stale enum values left around so that values passed to UMA don't | 28 // Stale enum values left around so that values passed to UMA don't |
28 // change. | 29 // change. |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 131 |
131 // Record whether or not the server accepts ranges, and the download size. | 132 // Record whether or not the server accepts ranges, and the download size. |
132 void RecordAcceptsRanges(const std::string& accepts_ranges, int64 download_len); | 133 void RecordAcceptsRanges(const std::string& accepts_ranges, int64 download_len); |
133 | 134 |
134 // Record the number of downloads removed by ClearAll. | 135 // Record the number of downloads removed by ClearAll. |
135 void RecordClearAllSize(int size); | 136 void RecordClearAllSize(int size); |
136 | 137 |
137 // Record the number of completed unopened downloads when a download is opened. | 138 // Record the number of completed unopened downloads when a download is opened. |
138 void RecordOpensOutstanding(int size); | 139 void RecordOpensOutstanding(int size); |
139 | 140 |
| 141 // Record how long we block the file thread at a time. |
| 142 void RecordContiguousWriteTime(base::TimeDelta time_blocked); |
| 143 |
| 144 // Record overall bandwidth stats at the network end. |
| 145 void RecordNetworkBandwidth(size_t length, |
| 146 base::TimeDelta elapsed_time, |
| 147 base::TimeDelta paused_time); |
| 148 |
| 149 // Record overall bandwidth stats at the file end. |
| 150 void RecordFileBandwidth(size_t length, |
| 151 base::TimeDelta disk_write_time, |
| 152 base::TimeDelta elapsed_time); |
| 153 |
140 enum SavePackageEvent { | 154 enum SavePackageEvent { |
141 // The user has started to save a page as a package. | 155 // The user has started to save a page as a package. |
142 SAVE_PACKAGE_STARTED, | 156 SAVE_PACKAGE_STARTED, |
143 | 157 |
144 // The save package operation was cancelled. | 158 // The save package operation was cancelled. |
145 SAVE_PACKAGE_CANCELLED, | 159 SAVE_PACKAGE_CANCELLED, |
146 | 160 |
147 // The save package operation finished without being cancelled. | 161 // The save package operation finished without being cancelled. |
148 SAVE_PACKAGE_FINISHED, | 162 SAVE_PACKAGE_FINISHED, |
149 | 163 |
150 // The save package tried to write to an already completed file. | 164 // The save package tried to write to an already completed file. |
151 SAVE_PACKAGE_WRITE_TO_COMPLETED, | 165 SAVE_PACKAGE_WRITE_TO_COMPLETED, |
152 | 166 |
153 // The save package tried to write to an already failed file. | 167 // The save package tried to write to an already failed file. |
154 SAVE_PACKAGE_WRITE_TO_FAILED, | 168 SAVE_PACKAGE_WRITE_TO_FAILED, |
155 | 169 |
156 SAVE_PACKAGE_LAST_ENTRY | 170 SAVE_PACKAGE_LAST_ENTRY |
157 }; | 171 }; |
158 | 172 |
159 void RecordSavePackageEvent(SavePackageEvent event); | 173 void RecordSavePackageEvent(SavePackageEvent event); |
160 | 174 |
161 } // namespace download_stats | 175 } // namespace download_stats |
162 | 176 |
163 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ | 177 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ |
OLD | NEW |