bbh_shootout: Move bitmap rendering out of the timing codepath.

R=reed@google.com

Author: sglez@google.com

Review URL: https://chromiumcodereview.appspot.com/23639003

git-svn-id: http://skia.googlecode.com/svn/trunk@10983 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/bbh_shootout.cpp b/tools/bbh_shootout.cpp
index 76e8d07..8822389 100644
--- a/tools/bbh_shootout.cpp
+++ b/tools/bbh_shootout.cpp
@@ -238,11 +238,11 @@
         }
 
         renderer->setup();
-        // Render once to fill caches.
-        renderer->render(NULL);
+        // Render once to fill caches. Fill bitmap during the first iteration.
+        renderer->render(NULL, out);
         // Render again to measure
         timer->start();
-        bool result = renderer->render(NULL, out);
+        bool result = renderer->render(NULL);
         timer->end();
 
         // We only care about a false result on playback. RecordPictureRenderer::render will always
@@ -388,7 +388,9 @@
     playbackOut.writeText("\n");
     // Write to file, and save recording averages.
     SkScalar avgRecord = SkIntToScalar(0);
+    SkScalar avgPlayback = SkIntToScalar(0);
     SkScalar avgRecordRTree = SkIntToScalar(0);
+    SkScalar avgPlaybackRTree = SkIntToScalar(0);
     for (int i = 0; i < argc - 1; ++i) {
         SkString pbLine;
         SkString recLine;
@@ -400,10 +402,13 @@
         cpuTime = histograms[BenchmarkControl::kRTreeRecord][i].fCpuTime;
         recLine.appendf("%f", cpuTime);
         avgRecordRTree += cpuTime;
+        avgPlaybackRTree += cpuTime;
 
         // ==== Write playback info
         pbLine.printf("%d ", i);
         pbLine.appendf("%f ", histograms[2][i].fCpuTime);  // Start with normal playback time.
+        avgPlayback += histograms[kNumBbhPlaybackBenchmarks - 1][i].fCpuTime;
+        avgPlaybackRTree += histograms[kNumBbhPlaybackBenchmarks][i].fCpuTime;
         // Append all playback benchmark times.
         for (size_t j = kNumBbhPlaybackBenchmarks; j < kNumBenchmarks; ++j) {
             pbLine.appendf("%f ", histograms[j][i].fCpuTime);
@@ -416,8 +421,13 @@
     }
     avgRecord /= argc - 1;
     avgRecordRTree /= argc - 1;
+    avgPlayback /= argc - 1;
+    avgPlaybackRTree /= argc - 1;
     SkDebugf("Average base recording time: %.3fms\n", avgRecord);
     SkDebugf("Average recording time with rtree: %.3fms\n", avgRecordRTree);
+    SkDebugf("Average base playback time: %.3fms\n", avgPlayback);
+    SkDebugf("Average playback time with rtree: %.3fms\n", avgPlaybackRTree);
+
     SkDebugf("\nWrote data to gnuplot-readable files: %s %s\n", pbTitle, recTitle);
 
     return 0;