Make bench_pictures' timing more GPU friendly

https://codereview.chromium.org/113873005/



git-svn-id: http://skia.googlecode.com/svn/trunk@12705 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
robertphillips@google.com 2013-12-17 13:40:20 +00:00
Родитель 495dc860bf
Коммит 090601c917
1 изменённых файлов: 32 добавлений и 13 удалений

Просмотреть файл

@ -170,30 +170,49 @@ void PictureBenchmark::run(SkPicture* pict) {
this->logProgress(longRunningResult.c_str()); this->logProgress(longRunningResult.c_str());
} }
} else { } else {
SkAutoTDelete<BenchTimer> timer(this->setupTimer()); SkAutoTDelete<BenchTimer> longRunningTimer(this->setupTimer());
TimerData timerData(fRepeats); TimerData longRunningTimerData(1);
SkAutoTDelete<BenchTimer> perRunTimer(this->setupTimer(false));
TimerData perRunTimerData(fRepeats);
longRunningTimer->start();
for (int i = 0; i < fRepeats; ++i) { for (int i = 0; i < fRepeats; ++i) {
fRenderer->setup(); fRenderer->setup();
timer->start(); perRunTimer->start();
fRenderer->render(NULL); fRenderer->render(NULL);
timer->truncatedEnd(); perRunTimer->truncatedEnd();
fRenderer->resetState(false);
perRunTimer->end();
// Finishes gl context SkAssertResult(perRunTimerData.appendTimes(perRunTimer.get()));
fRenderer->resetState(true);
timer->end();
SkAssertResult(timerData.appendTimes(timer.get()));
} }
longRunningTimer->truncatedEnd();
fRenderer->resetState(true);
longRunningTimer->end();
SkAssertResult(longRunningTimerData.appendTimes(longRunningTimer.get()));
SkString configName = fRenderer->getConfigName(); SkString configName = fRenderer->getConfigName();
SkString result = timerData.getResult(timeFormat.c_str(), // Beware - since the per-run-timer doesn't ever include a glFinish it can
fTimerResult, // report a lower time then the long-running-timer
configName.c_str(), #if 0
timerTypes); 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"); result.append("\n");
this->logProgress(result.c_str()); this->logProgress(result.c_str());
#endif
} }
fRenderer->end(); fRenderer->end();