Commit 5eebf3a7 by Jamie Madill Committed by Commit Bot

Perf Tests: Call finish every step in calibration.

Calibration is only supposed to take one second of warmup time. Instead we were queuing up a large amount of GPU work and then janking on the finish call at the end of calibration. Fix this by calling glFinish repeatedly during calibration. Bug: chromium:1136900 Change-Id: Idb2fefe17fcb9acbe688cff5a36f051732fc5b59 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2483462 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 8f57f60f
...@@ -213,7 +213,7 @@ void ANGLEPerfTest::run() ...@@ -213,7 +213,7 @@ void ANGLEPerfTest::run()
for (uint32_t trial = 0; trial < numTrials; ++trial) for (uint32_t trial = 0; trial < numTrials; ++trial)
{ {
doRunLoop(kMaximumRunTimeSeconds, mStepsToRun); doRunLoop(kMaximumRunTimeSeconds, mStepsToRun, RunLoopPolicy::RunContinuously);
printResults(); printResults();
if (gVerboseLogging) if (gVerboseLogging)
{ {
...@@ -258,7 +258,7 @@ void ANGLEPerfTest::setStepsPerRunLoopStep(int stepsPerRunLoop) ...@@ -258,7 +258,7 @@ void ANGLEPerfTest::setStepsPerRunLoopStep(int stepsPerRunLoop)
mStepsPerRunLoopStep = stepsPerRunLoop; mStepsPerRunLoopStep = stepsPerRunLoop;
} }
void ANGLEPerfTest::doRunLoop(double maxRunTime, int maxStepsToRun) void ANGLEPerfTest::doRunLoop(double maxRunTime, int maxStepsToRun, RunLoopPolicy runPolicy)
{ {
mNumStepsPerformed = 0; mNumStepsPerformed = 0;
mRunning = true; mRunning = true;
...@@ -269,6 +269,12 @@ void ANGLEPerfTest::doRunLoop(double maxRunTime, int maxStepsToRun) ...@@ -269,6 +269,12 @@ void ANGLEPerfTest::doRunLoop(double maxRunTime, int maxStepsToRun)
while (mRunning) while (mRunning)
{ {
step(); step();
if (runPolicy == RunLoopPolicy::FinishEveryStep)
{
glFinish();
}
if (mRunning) if (mRunning)
{ {
mNumStepsPerformed += mStepsPerRunLoopStep; mNumStepsPerformed += mStepsPerRunLoopStep;
...@@ -359,7 +365,7 @@ double ANGLEPerfTest::normalizedTime(size_t value) const ...@@ -359,7 +365,7 @@ double ANGLEPerfTest::normalizedTime(size_t value) const
void ANGLEPerfTest::calibrateStepsToRun() void ANGLEPerfTest::calibrateStepsToRun()
{ {
doRunLoop(gTestTimeSeconds, std::numeric_limits<int>::max()); doRunLoop(gTestTimeSeconds, std::numeric_limits<int>::max(), RunLoopPolicy::FinishEveryStep);
double elapsedTime = mTimer.getElapsedTime(); double elapsedTime = mTimer.getElapsedTime();
...@@ -633,7 +639,8 @@ void ANGLERenderTest::SetUp() ...@@ -633,7 +639,8 @@ void ANGLERenderTest::SetUp()
for (int loopIndex = 0; loopIndex < gWarmupLoops; ++loopIndex) for (int loopIndex = 0; loopIndex < gWarmupLoops; ++loopIndex)
{ {
doRunLoop(gTestTimeSeconds, std::numeric_limits<int>::max()); doRunLoop(gTestTimeSeconds, std::numeric_limits<int>::max(),
RunLoopPolicy::FinishEveryStep);
if (gVerboseLogging) if (gVerboseLogging)
{ {
printf("Warm-up loop took %.2lf seconds.\n", mTimer.getElapsedTime()); printf("Warm-up loop took %.2lf seconds.\n", mTimer.getElapsedTime());
......
...@@ -73,6 +73,12 @@ class ANGLEPerfTest : public testing::Test, angle::NonCopyable ...@@ -73,6 +73,12 @@ class ANGLEPerfTest : public testing::Test, angle::NonCopyable
virtual void flush() {} virtual void flush() {}
protected: protected:
enum class RunLoopPolicy
{
FinishEveryStep,
RunContinuously,
};
void run(); void run();
void SetUp() override; void SetUp() override;
void TearDown() override; void TearDown() override;
...@@ -87,7 +93,7 @@ class ANGLEPerfTest : public testing::Test, angle::NonCopyable ...@@ -87,7 +93,7 @@ class ANGLEPerfTest : public testing::Test, angle::NonCopyable
// Defaults to one step per run loop. Can be changed in any test. // Defaults to one step per run loop. Can be changed in any test.
void setStepsPerRunLoopStep(int stepsPerRunLoop); void setStepsPerRunLoopStep(int stepsPerRunLoop);
void doRunLoop(double maxRunTime, int maxStepsToRun); void doRunLoop(double maxRunTime, int maxStepsToRun, RunLoopPolicy runPolicy);
// Overriden in trace perf tests. // Overriden in trace perf tests.
virtual void saveScreenshot(const std::string &screenshotName) {} virtual void saveScreenshot(const std::string &screenshotName) {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment