aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-17 13:40:20 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-17 13:40:20 +0000
commit090601c9170b4157d141676344d15dad1931f441 (patch)
tree9a8cc4716cf5ea81ee04e86cb53a31e330e9b383 /tools
parent495dc860bf8d96b1c43b71f4f87627cb830aa1fe (diff)
Make bench_pictures' timing more GPU friendly
Diffstat (limited to 'tools')
-rw-r--r--tools/PictureBenchmark.cpp45
1 files changed, 32 insertions, 13 deletions
diff --git a/tools/PictureBenchmark.cpp b/tools/PictureBenchmark.cpp
index 155d097760..f4c4885510 100644
--- a/tools/PictureBenchmark.cpp
+++ b/tools/PictureBenchmark.cpp
@@ -170,30 +170,49 @@ void PictureBenchmark::run(SkPicture* pict) {
this->logProgress(longRunningResult.c_str());
}
} else {
- SkAutoTDelete<BenchTimer> timer(this->setupTimer());
- TimerData timerData(fRepeats);
+ SkAutoTDelete<BenchTimer> longRunningTimer(this->setupTimer());
+ TimerData longRunningTimerData(1);
+ SkAutoTDelete<BenchTimer> perRunTimer(this->setupTimer(false));
+ TimerData perRunTimerData(fRepeats);
+
+ longRunningTimer->start();
for (int i = 0; i < fRepeats; ++i) {
fRenderer->setup();
- timer->start();
+ perRunTimer->start();
fRenderer->render(NULL);
- timer->truncatedEnd();
-
- // Finishes gl context
- fRenderer->resetState(true);
- timer->end();
+ perRunTimer->truncatedEnd();
+ fRenderer->resetState(false);
+ perRunTimer->end();
- SkAssertResult(timerData.appendTimes(timer.get()));
+ SkAssertResult(perRunTimerData.appendTimes(perRunTimer.get()));
}
+ longRunningTimer->truncatedEnd();
+ fRenderer->resetState(true);
+ longRunningTimer->end();
+ SkAssertResult(longRunningTimerData.appendTimes(longRunningTimer.get()));
SkString configName = fRenderer->getConfigName();
- SkString result = timerData.getResult(timeFormat.c_str(),
- fTimerResult,
- configName.c_str(),
- timerTypes);
+ // Beware - since the per-run-timer doesn't ever include a glFinish it can
+ // report a lower time then the long-running-timer
+#if 0
+ SkString result = perRunTimerData.getResult(timeFormat.c_str(),
+ fTimerResult,
+ configName.c_str(),
+ timerTypes);
result.append("\n");
+
this->logProgress(result.c_str());
+#else
+ SkString result = longRunningTimerData.getResult(timeFormat.c_str(),
+ fTimerResult,
+ configName.c_str(),
+ timerTypes,
+ fRepeats);
+ result.append("\n");
+ this->logProgress(result.c_str());
+#endif
}
fRenderer->end();