monobench: shuffle benchmark order between samples
authorMike Klein <mtklein@chromium.org>
Thu, 5 Jan 2017 19:08:50 +0000 (14:08 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Thu, 5 Jan 2017 19:42:09 +0000 (19:42 +0000)
I had the thought that going through each bench in the same order is a bias we can avoid, however slight.

Change-Id: I2ef1a6f57c4d121883250d65ea2e98ebe834925d
Reviewed-on: https://skia-review.googlesource.com/6622
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>

tools/monobench.cpp

index d5c9611..722ae91 100644 (file)
@@ -94,6 +94,7 @@ int main(int argc, char** argv) {
 
     int samples = 0;
     while (samples < limit) {
+        std::random_shuffle(benches.begin(), benches.end());
         for (auto& bench : benches) {
             for (int loops = 1; loops < 1000000000;) {
                 bench.b->preDraw(nullptr);