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

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

Issue 9316116: Isolate initiation counts for downloads to their own histograms and improve (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged to LKGR. Created 8 years, 10 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) 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/download_resource_handler.h" 9 #include "content/browser/download/download_resource_handler.h"
10 #include "content/browser/download/interrupt_reasons.h" 10 #include "content/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/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) {
28 UMA_HISTOGRAM_ENUMERATION(
29 "Download.Sources", source, DOWNLOAD_SOURCE_LAST_ENTRY);
30 }
31
27 void RecordDownloadCompleted(const base::TimeTicks& start, int64 download_len) { 32 void RecordDownloadCompleted(const base::TimeTicks& start, int64 download_len) {
28 RecordDownloadCount(COMPLETED_COUNT); 33 RecordDownloadCount(COMPLETED_COUNT);
29 UMA_HISTOGRAM_LONG_TIMES("Download.Time", (base::TimeTicks::Now() - start)); 34 UMA_HISTOGRAM_LONG_TIMES("Download.Time", (base::TimeTicks::Now() - start));
30 int64 max = 1024 * 1024 * 1024; // One Terabyte. 35 int64 max = 1024 * 1024 * 1024; // One Terabyte.
31 download_len /= 1024; // In Kilobytes 36 download_len /= 1024; // In Kilobytes
32 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.DownloadSize", 37 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.DownloadSize",
33 download_len, 38 download_len,
34 1, 39 1,
35 max, 40 max,
36 256); 41 256);
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 297
293 void RecordOpensOutstanding(int size) { 298 void RecordOpensOutstanding(int size) {
294 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.OpensOutstanding", 299 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.OpensOutstanding",
295 size, 300 size,
296 0/*min*/, 301 0/*min*/,
297 (1 << 10)/*max*/, 302 (1 << 10)/*max*/,
298 64/*num_buckets*/); 303 64/*num_buckets*/);
299 } 304 }
300 305
301 } // namespace download_stats 306 } // namespace download_stats
OLDNEW
« no previous file with comments | « content/browser/download/download_stats.h ('k') | content/browser/download/drag_download_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698