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

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: Fixed lack of virtual keyword on destructor. 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 UMA_HISTOGRAM_CUSTOM_COUNTS(
319 "Download.BandwidthNetwork",
benjhayden 2012/05/30 20:22:33 Include units (looks like Bps?) in case you decide
320 (1000 * length / non_pause_time_ms),
321 1, 100000000, 50);
322 }
323
324 void RecordFileBandwidth(size_t length,
325 base::TimeDelta disk_write_time,
326 base::TimeDelta elapsed_time) {
327 size_t elapsed_time_ms = elapsed_time.InMilliseconds();
328 if (0u == elapsed_time_ms)
329 elapsed_time_ms = 1;
330 size_t disk_write_time_ms = disk_write_time.InMilliseconds();
331 if (0u == disk_write_time_ms)
332 disk_write_time_ms = 1;
333
334 UMA_HISTOGRAM_CUSTOM_COUNTS(
335 "Download.BandwidthOverall",
336 (1000 * length / elapsed_time_ms), 1, 50000000, 50);
337 UMA_HISTOGRAM_CUSTOM_COUNTS(
338 "Download.BandwidthDisk",
339 (1000 * length / disk_write_time_ms), 1, 50000000, 50);
340 }
341
306 void RecordSavePackageEvent(SavePackageEvent event) { 342 void RecordSavePackageEvent(SavePackageEvent event) {
307 UMA_HISTOGRAM_ENUMERATION("Download.SavePackage", 343 UMA_HISTOGRAM_ENUMERATION("Download.SavePackage",
308 event, 344 event,
309 SAVE_PACKAGE_LAST_ENTRY); 345 SAVE_PACKAGE_LAST_ENTRY);
310 } 346 }
311 347
312 } // namespace download_stats 348 } // 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