|
|
Chromium Code Reviews
DescriptionFix random number generation in disk_cache_perftests.
rand() is not very random on many platforms, and worse yet, RAND_MAX is
typically 32,767. Use base::RandInt instead.
R=jkarlin@chromium.org
BUG=none
Committed: https://crrev.com/ae2f89a69441e09e0ff13ed346f61c4f0298913b
Cr-Commit-Position: refs/heads/master@{#432188}
Patch Set 1 #Patch Set 2 : moar #
Total comments: 6
Patch Set 3 : moar #Messages
Total messages: 18 (10 generated)
The CQ bit was checked by gavinp@chromium.org to run a CQ dry run
PTAL. I came across this during a bunch of upgrades to testing; very frustrating discovery! A lot of our attempted improved testing with larger files was obviously not working.
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
On 2016/11/14 21:48:12, gavinp wrote: > PTAL. > > I came across this during a bunch of upgrades to testing; very frustrating > discovery! A lot of our attempted improved testing with larger files was > obviously not working. Note: there's more uses of rand() in disk cache and net; I'll be covering those shortly in follow-up CLs.
https://codereview.chromium.org/2501723002/diff/20001/net/disk_cache/disk_cac... File net/disk_cache/disk_cache_perftest.cc (right): https://codereview.chromium.org/2501723002/diff/20001/net/disk_cache/disk_cac... net/disk_cache/disk_cache_perftest.cc:270: // We can use form 1 to 4 blocks. While you're here.. s/form/from/ https://codereview.chromium.org/2501723002/diff/20001/net/disk_cache/disk_cac... net/disk_cache/disk_cache_perftest.cc:300: int entry = base::RandInt(0, kNumBlocks); base::RandInt(0, kNumBlocks-1) since it's inclusive and this value is used as an index. Then you can drop the condition below. https://codereview.chromium.org/2501723002/diff/20001/net/disk_cache/disk_cac... net/disk_cache/disk_cache_perftest.cc:302: if (entry >= kNumBlocks) This condition should go.
The CQ bit was checked by gavinp@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
I removed that function, it was one line, and it was goofy. Just repeated a variable declaration twice to make the same documentation. Thanks for catching the index issue; the gynmnastics here to use a bad random number generator were... impressive. https://codereview.chromium.org/2501723002/diff/20001/net/disk_cache/disk_cac... File net/disk_cache/disk_cache_perftest.cc (right): https://codereview.chromium.org/2501723002/diff/20001/net/disk_cache/disk_cac... net/disk_cache/disk_cache_perftest.cc:270: // We can use form 1 to 4 blocks. On 2016/11/15 12:18:29, jkarlin wrote: > While you're here.. > s/form/from/ Done. Also removed the function; documented the role with a variable instead. And killed the comment rather than fixing it, since it was just recapitulating code. https://codereview.chromium.org/2501723002/diff/20001/net/disk_cache/disk_cac... net/disk_cache/disk_cache_perftest.cc:300: int entry = base::RandInt(0, kNumBlocks); On 2016/11/15 12:18:29, jkarlin wrote: > base::RandInt(0, kNumBlocks-1) since it's inclusive and this value is used as an > index. Then you can drop the condition below. Done. I can't believe these gymnastics. This is such a horrible test. https://codereview.chromium.org/2501723002/diff/20001/net/disk_cache/disk_cac... net/disk_cache/disk_cache_perftest.cc:302: if (entry >= kNumBlocks) On 2016/11/15 12:18:29, jkarlin wrote: > This condition should go. Done.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
lgtm!
The CQ bit was checked by gavinp@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Committed patchset #3 (id:40001)
Message was sent while issue was closed.
Description was changed from ========== Fix random number generation in disk_cache_perftests. rand() is not very random on many platforms, and worse yet, RAND_MAX is typically 32,767. Use base::RandInt instead. R=jkarlin@chromium.org BUG=none ========== to ========== Fix random number generation in disk_cache_perftests. rand() is not very random on many platforms, and worse yet, RAND_MAX is typically 32,767. Use base::RandInt instead. R=jkarlin@chromium.org BUG=none Committed: https://crrev.com/ae2f89a69441e09e0ff13ed346f61c4f0298913b Cr-Commit-Position: refs/heads/master@{#432188} ==========
Message was sent while issue was closed.
Patchset 3 (id:??) landed as https://crrev.com/ae2f89a69441e09e0ff13ed346f61c4f0298913b Cr-Commit-Position: refs/heads/master@{#432188} |
