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

Unified Diff: content/browser/download/download_stats.cc

Issue 10695062: Improve download performance statistics. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Avoid division by zero errors. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/download/download_stats.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_stats.cc
diff --git a/content/browser/download/download_stats.cc b/content/browser/download/download_stats.cc
index 63329937c53b9b6d88cb22fa8f32a0bd59289ab1..f1492dd44ee7760453aa8abace94bcfa4cf2bf0d 100644
--- a/content/browser/download/download_stats.cc
+++ b/content/browser/download/download_stats.cc
@@ -306,21 +306,18 @@ void RecordContiguousWriteTime(base::TimeDelta time_blocked) {
UMA_HISTOGRAM_TIMES("Download.FileThreadBlockedTime", time_blocked);
}
-void RecordNetworkBandwidth(size_t length,
- base::TimeDelta elapsed_time,
- base::TimeDelta paused_time) {
- size_t non_pause_time_ms = (elapsed_time - paused_time).InMilliseconds();
- if (0u == non_pause_time_ms)
- non_pause_time_ms = 1;
-
- // Note that this will be somewhat higher than sustainable network
- // bandwidth because of buffering in the kernel during pauses.
- // Using Bytes/s rather than bits/s so that this value is easily
- // comparable with BandwidthOverall and BandwidthDisk.
- UMA_HISTOGRAM_CUSTOM_COUNTS(
- "Download.BandwidthNetworkBytesPerSecond",
- (1000 * length / non_pause_time_ms),
- 1, 100000000, 50);
+// Record what percentage of the time we have the network flow controlled.
+void RecordNetworkBlockage(base::TimeDelta resource_handler_lifetime,
+ base::TimeDelta resource_handler_blocked_time) {
+ int percentage = 0;
+ // Avoid division by zero errors.
+ if (resource_handler_blocked_time != base::TimeDelta()) {
+ percentage =
+ resource_handler_blocked_time * 100 / resource_handler_lifetime;
+ }
+
+ UMA_HISTOGRAM_COUNTS_100("Download.ResourceHandlerBlockedPercentage",
+ percentage);
}
void RecordFileBandwidth(size_t length,
@@ -339,6 +336,8 @@ void RecordFileBandwidth(size_t length,
UMA_HISTOGRAM_CUSTOM_COUNTS(
"Download.BandwidthDiskBytesPerSecond",
(1000 * length / disk_write_time_ms), 1, 50000000, 50);
+ UMA_HISTOGRAM_COUNTS_100("Download.DiskBandwidthUsedPercentage",
+ disk_write_time_ms * 100 / elapsed_time_ms);
}
void RecordSavePackageEvent(SavePackageEvent event) {
« no previous file with comments | « content/browser/download/download_stats.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698