Commit 2f4a7518 by Brian Sheedy Committed by Commit Bot

Refactor perf tests to fix metric/story swapping

Refactors the perf tests to fix the issue of metric and story being swapped, which causes issues when trying to convert to histograms. Specifically, does the following: 1. Rolls the version of src/tests/perf_tests/third_party/perf/ to Chromium 476dae823269c8d05b544271af97ad1adb0db8ee 2. Switch to using PerfResultReporter instead of PrintResult directly. 3. Split RenderTestParams::suffix into backend and story; backend is used as part of the metric, while story is used as the story. 4. Remove the "average" metric that was being automatically reported by ANGLEPerfTest, as reported results are automatically averaged. 5. Update the reported metric to more clearly distinguish between test, backend, and metric. It is now name_backend.metric. e.g. DrawCallPerf_vulkan.wall_time. Bug: chromium:923564,chromium:924618 Change-Id: I00cc191407052f23df57dbfa53b6fb088fc26960 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1762360 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com>
parent e2ea45ba
...@@ -117,9 +117,11 @@ def get_results(metric, extra_args=[]): ...@@ -117,9 +117,11 @@ def get_results(metric, extra_args=[]):
print(output) print(output)
sys.exit(3) sys.exit(3)
pattern = metric + r'= ([0-9.]+)' # Results are reported in the format:
# name_backend.metric: story= value units.
pattern = r'\.' + metric + r':.*= ([0-9.]+)'
m = re.findall(pattern, output) m = re.findall(pattern, output)
if m is None: if not m:
print("Did not find the metric '%s' in the test output:" % metric) print("Did not find the metric '%s' in the test output:" % metric)
print(output) print(output)
sys.exit(1) sys.exit(1)
......
...@@ -8,6 +8,8 @@ _angle_perf_test_common_sources = [ ...@@ -8,6 +8,8 @@ _angle_perf_test_common_sources = [
"perf_tests/ANGLEPerfTest.h", "perf_tests/ANGLEPerfTest.h",
"perf_tests/ANGLEPerfTestArgs.cpp", "perf_tests/ANGLEPerfTestArgs.cpp",
"perf_tests/ANGLEPerfTestArgs.h", "perf_tests/ANGLEPerfTestArgs.h",
"perf_tests/third_party/perf/perf_result_reporter.cc",
"perf_tests/third_party/perf/perf_result_reporter.h",
"perf_tests/third_party/perf/perf_test.cc", "perf_tests/third_party/perf/perf_test.cc",
"perf_tests/third_party/perf/perf_test.h", "perf_tests/third_party/perf/perf_test.h",
"test_utils/angle_test_configs.cpp", "test_utils/angle_test_configs.cpp",
......
...@@ -159,10 +159,12 @@ void DumpTraceEventsToJSONFile(const std::vector<TraceEvent> &traceEvents, ...@@ -159,10 +159,12 @@ void DumpTraceEventsToJSONFile(const std::vector<TraceEvent> &traceEvents,
} // anonymous namespace } // anonymous namespace
ANGLEPerfTest::ANGLEPerfTest(const std::string &name, ANGLEPerfTest::ANGLEPerfTest(const std::string &name,
const std::string &suffix, const std::string &backend,
const std::string &story,
unsigned int iterationsPerStep) unsigned int iterationsPerStep)
: mName(name), : mName(name),
mSuffix(suffix), mBackend(backend),
mStory(story),
mTimer(CreateTimer()), mTimer(CreateTimer()),
mGPUTimeNs(0), mGPUTimeNs(0),
mSkipTest(false), mSkipTest(false),
...@@ -170,7 +172,20 @@ ANGLEPerfTest::ANGLEPerfTest(const std::string &name, ...@@ -170,7 +172,20 @@ ANGLEPerfTest::ANGLEPerfTest(const std::string &name,
mNumStepsPerformed(0), mNumStepsPerformed(0),
mIterationsPerStep(iterationsPerStep), mIterationsPerStep(iterationsPerStep),
mRunning(true) mRunning(true)
{} {
if (mStory == "")
{
mStory = "baseline_story";
}
if (mStory[0] == '_')
{
mStory = mStory.substr(1);
}
mReporter = std::make_unique<perf_test::PerfResultReporter>(mName + mBackend, mStory);
mReporter->RegisterImportantMetric(".wall_time", "ns");
mReporter->RegisterImportantMetric(".gpu_time", "ns");
mReporter->RegisterFyiMetric(".steps", "count");
}
ANGLEPerfTest::~ANGLEPerfTest() ANGLEPerfTest::~ANGLEPerfTest()
{ {
...@@ -196,7 +211,7 @@ void ANGLEPerfTest::run() ...@@ -196,7 +211,7 @@ void ANGLEPerfTest::run()
// Calibration allows the perf test runner script to save some time. // Calibration allows the perf test runner script to save some time.
if (gCalibration) if (gCalibration)
{ {
printResult("steps", static_cast<size_t>(mStepsToRun), "count", false); mReporter->AddResult(".steps", static_cast<size_t>(mStepsToRun));
return; return;
} }
} }
...@@ -214,10 +229,6 @@ void ANGLEPerfTest::run() ...@@ -214,10 +229,6 @@ void ANGLEPerfTest::run()
doRunLoop(kMaximumRunTimeSeconds); doRunLoop(kMaximumRunTimeSeconds);
totalTime += printResults(); totalTime += printResults();
} }
double average = totalTime / kNumTrials;
std::ostringstream averageString;
averageString << "for " << kNumTrials << " runs";
printResult("average", average, averageString.str(), false);
} }
void ANGLEPerfTest::doRunLoop(double maxRunTime) void ANGLEPerfTest::doRunLoop(double maxRunTime)
...@@ -247,22 +258,6 @@ void ANGLEPerfTest::doRunLoop(double maxRunTime) ...@@ -247,22 +258,6 @@ void ANGLEPerfTest::doRunLoop(double maxRunTime)
mTimer->stop(); mTimer->stop();
} }
void ANGLEPerfTest::printResult(const std::string &trace,
double value,
const std::string &units,
bool important) const
{
perf_test::PrintResult(mName, mSuffix, trace, value, units, important);
}
void ANGLEPerfTest::printResult(const std::string &trace,
size_t value,
const std::string &units,
bool important) const
{
perf_test::PrintResult(mName, mSuffix, trace, value, units, important);
}
void ANGLEPerfTest::SetUp() {} void ANGLEPerfTest::SetUp() {}
void ANGLEPerfTest::TearDown() {} void ANGLEPerfTest::TearDown() {}
...@@ -275,8 +270,8 @@ double ANGLEPerfTest::printResults() ...@@ -275,8 +270,8 @@ double ANGLEPerfTest::printResults()
}; };
const char *clockNames[2] = { const char *clockNames[2] = {
"wall_time", ".wall_time",
"gpu_time", ".gpu_time",
}; };
// If measured gpu time is non-zero, print that too. // If measured gpu time is non-zero, print that too.
...@@ -288,19 +283,29 @@ double ANGLEPerfTest::printResults() ...@@ -288,19 +283,29 @@ double ANGLEPerfTest::printResults()
double secondsPerStep = elapsedTimeSeconds[i] / static_cast<double>(mNumStepsPerformed); double secondsPerStep = elapsedTimeSeconds[i] / static_cast<double>(mNumStepsPerformed);
double secondsPerIteration = secondsPerStep / static_cast<double>(mIterationsPerStep); double secondsPerIteration = secondsPerStep / static_cast<double>(mIterationsPerStep);
// Give the result a different name to ensure separate graphs if we transition. perf_test::MetricInfo metricInfo;
if (secondsPerIteration > 1e-3) std::string units;
// Lazily register the metric, re-using the existing units if it is
// already registered.
if (!mReporter->GetMetricInfo(clockNames[i], &metricInfo))
{ {
double microSecondsPerIteration = secondsPerIteration * kMicroSecondsPerSecond; units = secondsPerIteration > 1e-3 ? "us" : "ns";
retValue = microSecondsPerIteration; mReporter->RegisterImportantMetric(clockNames[i], units);
printResult(clockNames[i], microSecondsPerIteration, "us", true);
} }
else else
{ {
double nanoSecPerIteration = secondsPerIteration * kNanoSecondsPerSecond; units = metricInfo.units;
retValue = nanoSecPerIteration;
printResult(clockNames[i], nanoSecPerIteration, "ns", true);
} }
if (units == "us")
{
retValue = secondsPerIteration * kMicroSecondsPerSecond;
}
else
{
retValue = secondsPerIteration * kNanoSecondsPerSecond;
}
mReporter->AddResult(clockNames[i], retValue);
} }
return retValue; return retValue;
} }
...@@ -310,7 +315,7 @@ double ANGLEPerfTest::normalizedTime(size_t value) const ...@@ -310,7 +315,7 @@ double ANGLEPerfTest::normalizedTime(size_t value) const
return static_cast<double>(value) / static_cast<double>(mNumStepsPerformed); return static_cast<double>(value) / static_cast<double>(mNumStepsPerformed);
} }
std::string RenderTestParams::suffix() const std::string RenderTestParams::backend() const
{ {
std::stringstream strstr; std::stringstream strstr;
...@@ -360,8 +365,21 @@ std::string RenderTestParams::suffix() const ...@@ -360,8 +365,21 @@ std::string RenderTestParams::suffix() const
return strstr.str(); return strstr.str();
} }
std::string RenderTestParams::story() const
{
return "";
}
std::string RenderTestParams::backendAndStory() const
{
return backend() + story();
}
ANGLERenderTest::ANGLERenderTest(const std::string &name, const RenderTestParams &testParams) ANGLERenderTest::ANGLERenderTest(const std::string &name, const RenderTestParams &testParams)
: ANGLEPerfTest(name, testParams.suffix(), OneFrame() ? 1 : testParams.iterationsPerStep), : ANGLEPerfTest(name,
testParams.backend(),
testParams.story(),
OneFrame() ? 1 : testParams.iterationsPerStep),
mTestParams(testParams), mTestParams(testParams),
mGLWindow(nullptr), mGLWindow(nullptr),
mOSWindow(nullptr) mOSWindow(nullptr)
......
...@@ -13,11 +13,13 @@ ...@@ -13,11 +13,13 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <string> #include <string>
#include <unordered_map>
#include <vector> #include <vector>
#include "platform/Platform.h" #include "platform/Platform.h"
#include "test_utils/angle_test_configs.h" #include "test_utils/angle_test_configs.h"
#include "test_utils/angle_test_instantiate.h" #include "test_utils/angle_test_instantiate.h"
#include "third_party/perf/perf_result_reporter.h"
#include "util/EGLWindow.h" #include "util/EGLWindow.h"
#include "util/OSWindow.h" #include "util/OSWindow.h"
#include "util/Timer.h" #include "util/Timer.h"
...@@ -55,7 +57,8 @@ class ANGLEPerfTest : public testing::Test, angle::NonCopyable ...@@ -55,7 +57,8 @@ class ANGLEPerfTest : public testing::Test, angle::NonCopyable
{ {
public: public:
ANGLEPerfTest(const std::string &name, ANGLEPerfTest(const std::string &name,
const std::string &suffix, const std::string &backend,
const std::string &story,
unsigned int iterationsPerStep); unsigned int iterationsPerStep);
virtual ~ANGLEPerfTest(); virtual ~ANGLEPerfTest();
...@@ -70,14 +73,6 @@ class ANGLEPerfTest : public testing::Test, angle::NonCopyable ...@@ -70,14 +73,6 @@ class ANGLEPerfTest : public testing::Test, angle::NonCopyable
protected: protected:
void run(); void run();
void printResult(const std::string &trace,
double value,
const std::string &units,
bool important) const;
void printResult(const std::string &trace,
size_t value,
const std::string &units,
bool important) const;
void SetUp() override; void SetUp() override;
void TearDown() override; void TearDown() override;
...@@ -91,10 +86,12 @@ class ANGLEPerfTest : public testing::Test, angle::NonCopyable ...@@ -91,10 +86,12 @@ class ANGLEPerfTest : public testing::Test, angle::NonCopyable
void doRunLoop(double maxRunTime); void doRunLoop(double maxRunTime);
std::string mName; std::string mName;
std::string mSuffix; std::string mBackend;
std::string mStory;
Timer *mTimer; Timer *mTimer;
uint64_t mGPUTimeNs; uint64_t mGPUTimeNs;
bool mSkipTest; bool mSkipTest;
std::unique_ptr<perf_test::PerfResultReporter> mReporter;
private: private:
double printResults(); double printResults();
...@@ -109,7 +106,9 @@ struct RenderTestParams : public angle::PlatformParameters ...@@ -109,7 +106,9 @@ struct RenderTestParams : public angle::PlatformParameters
{ {
virtual ~RenderTestParams() {} virtual ~RenderTestParams() {}
virtual std::string suffix() const; virtual std::string backend() const;
virtual std::string story() const;
std::string backendAndStory() const;
EGLint windowWidth = 64; EGLint windowWidth = 64;
EGLint windowHeight = 64; EGLint windowHeight = 64;
......
...@@ -41,22 +41,22 @@ struct BindingsParams final : public RenderTestParams ...@@ -41,22 +41,22 @@ struct BindingsParams final : public RenderTestParams
iterationsPerStep = kIterationsPerStep; iterationsPerStep = kIterationsPerStep;
} }
std::string suffix() const override; std::string story() const override;
size_t numObjects; size_t numObjects;
AllocationStyle allocationStyle; AllocationStyle allocationStyle;
}; };
std::ostream &operator<<(std::ostream &os, const BindingsParams &params) std::ostream &operator<<(std::ostream &os, const BindingsParams &params)
{ {
os << params.suffix().substr(1); os << params.backendAndStory().substr(1);
return os; return os;
} }
std::string BindingsParams::suffix() const std::string BindingsParams::story() const
{ {
std::stringstream strstr; std::stringstream strstr;
strstr << RenderTestParams::suffix(); strstr << RenderTestParams::story();
strstr << "_" << numObjects << "_objects"; strstr << "_" << numObjects << "_objects";
switch (allocationStyle) switch (allocationStyle)
......
...@@ -30,7 +30,8 @@ class BitSetIteratorPerfTest : public ANGLEPerfTest ...@@ -30,7 +30,8 @@ class BitSetIteratorPerfTest : public ANGLEPerfTest
}; };
template <typename T> template <typename T>
BitSetIteratorPerfTest<T>::BitSetIteratorPerfTest() : ANGLEPerfTest("BitSetIteratorPerf", "_run", 1) BitSetIteratorPerfTest<T>::BitSetIteratorPerfTest()
: ANGLEPerfTest("BitSetIteratorPerf", "", "_run", 1)
{} {}
template <typename T> template <typename T>
......
...@@ -103,16 +103,16 @@ struct BlitFramebufferParams final : public RenderTestParams ...@@ -103,16 +103,16 @@ struct BlitFramebufferParams final : public RenderTestParams
windowHeight = 256; windowHeight = 256;
} }
std::string suffix() const override std::string story() const override
{ {
std::stringstream suffixStr; std::stringstream storyStr;
suffixStr << RenderTestParams::suffix(); storyStr << RenderTestParams::story();
suffixStr << "_" << BufferTypeString(type); storyStr << "_" << BufferTypeString(type);
if (samples > 1) if (samples > 1)
{ {
suffixStr << "_" << samples << "_samples"; storyStr << "_" << samples << "_samples";
} }
return suffixStr.str(); return storyStr.str();
} }
BufferType type = BufferType::COLOR; BufferType type = BufferType::COLOR;
...@@ -122,7 +122,7 @@ struct BlitFramebufferParams final : public RenderTestParams ...@@ -122,7 +122,7 @@ struct BlitFramebufferParams final : public RenderTestParams
std::ostream &operator<<(std::ostream &os, const BlitFramebufferParams &params) std::ostream &operator<<(std::ostream &os, const BlitFramebufferParams &params)
{ {
os << params.suffix().substr(1); os << params.backendAndStory().substr(1);
return os; return os;
} }
......
...@@ -33,7 +33,7 @@ struct BufferSubDataParams final : public RenderTestParams ...@@ -33,7 +33,7 @@ struct BufferSubDataParams final : public RenderTestParams
updateRate = 1; updateRate = 1;
} }
std::string suffix() const override; std::string story() const override;
GLboolean vertexNormalized; GLboolean vertexNormalized;
GLenum vertexType; GLenum vertexType;
...@@ -47,7 +47,7 @@ struct BufferSubDataParams final : public RenderTestParams ...@@ -47,7 +47,7 @@ struct BufferSubDataParams final : public RenderTestParams
std::ostream &operator<<(std::ostream &os, const BufferSubDataParams &params) std::ostream &operator<<(std::ostream &os, const BufferSubDataParams &params)
{ {
os << params.suffix().substr(1); os << params.backendAndStory().substr(1);
return os; return os;
} }
...@@ -203,11 +203,11 @@ GLsizeiptr GetVertexData(GLenum type, ...@@ -203,11 +203,11 @@ GLsizeiptr GetVertexData(GLenum type,
return triDataSize; return triDataSize;
} }
std::string BufferSubDataParams::suffix() const std::string BufferSubDataParams::story() const
{ {
std::stringstream strstr; std::stringstream strstr;
strstr << RenderTestParams::suffix(); strstr << RenderTestParams::story();
if (vertexNormalized) if (vertexNormalized)
{ {
......
...@@ -33,7 +33,7 @@ struct ClearParams final : public RenderTestParams ...@@ -33,7 +33,7 @@ struct ClearParams final : public RenderTestParams
textureSize = 16; textureSize = 16;
} }
std::string suffix() const override; std::string story() const override;
GLsizei fboSize; GLsizei fboSize;
GLsizei textureSize; GLsizei textureSize;
...@@ -41,15 +41,15 @@ struct ClearParams final : public RenderTestParams ...@@ -41,15 +41,15 @@ struct ClearParams final : public RenderTestParams
std::ostream &operator<<(std::ostream &os, const ClearParams &params) std::ostream &operator<<(std::ostream &os, const ClearParams &params)
{ {
os << params.suffix().substr(1); os << params.backendAndStory().substr(1);
return os; return os;
} }
std::string ClearParams::suffix() const std::string ClearParams::story() const
{ {
std::stringstream strstr; std::stringstream strstr;
strstr << RenderTestParams::suffix(); strstr << RenderTestParams::story();
return strstr.str(); return strstr.str();
} }
......
...@@ -264,7 +264,7 @@ class CompilerPerfTest : public ANGLEPerfTest, ...@@ -264,7 +264,7 @@ class CompilerPerfTest : public ANGLEPerfTest,
}; };
CompilerPerfTest::CompilerPerfTest() CompilerPerfTest::CompilerPerfTest()
: ANGLEPerfTest("CompilerPerf", GetParam().testId, kNumIterationsPerStep) : ANGLEPerfTest("CompilerPerf", "", GetParam().testId, kNumIterationsPerStep)
{} {}
void CompilerPerfTest::SetUp() void CompilerPerfTest::SetUp()
......
...@@ -23,7 +23,7 @@ struct DispatchComputePerfParams final : public RenderTestParams ...@@ -23,7 +23,7 @@ struct DispatchComputePerfParams final : public RenderTestParams
minorVersion = 1; minorVersion = 1;
} }
std::string suffix() const override; std::string story() const override;
unsigned int localSizeX = 16; unsigned int localSizeX = 16;
unsigned int localSizeY = 16; unsigned int localSizeY = 16;
...@@ -31,21 +31,21 @@ struct DispatchComputePerfParams final : public RenderTestParams ...@@ -31,21 +31,21 @@ struct DispatchComputePerfParams final : public RenderTestParams
unsigned int textureHeight = 32; unsigned int textureHeight = 32;
}; };
std::string DispatchComputePerfParams::suffix() const std::string DispatchComputePerfParams::story() const
{ {
std::stringstream suffixStr; std::stringstream storyStr;
suffixStr << RenderTestParams::suffix(); storyStr << RenderTestParams::story();
if (eglParameters.deviceType == EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE) if (eglParameters.deviceType == EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE)
{ {
suffixStr << "_null"; storyStr << "_null";
} }
return suffixStr.str(); return storyStr.str();
} }
std::ostream &operator<<(std::ostream &os, const DispatchComputePerfParams &params) std::ostream &operator<<(std::ostream &os, const DispatchComputePerfParams &params)
{ {
os << params.suffix().substr(1); os << params.backendAndStory().substr(1);
return os; return os;
} }
......
...@@ -27,16 +27,16 @@ struct DrawArraysPerfParams : public DrawCallPerfParams ...@@ -27,16 +27,16 @@ struct DrawArraysPerfParams : public DrawCallPerfParams
{ {
DrawArraysPerfParams(const DrawCallPerfParams &base) : DrawCallPerfParams(base) {} DrawArraysPerfParams(const DrawCallPerfParams &base) : DrawCallPerfParams(base) {}
std::string suffix() const override; std::string story() const override;
StateChange stateChange = StateChange::NoChange; StateChange stateChange = StateChange::NoChange;
}; };
std::string DrawArraysPerfParams::suffix() const std::string DrawArraysPerfParams::story() const
{ {
std::stringstream strstr; std::stringstream strstr;
strstr << DrawCallPerfParams::suffix(); strstr << DrawCallPerfParams::story();
switch (stateChange) switch (stateChange)
{ {
...@@ -61,7 +61,7 @@ std::string DrawArraysPerfParams::suffix() const ...@@ -61,7 +61,7 @@ std::string DrawArraysPerfParams::suffix() const
std::ostream &operator<<(std::ostream &os, const DrawArraysPerfParams &params) std::ostream &operator<<(std::ostream &os, const DrawArraysPerfParams &params)
{ {
os << params.suffix().substr(1); os << params.backendAndStory().substr(1);
return os; return os;
} }
......
...@@ -31,11 +31,11 @@ DrawCallPerfParams::DrawCallPerfParams() ...@@ -31,11 +31,11 @@ DrawCallPerfParams::DrawCallPerfParams()
DrawCallPerfParams::~DrawCallPerfParams() = default; DrawCallPerfParams::~DrawCallPerfParams() = default;
std::string DrawCallPerfParams::suffix() const std::string DrawCallPerfParams::story() const
{ {
std::stringstream strstr; std::stringstream strstr;
strstr << RenderTestParams::suffix(); strstr << RenderTestParams::story();
if (numTris == 0) if (numTris == 0)
{ {
......
...@@ -20,7 +20,7 @@ struct DrawCallPerfParams : public RenderTestParams ...@@ -20,7 +20,7 @@ struct DrawCallPerfParams : public RenderTestParams
DrawCallPerfParams(); DrawCallPerfParams();
virtual ~DrawCallPerfParams(); virtual ~DrawCallPerfParams();
std::string suffix() const override; std::string story() const override;
double runTimeSeconds; double runTimeSeconds;
int numTris; int numTris;
......
...@@ -35,11 +35,11 @@ struct DrawElementsPerfParams final : public DrawCallPerfParams ...@@ -35,11 +35,11 @@ struct DrawElementsPerfParams final : public DrawCallPerfParams
numTris = 2; numTris = 2;
} }
std::string suffix() const override std::string story() const override
{ {
std::stringstream strstr; std::stringstream strstr;
strstr << DrawCallPerfParams::suffix(); strstr << DrawCallPerfParams::story();
if (indexBufferChanged) if (indexBufferChanged)
{ {
...@@ -60,7 +60,7 @@ struct DrawElementsPerfParams final : public DrawCallPerfParams ...@@ -60,7 +60,7 @@ struct DrawElementsPerfParams final : public DrawCallPerfParams
std::ostream &operator<<(std::ostream &os, const DrawElementsPerfParams &params) std::ostream &operator<<(std::ostream &os, const DrawElementsPerfParams &params)
{ {
os << params.suffix().substr(1); os << params.backendAndStory().substr(1);
return os; return os;
} }
......
...@@ -24,19 +24,19 @@ struct DynamicPromotionParams final : public RenderTestParams ...@@ -24,19 +24,19 @@ struct DynamicPromotionParams final : public RenderTestParams
{ {
DynamicPromotionParams() { iterationsPerStep = kIterationsPerStep; } DynamicPromotionParams() { iterationsPerStep = kIterationsPerStep; }
std::string suffix() const override; std::string story() const override;
size_t vertexCount = 1024; size_t vertexCount = 1024;
}; };
std::string DynamicPromotionParams::suffix() const std::string DynamicPromotionParams::story() const
{ {
return RenderTestParams::suffix(); return RenderTestParams::story();
} }
std::ostream &operator<<(std::ostream &os, const DynamicPromotionParams &params) std::ostream &operator<<(std::ostream &os, const DynamicPromotionParams &params)
{ {
os << params.suffix().substr(1); os << params.backendAndStory().substr(1);
return os; return os;
} }
......
...@@ -75,7 +75,7 @@ class EGLInitializePerfTest : public ANGLEPerfTest, ...@@ -75,7 +75,7 @@ class EGLInitializePerfTest : public ANGLEPerfTest,
}; };
EGLInitializePerfTest::EGLInitializePerfTest() EGLInitializePerfTest::EGLInitializePerfTest()
: ANGLEPerfTest("EGLInitialize", "_run", 1), mOSWindow(nullptr), mDisplay(EGL_NO_DISPLAY) : ANGLEPerfTest("EGLInitialize", "", "_run", 1), mOSWindow(nullptr), mDisplay(EGL_NO_DISPLAY)
{ {
auto platform = GetParam().eglParameters; auto platform = GetParam().eglParameters;
...@@ -121,6 +121,10 @@ void EGLInitializePerfTest::SetUp() ...@@ -121,6 +121,10 @@ void EGLInitializePerfTest::SetUp()
platformMethods->currentTime = CapturePlatform_currentTime; platformMethods->currentTime = CapturePlatform_currentTime;
platformMethods->histogramCustomCounts = CapturePlatform_histogramCustomCounts; platformMethods->histogramCustomCounts = CapturePlatform_histogramCustomCounts;
mReporter->RegisterImportantMetric(".LoadDLLs", "ms");
mReporter->RegisterImportantMetric(".D3D11CreateDevice", "ms");
mReporter->RegisterImportantMetric(".InitResources", "ms");
} }
EGLInitializePerfTest::~EGLInitializePerfTest() EGLInitializePerfTest::~EGLInitializePerfTest()
...@@ -141,9 +145,9 @@ void EGLInitializePerfTest::step() ...@@ -141,9 +145,9 @@ void EGLInitializePerfTest::step()
void EGLInitializePerfTest::TearDown() void EGLInitializePerfTest::TearDown()
{ {
ANGLEPerfTest::TearDown(); ANGLEPerfTest::TearDown();
printResult("LoadDLLs", normalizedTime(mCaptures.loadDLLsMS), "ms", true); mReporter->AddResult(".LoadDLLs", normalizedTime(mCaptures.loadDLLsMS));
printResult("D3D11CreateDevice", normalizedTime(mCaptures.createDeviceMS), "ms", true); mReporter->AddResult(".D3D11CreateDevice", normalizedTime(mCaptures.createDeviceMS));
printResult("InitResources", normalizedTime(mCaptures.initResourcesMS), "ms", true); mReporter->AddResult(".InitResources", normalizedTime(mCaptures.initResourcesMS));
ANGLEResetDisplayPlatform(mDisplay); ANGLEResetDisplayPlatform(mDisplay);
} }
......
...@@ -40,7 +40,7 @@ class EGLMakeCurrentPerfTest : public ANGLEPerfTest, ...@@ -40,7 +40,7 @@ class EGLMakeCurrentPerfTest : public ANGLEPerfTest,
}; };
EGLMakeCurrentPerfTest::EGLMakeCurrentPerfTest() EGLMakeCurrentPerfTest::EGLMakeCurrentPerfTest()
: ANGLEPerfTest("EGLMakeCurrent", "_run", ITERATIONS), : ANGLEPerfTest("EGLMakeCurrent", "", "_run", ITERATIONS),
mOSWindow(nullptr), mOSWindow(nullptr),
mDisplay(EGL_NO_DISPLAY), mDisplay(EGL_NO_DISPLAY),
mSurface(EGL_NO_SURFACE), mSurface(EGL_NO_SURFACE),
......
...@@ -18,7 +18,7 @@ namespace ...@@ -18,7 +18,7 @@ namespace
{ {
struct IndexConversionPerfParams final : public RenderTestParams struct IndexConversionPerfParams final : public RenderTestParams
{ {
std::string suffix() const override std::string story() const override
{ {
std::stringstream strstr; std::stringstream strstr;
...@@ -27,7 +27,7 @@ struct IndexConversionPerfParams final : public RenderTestParams ...@@ -27,7 +27,7 @@ struct IndexConversionPerfParams final : public RenderTestParams
strstr << "_index_range"; strstr << "_index_range";
} }
strstr << RenderTestParams::suffix(); strstr << RenderTestParams::story();
return strstr.str(); return strstr.str();
} }
...@@ -41,7 +41,7 @@ struct IndexConversionPerfParams final : public RenderTestParams ...@@ -41,7 +41,7 @@ struct IndexConversionPerfParams final : public RenderTestParams
// Provide a custom gtest parameter name function for IndexConversionPerfParams. // Provide a custom gtest parameter name function for IndexConversionPerfParams.
std::ostream &operator<<(std::ostream &stream, const IndexConversionPerfParams &param) std::ostream &operator<<(std::ostream &stream, const IndexConversionPerfParams &param)
{ {
stream << param.suffix().substr(1); stream << param.backendAndStory().substr(1);
return stream; return stream;
} }
......
...@@ -158,7 +158,7 @@ class IndexDataManagerPerfTest : public ANGLEPerfTest ...@@ -158,7 +158,7 @@ class IndexDataManagerPerfTest : public ANGLEPerfTest
}; };
IndexDataManagerPerfTest::IndexDataManagerPerfTest() IndexDataManagerPerfTest::IndexDataManagerPerfTest()
: ANGLEPerfTest("IndexDataManger", "_run", kIterationsPerStep), : ANGLEPerfTest("IndexDataManager", "", "_run", kIterationsPerStep),
mIndexDataManager(&mMockBufferFactory), mIndexDataManager(&mMockBufferFactory),
mIndexCount(4000), mIndexCount(4000),
mBufferSize(mIndexCount * sizeof(GLushort)), mBufferSize(mIndexCount * sizeof(GLushort)),
......
...@@ -56,11 +56,11 @@ struct InstancingPerfParams final : public RenderTestParams ...@@ -56,11 +56,11 @@ struct InstancingPerfParams final : public RenderTestParams
instancingEnabled = true; instancingEnabled = true;
} }
std::string suffix() const override std::string story() const override
{ {
std::stringstream strstr; std::stringstream strstr;
strstr << RenderTestParams::suffix(); strstr << RenderTestParams::story();
if (!instancingEnabled) if (!instancingEnabled)
{ {
...@@ -77,7 +77,7 @@ struct InstancingPerfParams final : public RenderTestParams ...@@ -77,7 +77,7 @@ struct InstancingPerfParams final : public RenderTestParams
std::ostream &operator<<(std::ostream &os, const InstancingPerfParams &params) std::ostream &operator<<(std::ostream &os, const InstancingPerfParams &params)
{ {
os << params.suffix().substr(1); os << params.backendAndStory().substr(1);
return os; return os;
} }
......
...@@ -37,7 +37,7 @@ struct InterleavedAttributeDataParams final : public RenderTestParams ...@@ -37,7 +37,7 @@ struct InterleavedAttributeDataParams final : public RenderTestParams
std::ostream &operator<<(std::ostream &os, const InterleavedAttributeDataParams &params) std::ostream &operator<<(std::ostream &os, const InterleavedAttributeDataParams &params)
{ {
os << params.suffix().substr(1); os << params.backendAndStory().substr(1);
if (params.eglParameters.majorVersion != EGL_DONT_CARE) if (params.eglParameters.majorVersion != EGL_DONT_CARE)
{ {
......
...@@ -49,10 +49,10 @@ struct LinkProgramParams final : public RenderTestParams ...@@ -49,10 +49,10 @@ struct LinkProgramParams final : public RenderTestParams
threadOption = threadOptionIn; threadOption = threadOptionIn;
} }
std::string suffix() const override std::string story() const override
{ {
std::stringstream strstr; std::stringstream strstr;
strstr << RenderTestParams::suffix(); strstr << RenderTestParams::story();
if (taskOption == TaskOption::CompileOnly) if (taskOption == TaskOption::CompileOnly)
{ {
...@@ -86,7 +86,7 @@ struct LinkProgramParams final : public RenderTestParams ...@@ -86,7 +86,7 @@ struct LinkProgramParams final : public RenderTestParams
std::ostream &operator<<(std::ostream &os, const LinkProgramParams &params) std::ostream &operator<<(std::ostream &os, const LinkProgramParams &params)
{ {
os << params.suffix().substr(1); os << params.backendAndStory().substr(1);
return os; return os;
} }
......
...@@ -90,9 +90,9 @@ struct MultiviewPerfParams final : public RenderTestParams ...@@ -90,9 +90,9 @@ struct MultiviewPerfParams final : public RenderTestParams
multiviewExtension = multiviewExtensionIn; multiviewExtension = multiviewExtensionIn;
} }
std::string suffix() const override std::string story() const override
{ {
std::string name = RenderTestParams::suffix(); std::string name = RenderTestParams::story();
switch (multiviewOption) switch (multiviewOption)
{ {
case MultiviewOption::NoAcceleration: case MultiviewOption::NoAcceleration:
...@@ -133,7 +133,7 @@ struct MultiviewPerfParams final : public RenderTestParams ...@@ -133,7 +133,7 @@ struct MultiviewPerfParams final : public RenderTestParams
std::ostream &operator<<(std::ostream &os, const MultiviewPerfParams &params) std::ostream &operator<<(std::ostream &os, const MultiviewPerfParams &params)
{ {
os << params.suffix().substr(1); os << params.backendAndStory().substr(1);
return os; return os;
} }
......
...@@ -37,7 +37,7 @@ struct PointSpritesParams final : public RenderTestParams ...@@ -37,7 +37,7 @@ struct PointSpritesParams final : public RenderTestParams
numVaryings = 3; numVaryings = 3;
} }
std::string suffix() const override; std::string story() const override;
unsigned int count; unsigned int count;
float size; float size;
...@@ -46,7 +46,7 @@ struct PointSpritesParams final : public RenderTestParams ...@@ -46,7 +46,7 @@ struct PointSpritesParams final : public RenderTestParams
std::ostream &operator<<(std::ostream &os, const PointSpritesParams &params) std::ostream &operator<<(std::ostream &os, const PointSpritesParams &params)
{ {
os << params.suffix().substr(1); os << params.backendAndStory().substr(1);
return os; return os;
} }
...@@ -66,11 +66,11 @@ class PointSpritesBenchmark : public ANGLERenderTest, ...@@ -66,11 +66,11 @@ class PointSpritesBenchmark : public ANGLERenderTest,
RNG mRNG; RNG mRNG;
}; };
std::string PointSpritesParams::suffix() const std::string PointSpritesParams::story() const
{ {
std::stringstream strstr; std::stringstream strstr;
strstr << RenderTestParams::suffix() << "_" << count << "_" << size << "px" strstr << RenderTestParams::story() << "_" << count << "_" << size << "px"
<< "_" << numVaryings << "vars"; << "_" << numVaryings << "vars";
return strstr.str(); return strstr.str();
......
...@@ -23,7 +23,7 @@ class ResultPerfTest : public ANGLEPerfTest ...@@ -23,7 +23,7 @@ class ResultPerfTest : public ANGLEPerfTest
void step() override; void step() override;
}; };
ResultPerfTest::ResultPerfTest() : ANGLEPerfTest("ResultPerf", "_run", kIterationsPerStep) {} ResultPerfTest::ResultPerfTest() : ANGLEPerfTest("ResultPerf", "", "_run", kIterationsPerStep) {}
ANGLE_NOINLINE angle::Result ExternalCall() ANGLE_NOINLINE angle::Result ExternalCall()
{ {
......
...@@ -41,7 +41,7 @@ struct TextureSamplingParams final : public RenderTestParams ...@@ -41,7 +41,7 @@ struct TextureSamplingParams final : public RenderTestParams
kernelSize = 3; kernelSize = 3;
} }
std::string suffix() const override; std::string story() const override;
unsigned int numSamplers; unsigned int numSamplers;
unsigned int textureSize; unsigned int textureSize;
unsigned int kernelSize; unsigned int kernelSize;
...@@ -49,15 +49,15 @@ struct TextureSamplingParams final : public RenderTestParams ...@@ -49,15 +49,15 @@ struct TextureSamplingParams final : public RenderTestParams
std::ostream &operator<<(std::ostream &os, const TextureSamplingParams &params) std::ostream &operator<<(std::ostream &os, const TextureSamplingParams &params)
{ {
os << params.suffix().substr(1); os << params.backendAndStory().substr(1);
return os; return os;
} }
std::string TextureSamplingParams::suffix() const std::string TextureSamplingParams::story() const
{ {
std::stringstream strstr; std::stringstream strstr;
strstr << RenderTestParams::suffix() << "_" << numSamplers << "samplers"; strstr << RenderTestParams::story() << "_" << numSamplers << "samplers";
return strstr.str(); return strstr.str();
} }
......
...@@ -35,7 +35,7 @@ struct TextureUploadParams final : public RenderTestParams ...@@ -35,7 +35,7 @@ struct TextureUploadParams final : public RenderTestParams
webgl = false; webgl = false;
} }
std::string suffix() const override; std::string story() const override;
GLsizei baseSize; GLsizei baseSize;
GLsizei subImageSize; GLsizei subImageSize;
...@@ -45,15 +45,15 @@ struct TextureUploadParams final : public RenderTestParams ...@@ -45,15 +45,15 @@ struct TextureUploadParams final : public RenderTestParams
std::ostream &operator<<(std::ostream &os, const TextureUploadParams &params) std::ostream &operator<<(std::ostream &os, const TextureUploadParams &params)
{ {
os << params.suffix().substr(1); os << params.backendAndStory().substr(1);
return os; return os;
} }
std::string TextureUploadParams::suffix() const std::string TextureUploadParams::story() const
{ {
std::stringstream strstr; std::stringstream strstr;
strstr << RenderTestParams::suffix(); strstr << RenderTestParams::story();
if (webgl) if (webgl)
{ {
......
...@@ -39,7 +39,7 @@ struct TexturesParams final : public RenderTestParams ...@@ -39,7 +39,7 @@ struct TexturesParams final : public RenderTestParams
webgl = false; webgl = false;
} }
std::string suffix() const override; std::string story() const override;
size_t numTextures; size_t numTextures;
size_t textureRebindFrequency; size_t textureRebindFrequency;
size_t textureStateUpdateFrequency; size_t textureStateUpdateFrequency;
...@@ -50,15 +50,15 @@ struct TexturesParams final : public RenderTestParams ...@@ -50,15 +50,15 @@ struct TexturesParams final : public RenderTestParams
std::ostream &operator<<(std::ostream &os, const TexturesParams &params) std::ostream &operator<<(std::ostream &os, const TexturesParams &params)
{ {
os << params.suffix().substr(1); os << params.backendAndStory().substr(1);
return os; return os;
} }
std::string TexturesParams::suffix() const std::string TexturesParams::story() const
{ {
std::stringstream strstr; std::stringstream strstr;
strstr << RenderTestParams::suffix(); strstr << RenderTestParams::story();
strstr << "_" << numTextures << "_textures"; strstr << "_" << numTextures << "_textures";
strstr << "_" << textureRebindFrequency << "_rebind"; strstr << "_" << textureRebindFrequency << "_rebind";
strstr << "_" << textureStateUpdateFrequency << "_state"; strstr << "_" << textureStateUpdateFrequency << "_state";
......
...@@ -67,7 +67,7 @@ struct UniformsParams final : public RenderTestParams ...@@ -67,7 +67,7 @@ struct UniformsParams final : public RenderTestParams
windowHeight = 720; windowHeight = 720;
} }
std::string suffix() const override; std::string story() const override;
size_t numVertexUniforms = 200; size_t numVertexUniforms = 200;
size_t numFragmentUniforms = 200; size_t numFragmentUniforms = 200;
...@@ -79,15 +79,15 @@ struct UniformsParams final : public RenderTestParams ...@@ -79,15 +79,15 @@ struct UniformsParams final : public RenderTestParams
std::ostream &operator<<(std::ostream &os, const UniformsParams &params) std::ostream &operator<<(std::ostream &os, const UniformsParams &params)
{ {
os << params.suffix().substr(1); os << params.backendAndStory().substr(1);
return os; return os;
} }
std::string UniformsParams::suffix() const std::string UniformsParams::story() const
{ {
std::stringstream strstr; std::stringstream strstr;
strstr << RenderTestParams::suffix(); strstr << RenderTestParams::story();
if (eglParameters.deviceType == EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE) if (eglParameters.deviceType == EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE)
{ {
......
...@@ -37,7 +37,7 @@ struct VulkanBarriersPerfParams final : public RenderTestParams ...@@ -37,7 +37,7 @@ struct VulkanBarriersPerfParams final : public RenderTestParams
doSlowFragmentShaders = slowFS; doSlowFragmentShaders = slowFS;
} }
std::string suffix() const override; std::string story() const override;
// Static parameters // Static parameters
static constexpr int kImageSizes[3] = {256, 512, 4096}; static constexpr int kImageSizes[3] = {256, 512, 4096};
...@@ -50,7 +50,7 @@ constexpr int VulkanBarriersPerfParams::kImageSizes[]; ...@@ -50,7 +50,7 @@ constexpr int VulkanBarriersPerfParams::kImageSizes[];
std::ostream &operator<<(std::ostream &os, const VulkanBarriersPerfParams &params) std::ostream &operator<<(std::ostream &os, const VulkanBarriersPerfParams &params)
{ {
os << params.suffix().substr(1); os << params.backendAndStory().substr(1);
return os; return os;
} }
...@@ -102,11 +102,11 @@ class VulkanBarriersPerfBenchmark : public ANGLERenderTest, ...@@ -102,11 +102,11 @@ class VulkanBarriersPerfBenchmark : public ANGLERenderTest,
static constexpr size_t kHugeSizeIndex = 2; static constexpr size_t kHugeSizeIndex = 2;
}; };
std::string VulkanBarriersPerfParams::suffix() const std::string VulkanBarriersPerfParams::story() const
{ {
std::ostringstream sout; std::ostringstream sout;
sout << RenderTestParams::suffix(); sout << RenderTestParams::story();
if (doLargeTransfers) if (doLargeTransfers)
{ {
......
...@@ -59,7 +59,7 @@ using CommandBufferImpl = void (*)(sample_info &info, ...@@ -59,7 +59,7 @@ using CommandBufferImpl = void (*)(sample_info &info,
struct CommandBufferTestParams struct CommandBufferTestParams
{ {
CommandBufferImpl CBImplementation; CommandBufferImpl CBImplementation;
std::string suffix; std::string story;
int frames = NUM_FRAMES; int frames = NUM_FRAMES;
int buffers = NUM_CMD_BUFFERS; int buffers = NUM_CMD_BUFFERS;
}; };
...@@ -89,7 +89,7 @@ class VulkanCommandBufferPerfTest : public ANGLEPerfTest, ...@@ -89,7 +89,7 @@ class VulkanCommandBufferPerfTest : public ANGLEPerfTest,
}; };
VulkanCommandBufferPerfTest::VulkanCommandBufferPerfTest() VulkanCommandBufferPerfTest::VulkanCommandBufferPerfTest()
: ANGLEPerfTest("VulkanCommandBufferPerfTest", GetParam().suffix, GetParam().frames) : ANGLEPerfTest("VulkanCommandBufferPerfTest", "", GetParam().story, GetParam().frames)
{ {
mInfo = {}; mInfo = {};
mSampleTitle = "Draw Textured Cube"; mSampleTitle = "Draw Textured Cube";
...@@ -564,7 +564,7 @@ CommandBufferTestParams PrimaryCBHundredIndividualParams() ...@@ -564,7 +564,7 @@ CommandBufferTestParams PrimaryCBHundredIndividualParams()
{ {
CommandBufferTestParams params; CommandBufferTestParams params;
params.CBImplementation = PrimaryCommandBufferBenchmarkHundredIndividual; params.CBImplementation = PrimaryCommandBufferBenchmarkHundredIndividual;
params.suffix = "_PrimaryCB_Submit_100_With_1_Draw"; params.story = "_PrimaryCB_Submit_100_With_1_Draw";
return params; return params;
} }
...@@ -572,7 +572,7 @@ CommandBufferTestParams PrimaryCBOneWithOneHundredParams() ...@@ -572,7 +572,7 @@ CommandBufferTestParams PrimaryCBOneWithOneHundredParams()
{ {
CommandBufferTestParams params; CommandBufferTestParams params;
params.CBImplementation = PrimaryCommandBufferBenchmarkOneWithOneHundred; params.CBImplementation = PrimaryCommandBufferBenchmarkOneWithOneHundred;
params.suffix = "_PrimaryCB_Submit_1_With_100_Draw"; params.story = "_PrimaryCB_Submit_1_With_100_Draw";
return params; return params;
} }
...@@ -580,7 +580,7 @@ CommandBufferTestParams SecondaryCBParams() ...@@ -580,7 +580,7 @@ CommandBufferTestParams SecondaryCBParams()
{ {
CommandBufferTestParams params; CommandBufferTestParams params;
params.CBImplementation = SecondaryCommandBufferBenchmark; params.CBImplementation = SecondaryCommandBufferBenchmark;
params.suffix = "_SecondaryCB_Submit_1_With_100_Draw_In_Individual_Secondary"; params.story = "_SecondaryCB_Submit_1_With_100_Draw_In_Individual_Secondary";
return params; return params;
} }
...@@ -588,7 +588,7 @@ CommandBufferTestParams CommandPoolDestroyParams() ...@@ -588,7 +588,7 @@ CommandBufferTestParams CommandPoolDestroyParams()
{ {
CommandBufferTestParams params; CommandBufferTestParams params;
params.CBImplementation = CommandPoolDestroyBenchmark; params.CBImplementation = CommandPoolDestroyBenchmark;
params.suffix = "_Reset_CBs_With_Destroy_Command_Pool"; params.story = "_Reset_CBs_With_Destroy_Command_Pool";
return params; return params;
} }
...@@ -596,7 +596,7 @@ CommandBufferTestParams CommandPoolHardResetParams() ...@@ -596,7 +596,7 @@ CommandBufferTestParams CommandPoolHardResetParams()
{ {
CommandBufferTestParams params; CommandBufferTestParams params;
params.CBImplementation = CommandPoolHardResetBenchmark; params.CBImplementation = CommandPoolHardResetBenchmark;
params.suffix = "_Reset_CBs_With_Hard_Reset_Command_Pool"; params.story = "_Reset_CBs_With_Hard_Reset_Command_Pool";
return params; return params;
} }
...@@ -604,7 +604,7 @@ CommandBufferTestParams CommandPoolSoftResetParams() ...@@ -604,7 +604,7 @@ CommandBufferTestParams CommandPoolSoftResetParams()
{ {
CommandBufferTestParams params; CommandBufferTestParams params;
params.CBImplementation = CommandPoolSoftResetBenchmark; params.CBImplementation = CommandPoolSoftResetBenchmark;
params.suffix = "_Reset_CBs_With_Soft_Reset_Command_Pool"; params.story = "_Reset_CBs_With_Soft_Reset_Command_Pool";
return params; return params;
} }
...@@ -612,7 +612,7 @@ CommandBufferTestParams CommandBufferExplicitHardResetParams() ...@@ -612,7 +612,7 @@ CommandBufferTestParams CommandBufferExplicitHardResetParams()
{ {
CommandBufferTestParams params; CommandBufferTestParams params;
params.CBImplementation = CommandBufferExplicitHardResetBenchmark; params.CBImplementation = CommandBufferExplicitHardResetBenchmark;
params.suffix = "_Reset_CBs_With_Explicit_Hard_Reset_Command_Buffers"; params.story = "_Reset_CBs_With_Explicit_Hard_Reset_Command_Buffers";
return params; return params;
} }
...@@ -620,7 +620,7 @@ CommandBufferTestParams CommandBufferExplicitSoftResetParams() ...@@ -620,7 +620,7 @@ CommandBufferTestParams CommandBufferExplicitSoftResetParams()
{ {
CommandBufferTestParams params; CommandBufferTestParams params;
params.CBImplementation = CommandBufferExplicitSoftResetBenchmark; params.CBImplementation = CommandBufferExplicitSoftResetBenchmark;
params.suffix = "_Reset_CBs_With_Explicit_Soft_Reset_Command_Buffers"; params.story = "_Reset_CBs_With_Explicit_Soft_Reset_Command_Buffers";
return params; return params;
} }
...@@ -628,7 +628,7 @@ CommandBufferTestParams CommandBufferImplicitResetParams() ...@@ -628,7 +628,7 @@ CommandBufferTestParams CommandBufferImplicitResetParams()
{ {
CommandBufferTestParams params; CommandBufferTestParams params;
params.CBImplementation = CommandBufferImplicitResetBenchmark; params.CBImplementation = CommandBufferImplicitResetBenchmark;
params.suffix = "_Reset_CBs_With_Implicit_Reset_Command_Buffers"; params.story = "_Reset_CBs_With_Implicit_Reset_Command_Buffers";
return params; return params;
} }
......
...@@ -38,7 +38,7 @@ class VulkanPipelineCachePerfTest : public ANGLEPerfTest ...@@ -38,7 +38,7 @@ class VulkanPipelineCachePerfTest : public ANGLEPerfTest
}; };
VulkanPipelineCachePerfTest::VulkanPipelineCachePerfTest() VulkanPipelineCachePerfTest::VulkanPipelineCachePerfTest()
: ANGLEPerfTest("VulkanPipelineCachePerf", "", kIterationsPerStep) : ANGLEPerfTest("VulkanPipelineCachePerf", "", "", kIterationsPerStep)
{} {}
VulkanPipelineCachePerfTest::~VulkanPipelineCachePerfTest() VulkanPipelineCachePerfTest::~VulkanPipelineCachePerfTest()
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include <stdio.h> #include <stdio.h>
#include <sstream> #include <sstream>
#include "../perf_tests/third_party/perf/perf_test.h" #include "../perf_tests/third_party/perf/perf_result_reporter.h"
#include "ANGLEPerfTestArgs.h" #include "ANGLEPerfTestArgs.h"
#include "common/platform.h" #include "common/platform.h"
#include "common/system_utils.h" #include "common/system_utils.h"
...@@ -108,6 +108,10 @@ class GLMark2Benchmark : public testing::TestWithParam<GLMark2BenchmarkTestParam ...@@ -108,6 +108,10 @@ class GLMark2Benchmark : public testing::TestWithParam<GLMark2BenchmarkTestParam
default: default:
break; break;
} }
std::string story = kBenchmarks[std::get<1>(GetParam())].name;
mReporter = std::make_unique<perf_test::PerfResultReporter>("glmark2_" + mBackend, story);
mReporter->RegisterImportantMetric(".fps", "fps");
mReporter->RegisterImportantMetric(".score", "score");
} }
void run() void run()
...@@ -244,9 +248,7 @@ class GLMark2Benchmark : public testing::TestWithParam<GLMark2BenchmarkTestParam ...@@ -244,9 +248,7 @@ class GLMark2Benchmark : public testing::TestWithParam<GLMark2BenchmarkTestParam
if (!completeRun) if (!completeRun)
{ {
const std::string kBenchmarkPrefix = "glmark2_"; mReporter->AddResult(".fps", fps);
perf_test::PrintResult(kBenchmarkPrefix + benchmarkName, '_' + mBackend, "fps", fps,
"", true);
} }
} }
...@@ -260,11 +262,12 @@ class GLMark2Benchmark : public testing::TestWithParam<GLMark2BenchmarkTestParam ...@@ -260,11 +262,12 @@ class GLMark2Benchmark : public testing::TestWithParam<GLMark2BenchmarkTestParam
if (completeRun) if (completeRun)
{ {
perf_test::PrintResult("glmark2", '_' + mBackend, "score", score, "", true); mReporter->AddResult(".score", score);
} }
} }
std::string mBackend = "invalid"; std::string mBackend = "invalid";
std::unique_ptr<perf_test::PerfResultReporter> mReporter;
}; };
TEST_P(GLMark2Benchmark, Run) TEST_P(GLMark2Benchmark, Run)
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "perf_result_reporter.h"
#include "anglebase/logging.h"
#include "perf_test.h"
namespace perf_test
{
PerfResultReporter::PerfResultReporter(const std::string &metric_basename,
const std::string &story_name)
: metric_basename_(metric_basename), story_name_(story_name)
{}
PerfResultReporter::~PerfResultReporter() = default;
void PerfResultReporter::RegisterFyiMetric(const std::string &metric_suffix,
const std::string &units)
{
RegisterMetric(metric_suffix, units, false);
}
void PerfResultReporter::RegisterImportantMetric(const std::string &metric_suffix,
const std::string &units)
{
RegisterMetric(metric_suffix, units, true);
}
void PerfResultReporter::AddResult(const std::string &metric_suffix, size_t value)
{
auto iter = metric_map_.find(metric_suffix);
CHECK(iter != metric_map_.end());
PrintResult(metric_basename_, metric_suffix, story_name_, value, iter->second.units,
iter->second.important);
}
void PerfResultReporter::AddResult(const std::string &metric_suffix, double value)
{
auto iter = metric_map_.find(metric_suffix);
CHECK(iter != metric_map_.end());
PrintResult(metric_basename_, metric_suffix, story_name_, value, iter->second.units,
iter->second.important);
}
void PerfResultReporter::AddResult(const std::string &metric_suffix, const std::string &value)
{
auto iter = metric_map_.find(metric_suffix);
CHECK(iter != metric_map_.end());
PrintResult(metric_basename_, metric_suffix, story_name_, value, iter->second.units,
iter->second.important);
}
bool PerfResultReporter::GetMetricInfo(const std::string &metric_suffix, MetricInfo *out)
{
auto iter = metric_map_.find(metric_suffix);
if (iter == metric_map_.end())
{
return false;
}
*out = iter->second;
return true;
}
void PerfResultReporter::RegisterMetric(const std::string &metric_suffix,
const std::string &units,
bool important)
{
CHECK(metric_map_.count(metric_suffix) == 0);
metric_map_.insert({metric_suffix, {units, important}});
}
} // namespace perf_test
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef TESTING_PERF_PERF_RESULT_REPORTER_H_
#define TESTING_PERF_PERF_RESULT_REPORTER_H_
#include <string>
#include <unordered_map>
namespace perf_test
{
struct MetricInfo
{
std::string units;
bool important;
};
// A helper class for using the perf test printing functions safely, as
// otherwise it's easy to accidentally mix up arguments to produce usable but
// malformed perf data. See https://crbug.com/923564.
// Sample usage:
// auto reporter = PerfResultReporter("TextRendering", "100_chars");
// reporter.RegisterImportantMetric(".wall_time", "ms");
// reporter.RegisterImportantMetric(".cpu_time", "ms");
// ...
// reporter.AddResult(".wall_time", GetWallTime());
// reporter.AddResult(".cpu_time", GetCpuTime());
// This would end up reporting "TextRendering.wall_time" and
// "TextRendering.cpu_time" metrics on the dashboard, made up of results from
// a single "100_chars" story. If an additional story run is added, e.g.
// "200_chars", then the metrics will be averaged over both runs with the
// ability to drill down into results for specific stories.
class PerfResultReporter
{
public:
PerfResultReporter(const std::string &metric_basename, const std::string &story_name);
~PerfResultReporter();
void RegisterFyiMetric(const std::string &metric_suffix, const std::string &units);
void RegisterImportantMetric(const std::string &metric_suffix, const std::string &units);
void AddResult(const std::string &metric_suffix, size_t value);
void AddResult(const std::string &metric_suffix, double value);
void AddResult(const std::string &metric_suffix, const std::string &value);
// Returns true and fills the pointer if the metric is registered, otherwise
// returns false.
bool GetMetricInfo(const std::string &metric_suffix, MetricInfo *out);
private:
void RegisterMetric(const std::string &metric_suffix, const std::string &units, bool important);
std::string metric_basename_;
std::string story_name_;
std::unordered_map<std::string, MetricInfo> metric_map_;
};
} // namespace perf_test
#endif // TESTING_PERF_PERF_RESULT_REPORTER_H_
...@@ -8,14 +8,8 @@ ...@@ -8,14 +8,8 @@
#include <stdio.h> #include <stdio.h>
#include <vector> #include <vector>
#if defined(ANDROID)
# include <android/log.h>
#endif
namespace { namespace {
namespace base {
std::string FormatString(const char *fmt, va_list vararg) { std::string FormatString(const char *fmt, va_list vararg) {
static std::vector<char> buffer(512); static std::vector<char> buffer(512);
...@@ -41,14 +35,14 @@ std::string StringPrintf(const char *fmt, ...) { ...@@ -41,14 +35,14 @@ std::string StringPrintf(const char *fmt, ...) {
return result; return result;
} }
std::string UintToString(unsigned int value) { std::string NumberToString(size_t value)
return StringPrintf("%u", value); {
} return StringPrintf("%u", value);
std::string DoubleToString(double value) {
return StringPrintf("%.10lf", value);
} }
std::string NumberToString(double value)
{
return StringPrintf("%.10lf", value);
} }
std::string ResultsToString(const std::string& measurement, std::string ResultsToString(const std::string& measurement,
...@@ -62,10 +56,9 @@ std::string ResultsToString(const std::string& measurement, ...@@ -62,10 +56,9 @@ std::string ResultsToString(const std::string& measurement,
// <*>RESULT <graph_name>: <trace_name>= <value> <units> // <*>RESULT <graph_name>: <trace_name>= <value> <units>
// <*>RESULT <graph_name>: <trace_name>= {<mean>, <std deviation>} <units> // <*>RESULT <graph_name>: <trace_name>= {<mean>, <std deviation>} <units>
// <*>RESULT <graph_name>: <trace_name>= [<value>,value,value,...,] <units> // <*>RESULT <graph_name>: <trace_name>= [<value>,value,value,...,] <units>
return base::StringPrintf("%sRESULT %s%s: %s= %s%s%s %s\n", return StringPrintf("%sRESULT %s%s: %s= %s%s%s %s\n", important ? "*" : "", measurement.c_str(),
important ? "*" : "", measurement.c_str(), modifier.c_str(), modifier.c_str(), trace.c_str(), prefix.c_str(), values.c_str(),
trace.c_str(), prefix.c_str(), values.c_str(), suffix.c_str(), suffix.c_str(), units.c_str());
units.c_str());
} }
void PrintResultsImpl(const std::string& measurement, void PrintResultsImpl(const std::string& measurement,
...@@ -92,14 +85,8 @@ void PrintResult(const std::string& measurement, ...@@ -92,14 +85,8 @@ void PrintResult(const std::string& measurement,
size_t value, size_t value,
const std::string& units, const std::string& units,
bool important) { bool important) {
PrintResultsImpl(measurement, PrintResultsImpl(measurement, modifier, trace, NumberToString(value), std::string(),
modifier, std::string(), units, important);
trace,
base::UintToString(static_cast<unsigned int>(value)),
std::string(),
std::string(),
units,
important);
} }
void PrintResult(const std::string& measurement, void PrintResult(const std::string& measurement,
...@@ -108,14 +95,8 @@ void PrintResult(const std::string& measurement, ...@@ -108,14 +95,8 @@ void PrintResult(const std::string& measurement,
double value, double value,
const std::string& units, const std::string& units,
bool important) { bool important) {
PrintResultsImpl(measurement, PrintResultsImpl(measurement, modifier, trace, NumberToString(value), std::string(),
modifier, std::string(), units, important);
trace,
base::DoubleToString(value),
std::string(),
std::string(),
units,
important);
} }
void AppendResult(std::string& output, void AppendResult(std::string& output,
...@@ -125,15 +106,8 @@ void AppendResult(std::string& output, ...@@ -125,15 +106,8 @@ void AppendResult(std::string& output,
size_t value, size_t value,
const std::string& units, const std::string& units,
bool important) { bool important) {
output += ResultsToString( output += ResultsToString(measurement, modifier, trace, NumberToString(value), std::string(),
measurement, std::string(), units, important);
modifier,
trace,
base::UintToString(static_cast<unsigned int>(value)),
std::string(),
std::string(),
units,
important);
} }
void PrintResult(const std::string& measurement, void PrintResult(const std::string& measurement,
......
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