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()
for (uint32_t trial = 0; trial < numTrials; ++trial)
{
doRunLoop(kMaximumRunTimeSeconds, mStepsToRun);
doRunLoop(kMaximumRunTimeSeconds, mStepsToRun, RunLoopPolicy::RunContinuously);
printResults();
if (gVerboseLogging)
{
......@@ -258,7 +258,7 @@ void ANGLEPerfTest::setStepsPerRunLoopStep(int stepsPerRunLoop)
mStepsPerRunLoopStep = stepsPerRunLoop;
}
void ANGLEPerfTest::doRunLoop(double maxRunTime, int maxStepsToRun)
void ANGLEPerfTest::doRunLoop(double maxRunTime, int maxStepsToRun, RunLoopPolicy runPolicy)
{
mNumStepsPerformed = 0;
mRunning = true;
......@@ -269,6 +269,12 @@ void ANGLEPerfTest::doRunLoop(double maxRunTime, int maxStepsToRun)
while (mRunning)
{
step();
if (runPolicy == RunLoopPolicy::FinishEveryStep)
{
glFinish();
}
if (mRunning)
{
mNumStepsPerformed += mStepsPerRunLoopStep;
......@@ -359,7 +365,7 @@ double ANGLEPerfTest::normalizedTime(size_t value) const
void ANGLEPerfTest::calibrateStepsToRun()
{
doRunLoop(gTestTimeSeconds, std::numeric_limits<int>::max());
doRunLoop(gTestTimeSeconds, std::numeric_limits<int>::max(), RunLoopPolicy::FinishEveryStep);
double elapsedTime = mTimer.getElapsedTime();
......@@ -633,7 +639,8 @@ void ANGLERenderTest::SetUp()
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)
{
printf("Warm-up loop took %.2lf seconds.\n", mTimer.getElapsedTime());
......
......@@ -73,6 +73,12 @@ class ANGLEPerfTest : public testing::Test, angle::NonCopyable
virtual void flush() {}
protected:
enum class RunLoopPolicy
{
FinishEveryStep,
RunContinuously,
};
void run();
void SetUp() override;
void TearDown() override;
......@@ -87,7 +93,7 @@ class ANGLEPerfTest : public testing::Test, angle::NonCopyable
// Defaults to one step per run loop. Can be changed in any test.
void setStepsPerRunLoopStep(int stepsPerRunLoop);
void doRunLoop(double maxRunTime, int maxStepsToRun);
void doRunLoop(double maxRunTime, int maxStepsToRun, RunLoopPolicy runPolicy);
// Overriden in trace perf tests.
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