Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(816)

Side by Side Diff: content/browser/download/download_stats.cc

Issue 9639001: Move download interrupt reasons to content\public (the enum that's used by chrome). The rest keep i… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: nits Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #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/download_resource_handler.h" 9 #include "content/browser/download/download_resource_handler.h"
10 #include "content/browser/download/interrupt_reasons.h" 10 #include "content/public/browser/download_interrupt_reasons.h"
11 11
12 namespace download_stats { 12 namespace download_stats {
13 13
14 // All possible error codes from the network module. Note that the error codes 14 // All possible error codes from the network module. Note that the error codes
15 // are all positive (since histograms expect positive sample values). 15 // are all positive (since histograms expect positive sample values).
16 const int kAllInterruptReasonCodes[] = { 16 const int kAllInterruptReasonCodes[] = {
17 #define INTERRUPT_REASON(label, value) (value), 17 #define INTERRUPT_REASON(label, value) (value),
18 #include "content/browser/download/interrupt_reason_values.h" 18 #include "content/public/browser/download_interrupt_reason_values.h"
19 #undef INTERRUPT_REASON 19 #undef INTERRUPT_REASON
20 }; 20 };
21 21
22 void RecordDownloadCount(DownloadCountTypes type) { 22 void RecordDownloadCount(DownloadCountTypes type) {
23 UMA_HISTOGRAM_ENUMERATION( 23 UMA_HISTOGRAM_ENUMERATION(
24 "Download.Counts", type, DOWNLOAD_COUNT_TYPES_LAST_ENTRY); 24 "Download.Counts", type, DOWNLOAD_COUNT_TYPES_LAST_ENTRY);
25 } 25 }
26 26
27 void RecordDownloadSource(DownloadSource source) { 27 void RecordDownloadSource(DownloadSource source) {
28 UMA_HISTOGRAM_ENUMERATION( 28 UMA_HISTOGRAM_ENUMERATION(
29 "Download.Sources", source, DOWNLOAD_SOURCE_LAST_ENTRY); 29 "Download.Sources", source, DOWNLOAD_SOURCE_LAST_ENTRY);
30 } 30 }
31 31
32 void RecordDownloadCompleted(const base::TimeTicks& start, int64 download_len) { 32 void RecordDownloadCompleted(const base::TimeTicks& start, int64 download_len) {
33 RecordDownloadCount(COMPLETED_COUNT); 33 RecordDownloadCount(COMPLETED_COUNT);
34 UMA_HISTOGRAM_LONG_TIMES("Download.Time", (base::TimeTicks::Now() - start)); 34 UMA_HISTOGRAM_LONG_TIMES("Download.Time", (base::TimeTicks::Now() - start));
35 int64 max = 1024 * 1024 * 1024; // One Terabyte. 35 int64 max = 1024 * 1024 * 1024; // One Terabyte.
36 download_len /= 1024; // In Kilobytes 36 download_len /= 1024; // In Kilobytes
37 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.DownloadSize", 37 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.DownloadSize",
38 download_len, 38 download_len,
39 1, 39 1,
40 max, 40 max,
41 256); 41 256);
42 } 42 }
43 43
44 void RecordDownloadInterrupted(InterruptReason reason, 44 void RecordDownloadInterrupted(content::DownloadInterruptReason reason,
45 int64 received, 45 int64 received,
46 int64 total) { 46 int64 total) {
47 RecordDownloadCount(INTERRUPTED_COUNT); 47 RecordDownloadCount(INTERRUPTED_COUNT);
48 UMA_HISTOGRAM_CUSTOM_ENUMERATION( 48 UMA_HISTOGRAM_CUSTOM_ENUMERATION(
49 "Download.InterruptedReason", 49 "Download.InterruptedReason",
50 reason, 50 reason,
51 base::CustomHistogram::ArrayToCustomRanges( 51 base::CustomHistogram::ArrayToCustomRanges(
52 kAllInterruptReasonCodes, arraysize(kAllInterruptReasonCodes))); 52 kAllInterruptReasonCodes, arraysize(kAllInterruptReasonCodes)));
53 53
54 // The maximum should be 2^kBuckets, to have the logarithmic bucket 54 // The maximum should be 2^kBuckets, to have the logarithmic bucket
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 64/*num_buckets*/); 303 64/*num_buckets*/);
304 } 304 }
305 305
306 void RecordSavePackageEvent(SavePackageEvent event) { 306 void RecordSavePackageEvent(SavePackageEvent event) {
307 UMA_HISTOGRAM_ENUMERATION("Download.SavePackage", 307 UMA_HISTOGRAM_ENUMERATION("Download.SavePackage",
308 event, 308 event,
309 SAVE_PACKAGE_LAST_ENTRY); 309 SAVE_PACKAGE_LAST_ENTRY);
310 } 310 }
311 311
312 } // namespace download_stats 312 } // namespace download_stats
OLDNEW
« no previous file with comments | « content/browser/download/download_stats.h ('k') | content/browser/download/interrupt_reason_values.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698