OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/download/download_stats.h" | 5 #include "content/browser/download/download_stats.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 | 9 |
10 namespace download_stats { | 10 namespace download_stats { |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 download_content = DOWNLOAD_CONTENT_VIDEO; | 166 download_content = DOWNLOAD_CONTENT_VIDEO; |
167 } | 167 } |
168 } | 168 } |
169 | 169 |
170 // Record the value. | 170 // Record the value. |
171 UMA_HISTOGRAM_ENUMERATION("Download.ContentType", | 171 UMA_HISTOGRAM_ENUMERATION("Download.ContentType", |
172 download_content, | 172 download_content, |
173 DOWNLOAD_CONTENT_MAX); | 173 DOWNLOAD_CONTENT_MAX); |
174 } | 174 } |
175 | 175 |
| 176 void RecordOpen(const base::Time& end, bool first) { |
| 177 if (!end.is_null()) { |
| 178 UMA_HISTOGRAM_LONG_TIMES("Download.OpenTime", (base::Time::Now() - end)); |
| 179 if (first) { |
| 180 UMA_HISTOGRAM_LONG_TIMES("Download.FirstOpenTime", |
| 181 (base::Time::Now() - end)); |
| 182 } |
| 183 } |
| 184 } |
| 185 |
| 186 void RecordHistorySize(int size) { |
| 187 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.HistorySize", |
| 188 size, |
| 189 0/*min*/, |
| 190 (1 << 10)/*max*/, |
| 191 32/*num_buckets*/); |
| 192 } |
| 193 |
| 194 void RecordShelfClose(int size, int pending, bool autoclose) { |
| 195 if (autoclose) { |
| 196 UMA_HISTOGRAM_ENUMERATION("Download.ShelfSizeOnAutoClose", |
| 197 size, |
| 198 128); |
| 199 UMA_HISTOGRAM_ENUMERATION("Download.ShelfPendingSizeOnAutoClose", |
| 200 pending, |
| 201 128); |
| 202 } else { |
| 203 UMA_HISTOGRAM_ENUMERATION("Download.ShelfSizeOnUserClose", |
| 204 size, |
| 205 128); |
| 206 UMA_HISTOGRAM_ENUMERATION("Download.ShelfPendingSizeOnUserClose", |
| 207 pending, |
| 208 128); |
| 209 } |
| 210 } |
| 211 |
| 212 void RecordClearAllSize(int size) { |
| 213 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.ClearAllSize", |
| 214 size, |
| 215 0/*min*/, |
| 216 (1 << 10)/*max*/, |
| 217 32/*num_buckets*/); |
| 218 } |
| 219 |
| 220 void RecordOpensOutstanding(int size) { |
| 221 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.OpensOutstanding", |
| 222 size, |
| 223 0/*min*/, |
| 224 (1 << 10)/*max*/, |
| 225 32/*num_buckets*/); |
| 226 } |
| 227 |
176 } // namespace download_stats | 228 } // namespace download_stats |
OLD | NEW |