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

Issue 14697023: downloads: Improve download rate estimation. (Closed)

Created:
7 years, 7 months ago by cbentzel
Modified:
7 years, 6 months ago
CC:
chromium-reviews, benjhayden+dwatch_chromium.org, darin-cc_chromium.org, jam, joi+watch-content_chromium.org, tfarina
Visibility:
Public.

Description

downloads: Improve download rate estimation. Previously, download rate was estimated as bytes_received/(current_time - download_start_time) Although simple, this would react slowly to dynamic changes in download time, or user initiated pauses. With this change, a ring buffer of the past 10 seconds of download time is used instead, and estimates are derived from that. It handles dynamic changes to bandwidth well. Pauses are handled reasonably well, as estimates are accurate after ten seconds - a better solution would be to clear the data rates when the user resumes from a pause. The main downside with this approach is it takes about 100 bytes of memory per active download, as well as adds some complexity. BUG=16390 TEST=content_unittests Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=202874

Patch Set 1 #

Patch Set 2 : Remove debug strings #

Patch Set 3 : Get rid of BaseFile speed tests #

Patch Set 4 : Improve unit tests #

Total comments: 1

Patch Set 5 : TimeTicks instead of Time #

Patch Set 6 : Move RateEstimator to DownloadFileImpl #

Patch Set 7 : Handle TimeTicks wrapping #

Patch Set 8 : Rename and comment #

Total comments: 1

