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

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

Issue 20609004: [Downloads] Some UMA for downloads resumption. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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
« no previous file with comments | « content/browser/download/download_stats.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "content/browser/download/download_resource_handler.h" 9 #include "content/browser/download/download_resource_handler.h"
10 #include "content/public/browser/download_interrupt_reasons.h" 10 #include "content/public/browser/download_interrupt_reasons.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 int max = 1024 * 1024; // One Megabyte. 172 int max = 1024 * 1024; // One Megabyte.
173 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.WriteSize", data_len, 1, max, 256); 173 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.WriteSize", data_len, 1, max, 256);
174 } 174 }
175 175
176 void RecordDownloadWriteLoopCount(int count) { 176 void RecordDownloadWriteLoopCount(int count) {
177 RecordDownloadCount(WRITE_LOOP_COUNT); 177 RecordDownloadCount(WRITE_LOOP_COUNT);
178 UMA_HISTOGRAM_ENUMERATION("Download.WriteLoopCount", count, 20); 178 UMA_HISTOGRAM_ENUMERATION("Download.WriteLoopCount", count, 20);
179 } 179 }
180 180
181 void RecordAcceptsRanges(const std::string& accepts_ranges, 181 void RecordAcceptsRanges(const std::string& accepts_ranges,
182 int64 download_len) { 182 int64 download_len,
183 const std::string& etag) {
183 int64 max = 1024 * 1024 * 1024; // One Terabyte. 184 int64 max = 1024 * 1024 * 1024; // One Terabyte.
184 download_len /= 1024; // In Kilobytes 185 download_len /= 1024; // In Kilobytes
185 static const int kBuckets = 50; 186 static const int kBuckets = 50;
186 187
187 if (LowerCaseEqualsASCII(accepts_ranges, "none")) { 188 if (LowerCaseEqualsASCII(accepts_ranges, "none")) {
188 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.AcceptRangesNone.KBytes", 189 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.AcceptRangesNone.KBytes",
189 download_len, 190 download_len,
190 1, 191 1,
191 max, 192 max,
192 kBuckets); 193 kBuckets);
193 } else if (LowerCaseEqualsASCII(accepts_ranges, "bytes")) { 194 } else if (LowerCaseEqualsASCII(accepts_ranges, "bytes")) {
194 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.AcceptRangesBytes.KBytes", 195 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.AcceptRangesBytes.KBytes",
195 download_len, 196 download_len,
196 1, 197 1,
197 max, 198 max,
198 kBuckets); 199 kBuckets);
200 // ETags that start with "W/" are considered weak ETags which don't imply
201 // byte-wise equality.
202 if (!StartsWithASCII(etag, "w/", false))
203 RecordDownloadCount(STRONG_ETAG_AND_ACCEPTS_RANGES);
199 } else { 204 } else {
200 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.AcceptRangesMissingOrInvalid.KBytes", 205 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.AcceptRangesMissingOrInvalid.KBytes",
201 download_len, 206 download_len,
202 1, 207 1,
203 max, 208 max,
204 kBuckets); 209 kBuckets);
205 } 210 }
206 } 211 }
207 212
208 namespace { 213 namespace {
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 disk_write_time_ms * 100 / elapsed_time_ms); 455 disk_write_time_ms * 100 / elapsed_time_ms);
451 } 456 }
452 457
453 void RecordSavePackageEvent(SavePackageEvent event) { 458 void RecordSavePackageEvent(SavePackageEvent event) {
454 UMA_HISTOGRAM_ENUMERATION("Download.SavePackage", 459 UMA_HISTOGRAM_ENUMERATION("Download.SavePackage",
455 event, 460 event,
456 SAVE_PACKAGE_LAST_ENTRY); 461 SAVE_PACKAGE_LAST_ENTRY);
457 } 462 }
458 463
459 } // namespace content 464 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/download_stats.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698