Commit 4323ed0c by Jamie Madill Committed by Commit Bot

Perf Tests: Fix test time with max steps performed.

This lets the default test time be 10 minutes when using a maximum steps value. This will prevent the current 10 second limit from kicking in and aborting. Also changes the --test-time override to be more clearly a calibration time, and adds a new --test-time that lets the user override the actual trial test time. Bug: b/172480147 Change-Id: I630aa8d3c9e118bb5f0100b38f37e717e12f3538 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2523371Reviewed-by: 's avatarPaul Thomson <paulthomson@google.com> Reviewed-by: 's avatarCody Northrop <cnorthrop@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 6507c1ed
...@@ -40,7 +40,6 @@ constexpr size_t kInitialTraceEventBufferSize = 50000; ...@@ -40,7 +40,6 @@ constexpr size_t kInitialTraceEventBufferSize = 50000;
constexpr double kMilliSecondsPerSecond = 1e3; constexpr double kMilliSecondsPerSecond = 1e3;
constexpr double kMicroSecondsPerSecond = 1e6; constexpr double kMicroSecondsPerSecond = 1e6;
constexpr double kNanoSecondsPerSecond = 1e9; constexpr double kNanoSecondsPerSecond = 1e9;
constexpr double kMaximumRunTimeSeconds = 10.0;
struct TraceCategory struct TraceCategory
{ {
...@@ -220,7 +219,7 @@ void ANGLEPerfTest::run() ...@@ -220,7 +219,7 @@ void ANGLEPerfTest::run()
for (uint32_t trial = 0; trial < numTrials; ++trial) for (uint32_t trial = 0; trial < numTrials; ++trial)
{ {
doRunLoop(kMaximumRunTimeSeconds, mStepsToRun, RunLoopPolicy::RunContinuously); doRunLoop(gTestTimeSeconds, mStepsToRun, RunLoopPolicy::RunContinuously);
printResults(); printResults();
if (gVerboseLogging) if (gVerboseLogging)
{ {
...@@ -386,12 +385,13 @@ double ANGLEPerfTest::normalizedTime(size_t value) const ...@@ -386,12 +385,13 @@ double ANGLEPerfTest::normalizedTime(size_t value) const
void ANGLEPerfTest::calibrateStepsToRun() void ANGLEPerfTest::calibrateStepsToRun()
{ {
doRunLoop(gTestTimeSeconds, std::numeric_limits<int>::max(), RunLoopPolicy::FinishEveryStep); doRunLoop(gCalibrationTimeSeconds, std::numeric_limits<int>::max(),
RunLoopPolicy::FinishEveryStep);
double elapsedTime = mTimer.getElapsedTime(); double elapsedTime = mTimer.getElapsedTime();
// Scale steps down according to the time that exeeded one second. // Scale steps down according to the time that exeeded one second.
double scale = gTestTimeSeconds / elapsedTime; double scale = gCalibrationTimeSeconds / elapsedTime;
mStepsToRun = static_cast<unsigned int>(static_cast<double>(mTrialNumStepsPerformed) * scale); mStepsToRun = static_cast<unsigned int>(static_cast<double>(mTrialNumStepsPerformed) * scale);
mStepsToRun = std::max(1, mStepsToRun); mStepsToRun = std::max(1, mStepsToRun);
...@@ -667,7 +667,7 @@ void ANGLERenderTest::SetUp() ...@@ -667,7 +667,7 @@ 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(gCalibrationTimeSeconds, std::numeric_limits<int>::max(),
RunLoopPolicy::FinishEveryStep); RunLoopPolicy::FinishEveryStep);
if (gVerboseLogging) if (gVerboseLogging)
{ {
......
...@@ -13,18 +13,19 @@ ...@@ -13,18 +13,19 @@
namespace angle namespace angle
{ {
bool gCalibration = false; bool gCalibration = false;
int gStepsPerTrial = 0; int gStepsPerTrial = 0;
int gMaxStepsPerformed = 0; int gMaxStepsPerformed = 0;
bool gEnableTrace = false; bool gEnableTrace = false;
const char *gTraceFile = "ANGLETrace.json"; const char *gTraceFile = "ANGLETrace.json";
const char *gScreenShotDir = nullptr; const char *gScreenShotDir = nullptr;
bool gVerboseLogging = false; bool gVerboseLogging = false;
double gTestTimeSeconds = 1.0; double gCalibrationTimeSeconds = 1.0;
int gTestTrials = 3; double gTestTimeSeconds = 10.0;
bool gNoFinish = false; int gTestTrials = 3;
bool gEnableAllTraceTests = false; bool gNoFinish = false;
bool gStartTraceAfterSetup = false; bool gEnableAllTraceTests = false;
bool gStartTraceAfterSetup = false;
// Default to three warmup loops. There's no science to this. More than two loops was experimentally // Default to three warmup loops. There's no science to this. More than two loops was experimentally
// helpful on a Windows NVIDIA setup when testing with Vulkan and native trace tests. // helpful on a Windows NVIDIA setup when testing with Vulkan and native trace tests.
...@@ -85,6 +86,7 @@ void ANGLEProcessPerfTestArgs(int *argc, char **argv) ...@@ -85,6 +86,7 @@ void ANGLEProcessPerfTestArgs(int *argc, char **argv)
gMaxStepsPerformed = ReadIntArgument(argv[argIndex + 1]); gMaxStepsPerformed = ReadIntArgument(argv[argIndex + 1]);
gWarmupLoops = 0; gWarmupLoops = 0;
gTestTrials = 1; gTestTrials = 1;
gTestTimeSeconds = 36000;
// Skip an additional argument. // Skip an additional argument.
argIndex++; argIndex++;
} }
...@@ -112,6 +114,12 @@ void ANGLEProcessPerfTestArgs(int *argc, char **argv) ...@@ -112,6 +114,12 @@ void ANGLEProcessPerfTestArgs(int *argc, char **argv)
{ {
gScreenShotDir = argv[argIndex] + strlen(kRenderTestDirArg); gScreenShotDir = argv[argIndex] + strlen(kRenderTestDirArg);
} }
else if (strcmp("--calibration-time", argv[argIndex]) == 0)
{
gCalibrationTimeSeconds = ReadIntArgument(argv[argIndex + 1]);
// Skip an additional argument.
argIndex++;
}
else if (strcmp("--test-time", argv[argIndex]) == 0) else if (strcmp("--test-time", argv[argIndex]) == 0)
{ {
gTestTimeSeconds = ReadIntArgument(argv[argIndex + 1]); gTestTimeSeconds = ReadIntArgument(argv[argIndex + 1]);
......
...@@ -22,6 +22,7 @@ extern const char *gTraceFile; ...@@ -22,6 +22,7 @@ extern const char *gTraceFile;
extern const char *gScreenShotDir; extern const char *gScreenShotDir;
extern bool gVerboseLogging; extern bool gVerboseLogging;
extern int gWarmupLoops; extern int gWarmupLoops;
extern double gCalibrationTimeSeconds;
extern double gTestTimeSeconds; extern double gTestTimeSeconds;
extern int gTestTrials; extern int gTestTrials;
extern bool gNoFinish; extern bool gNoFinish;
......
...@@ -33,7 +33,8 @@ Several command-line arguments control how the tests run: ...@@ -33,7 +33,8 @@ Several command-line arguments control how the tests run:
* `--verbose`: Print extra timing information. * `--verbose`: Print extra timing information.
* `--warmup-loops x`: Number of times to warm up the test before starting timing. Defaults to 3. * `--warmup-loops x`: Number of times to warm up the test before starting timing. Defaults to 3.
* `--no-warmup`: Skip warming up the tests. Equivalent to `--warmup-steps 0`. * `--no-warmup`: Skip warming up the tests. Equivalent to `--warmup-steps 0`.
* `--test-time`: Run each test trial in a fixed time. Defaults to 1 second. * `--calibration-time`: Run each test calibration step in a fixed time. Defaults to 1 second.
* `--test-time`: Run each test trial in a fixed time. Defaults to 10 seconds.
* `--trials`: Number of times to repeat testing. Defaults to 3. * `--trials`: Number of times to repeat testing. Defaults to 3.
* `--no-finish`: Don't call glFinish after each test trial. * `--no-finish`: Don't call glFinish after each test trial.
* `--enable-all-trace-tests`: Offscreen and vsync-limited trace tests are disabled by default to reduce test time. * `--enable-all-trace-tests`: Offscreen and vsync-limited trace tests are disabled by default to reduce test time.
......
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