Patch Set 9 : Comment typo #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+239 lines, -55 lines) Patch
M content/browser/download/base_file.h View 1 2 3 4 5 1 chunk +0 lines, -3 lines 0 comments Download
M content/browser/download/base_file.cc View 1 2 3 4 5 2 chunks +0 lines, -11 lines 0 comments Download
M content/browser/download/base_file_unittest.cc View 1 2 1 chunk +0 lines, -40 lines 0 comments Download
M content/browser/download/download_file_impl.h View 1 2 3 4 5 2 chunks +2 lines, -0 lines 0 comments Download
M content/browser/download/download_file_impl.cc View 1 2 3 4 5 6 7 2 chunks +2 lines, -1 line 0 comments Download
A content/browser/download/rate_estimator.h View 1 2 3 4 5 6 7 1 chunk +52 lines, -0 lines 2 comments Download
A content/browser/download/rate_estimator.cc View 1 2 3 4 5 6 7 8 1 chunk +122 lines, -0 lines 5 comments Download
A content/browser/download/rate_estimator_unittest.cc View 1 2 3 4 5 6 7 1 chunk +58 lines, -0 lines 0 comments Download
M content/content_browser.gypi View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M content/content_tests.gypi View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 17 (0 generated)
cbentzel
I'm mainly interested in if you think it's worth adding this, and how it will ...
7 years, 7 months ago (2013-05-11 23:07:19 UTC) #1
asanka
Looks good. Have you considered whether you want to attach the RateEstimator at BaseFile or ...
7 years, 7 months ago (2013-05-13 17:37:12 UTC) #2
cbentzel
On 2013/05/13 17:37:12, asanka wrote: > Looks good. Have you considered whether you want to ...
7 years, 7 months ago (2013-05-14 10:39:55 UTC) #3
asanka
On 2013/05/14 10:39:55, cbentzel wrote: https://codereview.chromium.org/14697023/diff/10005/content/browser/download/rate_estimator.cc#newcode9 > > content/browser/download/rate_estimator.cc:9: using base::Time; > > Consider using ...
7 years, 7 months ago (2013-05-14 15:27:03 UTC) #4
cbentzel
On 2013/05/14 15:27:03, asanka wrote: > On 2013/05/14 10:39:55, cbentzel wrote: > https://codereview.chromium.org/14697023/diff/10005/content/browser/download/rate_estimator.cc#newcode9 > > ...
7 years, 7 months ago (2013-05-14 16:28:54 UTC) #5
cbentzel
OK, I cleaned up comments and tests and think this is ready to go.
7 years, 7 months ago (2013-05-15 19:55:38 UTC) #6
asanka
LGTM https://codereview.chromium.org/14697023/diff/36001/content/browser/download/rate_estimator.cc File content/browser/download/rate_estimator.cc (right): https://codereview.chromium.org/14697023/diff/36001/content/browser/download/rate_estimator.cc#newcode97 content/browser/download/rate_estimator.cc:97: // clearn all the buckets. Nit: clear
7 years, 7 months ago (2013-05-16 22:23:10 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/cbentzel@chromium.org/14697023/51001
7 years, 7 months ago (2013-05-17 09:41:02 UTC) #8
commit-bot: I haz the power
Retried try job too often on chromium_presubmit for step(s) presubmit http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=chromium_presubmit&number=3511
7 years, 7 months ago (2013-05-17 09:56:47 UTC) #9
cbentzel
+jam for content_browser.gypi + content_tests.gypi
7 years, 7 months ago (2013-05-17 10:08:02 UTC) #10
jam
lgtm
7 years, 6 months ago (2013-05-28 13:18:30 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/cbentzel@chromium.org/14697023/51001
7 years, 6 months ago (2013-05-28 14:39:52 UTC) #12
commit-bot: I haz the power
Retried try job too often on linux_chromeos for step(s) browser_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_chromeos&number=119072
7 years, 6 months ago (2013-05-28 16:53:35 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/cbentzel@chromium.org/14697023/51001
7 years, 6 months ago (2013-05-29 11:13:39 UTC) #14
commit-bot: I haz the power
Change committed as 202874
7 years, 6 months ago (2013-05-29 15:19:19 UTC) #15
tfarina
https://chromiumcodereview.appspot.com/14697023/diff/51001/content/browser/download/rate_estimator.h File content/browser/download/rate_estimator.h (right): https://chromiumcodereview.appspot.com/14697023/diff/51001/content/browser/download/rate_estimator.h#newcode8 content/browser/download/rate_estimator.h:8: #include <string> unused, you can remove. https://chromiumcodereview.appspot.com/14697023/diff/51001/content/browser/download/rate_estimator.h#newcode48 content/browser/download/rate_estimator.h:48: }; ...
7 years, 6 months ago (2013-05-29 16:31:18 UTC) #16
tfarina
7 years, 6 months ago (2013-05-29 16:35:21 UTC) #17
Message was sent while issue was closed.
https://chromiumcodereview.appspot.com/14697023/diff/51001/content/browser/do...
File content/browser/download/rate_estimator.cc (right):

https://chromiumcodereview.appspot.com/14697023/diff/51001/content/browser/do...
content/browser/download/rate_estimator.cc:16: static const int
kDefaultBucketTimeSeconds = 1;
static not needed here. const has internal linkage, and thus that means it
wouldn't be even necessary to put it in unnamed namespace. static in C means the
symbol is local to this file scope.

https://chromiumcodereview.appspot.com/14697023/diff/51001/content/browser/do...
content/browser/download/rate_estimator.cc:36: DCHECK(bucket_time_.InSeconds() >
0);
DCHECK_GT?

https://chromiumcodereview.appspot.com/14697023/diff/51001/content/browser/do...
content/browser/download/rate_estimator.cc:41: }
clang-format would put } in the above line.

https://chromiumcodereview.appspot.com/14697023/diff/51001/content/browser/do...
content/browser/download/rate_estimator.cc:50: DCHECK(seconds_since_oldest >=
0);
DCHECK_GE

https://chromiumcodereview.appspot.com/14697023/diff/51001/content/browser/do...
content/browser/download/rate_estimator.cc:114: for (size_t i = 0; i <
history_.size(); ++i) {
no curlies for single-line statements.

Powered by Google App Engine
This is Rietveld 408576698