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

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

Issue 10392111: Use ByteStream in downloads system to decouple source and sink. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync'd to LKGR. Created 8 years, 6 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/public/browser/download_interrupt_reasons.h" 10 #include "content/public/browser/download_interrupt_reasons.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 248
249 // Record the value. 249 // Record the value.
250 UMA_HISTOGRAM_ENUMERATION("Download.ContentType", 250 UMA_HISTOGRAM_ENUMERATION("Download.ContentType",
251 download_content, 251 download_content,
252 DOWNLOAD_CONTENT_MAX); 252 DOWNLOAD_CONTENT_MAX);
253 } 253 }
254 254
255 void RecordFileThreadReceiveBuffers(size_t num_buffers) { 255 void RecordFileThreadReceiveBuffers(size_t num_buffers) {
256 UMA_HISTOGRAM_CUSTOM_COUNTS( 256 UMA_HISTOGRAM_CUSTOM_COUNTS(
257 "Download.FileThreadReceiveBuffers", num_buffers, 1, 257 "Download.FileThreadReceiveBuffers", num_buffers, 1,
258 DownloadResourceHandler::kLoadsToWrite, 258 100, 100);
259 DownloadResourceHandler::kLoadsToWrite);
260 } 259 }
261 260
262 void RecordBandwidth(double actual_bandwidth, double potential_bandwidth) { 261 void RecordBandwidth(double actual_bandwidth, double potential_bandwidth) {
263 UMA_HISTOGRAM_CUSTOM_COUNTS( 262 UMA_HISTOGRAM_CUSTOM_COUNTS(
264 "Download.ActualBandwidth", actual_bandwidth, 1, 1000000000, 50); 263 "Download.ActualBandwidth", actual_bandwidth, 1, 1000000000, 50);
265 UMA_HISTOGRAM_CUSTOM_COUNTS( 264 UMA_HISTOGRAM_CUSTOM_COUNTS(
266 "Download.PotentialBandwidth", potential_bandwidth, 1, 1000000000, 50); 265 "Download.PotentialBandwidth", potential_bandwidth, 1, 1000000000, 50);
267 UMA_HISTOGRAM_PERCENTAGE( 266 UMA_HISTOGRAM_PERCENTAGE(
268 "Download.BandwidthUsed", 267 "Download.BandwidthUsed",
269 (int) ((actual_bandwidth * 100)/ potential_bandwidth)); 268 (int) ((actual_bandwidth * 100)/ potential_bandwidth));
(...skipping 26 matching lines...) Expand all
296 } 295 }
297 296
298 void RecordOpensOutstanding(int size) { 297 void RecordOpensOutstanding(int size) {
299 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.OpensOutstanding", 298 UMA_HISTOGRAM_CUSTOM_COUNTS("Download.OpensOutstanding",
300 size, 299 size,
301 0/*min*/, 300 0/*min*/,
302 (1 << 10)/*max*/, 301 (1 << 10)/*max*/,
303 64/*num_buckets*/); 302 64/*num_buckets*/);
304 } 303 }
305 304
305 void RecordContiguousWriteTime(base::TimeDelta time_blocked) {
306 UMA_HISTOGRAM_TIMES("Download.FileThreadBlockedTime", time_blocked);
307 }
308
309 void RecordNetworkBandwidth(size_t length,
310 base::TimeDelta elapsed_time,
311 base::TimeDelta paused_time) {
312 size_t non_pause_time_ms = (elapsed_time - paused_time).InMilliseconds();
313 if (0u == non_pause_time_ms)
314 non_pause_time_ms = 1;
315
316 // Note that this will be somewhat higher than sustainable network
317 // bandwidth because of buffering in the kernel during pauses.
318 // Using Bytes/s rather than bits/s so that this value is easily
319 // comparable with BandwidthOverall and BandwidthDisk.
320 UMA_HISTOGRAM_CUSTOM_COUNTS(
321 "Download.BandwidthNetworkBytesPerSecond",
322 (1000 * length / non_pause_time_ms),
323 1, 100000000, 50);
324 }
325
326 void RecordFileBandwidth(size_t length,
327 base::TimeDelta disk_write_time,
328 base::TimeDelta elapsed_time) {
329 size_t elapsed_time_ms = elapsed_time.InMilliseconds();
330 if (0u == elapsed_time_ms)
331 elapsed_time_ms = 1;
332 size_t disk_write_time_ms = disk_write_time.InMilliseconds();
333 if (0u == disk_write_time_ms)
334 disk_write_time_ms = 1;
335
336 UMA_HISTOGRAM_CUSTOM_COUNTS(
337 "Download.BandwidthOverallBytesPerSecond",
338 (1000 * length / elapsed_time_ms), 1, 50000000, 50);
339 UMA_HISTOGRAM_CUSTOM_COUNTS(
340 "Download.BandwidthDiskBytesPerSecond",
341 (1000 * length / disk_write_time_ms), 1, 50000000, 50);
342 }
343
306 void RecordSavePackageEvent(SavePackageEvent event) { 344 void RecordSavePackageEvent(SavePackageEvent event) {
307 UMA_HISTOGRAM_ENUMERATION("Download.SavePackage", 345 UMA_HISTOGRAM_ENUMERATION("Download.SavePackage",
308 event, 346 event,
309 SAVE_PACKAGE_LAST_ENTRY); 347 SAVE_PACKAGE_LAST_ENTRY);
310 } 348 }
311 349
312 } // namespace download_stats 350 } // namespace download_stats
OLDNEW
« no previous file with comments | « content/browser/download/download_stats.h ('k') | content/browser/renderer_host/resource_dispatcher_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698