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 #include "content/browser/download/interrupt_reasons.h" | 9 #include "content/browser/download/interrupt_reasons.h" |
10 | 10 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 download_content = DOWNLOAD_CONTENT_VIDEO; | 170 download_content = DOWNLOAD_CONTENT_VIDEO; |
171 } | 171 } |
172 } | 172 } |
173 | 173 |
174 // Record the value. | 174 // Record the value. |
175 UMA_HISTOGRAM_ENUMERATION("Download.ContentType", | 175 UMA_HISTOGRAM_ENUMERATION("Download.ContentType", |
176 download_content, | 176 download_content, |
177 DOWNLOAD_CONTENT_MAX); | 177 DOWNLOAD_CONTENT_MAX); |
178 } | 178 } |
179 | 179 |
| 180 void RecordOpen(const base::Time& end, bool first) { |
| 181 if (!end.is_null()) { |
| 182 UMA_HISTOGRAM_LONG_TIMES("Download.OpenTime", (base::Time::Now() - end)); |
| 183 if (first) { |
| 184 UMA_HISTOGRAM_LONG_TIMES("Download.FirstOpenTime", |
| 185 (base::Time::Now() - end)); |
| 186 } |
| 187 } |
| 188 } |
| 189 |
| 190 void RecordHistorySize(int size) { |
| 191 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.HistorySize", |
| 192 size, |
| 193 0/*min*/, |
| 194 (1 << 10)/*max*/, |
| 195 32/*num_buckets*/); |
| 196 } |
| 197 |
| 198 void RecordShelfClose(int size, int in_progress, bool autoclose) { |
| 199 static const int kMaxShelfSize = 16; |
| 200 if (autoclose) { |
| 201 UMA_HISTOGRAM_ENUMERATION("Download.ShelfSizeOnAutoClose", |
| 202 size, |
| 203 kMaxShelfSize); |
| 204 UMA_HISTOGRAM_ENUMERATION("Download.ShelfInProgressSizeOnAutoClose", |
| 205 in_progress, |
| 206 kMaxShelfSize); |
| 207 } else { |
| 208 UMA_HISTOGRAM_ENUMERATION("Download.ShelfSizeOnUserClose", |
| 209 size, |
| 210 kMaxShelfSize); |
| 211 UMA_HISTOGRAM_ENUMERATION("Download.ShelfInProgressSizeOnUserClose", |
| 212 in_progress, |
| 213 kMaxShelfSize); |
| 214 } |
| 215 } |
| 216 |
| 217 void RecordClearAllSize(int size) { |
| 218 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.ClearAllSize", |
| 219 size, |
| 220 0/*min*/, |
| 221 (1 << 10)/*max*/, |
| 222 32/*num_buckets*/); |
| 223 } |
| 224 |
| 225 void RecordOpensOutstanding(int size) { |
| 226 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.OpensOutstanding", |
| 227 size, |
| 228 0/*min*/, |
| 229 (1 << 10)/*max*/, |
| 230 64/*num_buckets*/); |
| 231 } |
| 232 |
180 } // namespace download_stats | 233 } // namespace download_stats |
OLD | NEW |