Commit fc63152a by Jamie Madill

Use Chromium perf bot output style for perf test.

The Chromium style output will allow the perf bots to collect data from our performance tests. BUG=angle:744 Change-Id: I2ffdace688004edf2918ead2a3e2aa2a6c4daf95 Reviewed-on: https://chromium-review.googlesource.com/220361Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 98f87eb2
...@@ -126,40 +126,35 @@ GLsizeiptr GetVertexData(GLenum type, GLint componentCount, GLboolean normalized ...@@ -126,40 +126,35 @@ GLsizeiptr GetVertexData(GLenum type, GLint componentCount, GLboolean normalized
} }
std::string BufferSubDataParams::name() const std::string BufferSubDataParams::suffix() const
{ {
std::stringstream strstr; std::stringstream strstr;
strstr << "BufferSubData - " << BenchmarkParams::name() << " - ";
if (vertexNormalized) if (vertexNormalized)
{ {
strstr << "Norm"; strstr << "_norm";
} }
switch (vertexType) switch (vertexType)
{ {
case GL_FLOAT: strstr << "Float"; break; case GL_FLOAT: strstr << "_float"; break;
case GL_INT: strstr << "Int"; break; case GL_INT: strstr << "_int"; break;
case GL_BYTE: strstr << "Byte"; break; case GL_BYTE: strstr << "_byte"; break;
case GL_SHORT: strstr << "Short"; break; case GL_SHORT: strstr << "_short"; break;
case GL_UNSIGNED_INT: strstr << "UInt"; break; case GL_UNSIGNED_INT: strstr << "_uint"; break;
case GL_UNSIGNED_BYTE: strstr << "UByte"; break; case GL_UNSIGNED_BYTE: strstr << "_ubyte"; break;
case GL_UNSIGNED_SHORT: strstr << "UShort"; break; case GL_UNSIGNED_SHORT: strstr << "_ushort"; break;
default: strstr << "UNKNOWN FORMAT (" << vertexType << ")"; break; default: strstr << "_vunk_" << vertexType << "_"; break;
} }
strstr << vertexComponentCount; strstr << vertexComponentCount;
strstr << "_every" << updatesEveryNFrames;
strstr << " - " << updateSize << "b updates (per " << updatesEveryNFrames << ") - ";
strstr << (bufferSize >> 10) << "k buffer - ";
strstr << iterations << " updates";
return strstr.str(); return strstr.str();
} }
BufferSubDataBenchmark::BufferSubDataBenchmark(const BufferSubDataParams &params) BufferSubDataBenchmark::BufferSubDataBenchmark(const BufferSubDataParams &params)
: SimpleBenchmark(params.name(), 1280, 720, 2, params.requestedRenderer), : SimpleBenchmark("BufferSubData", 1280, 720, 2, params),
mProgram(0), mProgram(0),
mBuffer(0), mBuffer(0),
mUpdateData(NULL), mUpdateData(NULL),
...@@ -266,6 +261,11 @@ bool BufferSubDataBenchmark::initializeBenchmark() ...@@ -266,6 +261,11 @@ bool BufferSubDataBenchmark::initializeBenchmark()
void BufferSubDataBenchmark::destroyBenchmark() void BufferSubDataBenchmark::destroyBenchmark()
{ {
// print static parameters
printResult("update_size", static_cast<size_t>(mParams.updateSize), "b", false);
printResult("buffer_size", static_cast<size_t>(mParams.bufferSize), "b", false);
printResult("iterations", static_cast<size_t>(mParams.iterations), "updates", false);
glDeleteProgram(mProgram); glDeleteProgram(mProgram);
glDeleteBuffers(1, &mBuffer); glDeleteBuffers(1, &mBuffer);
delete[] mUpdateData; delete[] mUpdateData;
......
...@@ -8,16 +8,17 @@ ...@@ -8,16 +8,17 @@
struct BufferSubDataParams : public BenchmarkParams struct BufferSubDataParams : public BenchmarkParams
{ {
EGLint requestedRenderer; virtual std::string suffix() const;
GLboolean vertexNormalized;
GLenum vertexType; GLenum vertexType;
GLint vertexComponentCount; GLint vertexComponentCount;
GLboolean vertexNormalized; unsigned int updatesEveryNFrames;
// static parameters
GLsizeiptr updateSize; GLsizeiptr updateSize;
GLsizeiptr bufferSize; GLsizeiptr bufferSize;
unsigned int iterations; unsigned int iterations;
unsigned int updatesEveryNFrames;
virtual std::string name() const;
}; };
class BufferSubDataBenchmark : public SimpleBenchmark class BufferSubDataBenchmark : public SimpleBenchmark
......
...@@ -13,19 +13,18 @@ ...@@ -13,19 +13,18 @@
#include "shader_utils.h" #include "shader_utils.h"
#include "random_utils.h" #include "random_utils.h"
std::string PointSpritesParams::name() const std::string PointSpritesParams::suffix() const
{ {
std::stringstream strstr; std::stringstream strstr;
strstr << "PointSprites - " << BenchmarkParams::name() strstr << "_" << count << "_" << size << "px"
<< " - " << count << " sprites - size " << size << "_" << numVaryings << "vars";
<< " - " << numVaryings << " varyings";
return strstr.str(); return strstr.str();
} }
PointSpritesBenchmark::PointSpritesBenchmark(const PointSpritesParams &params) PointSpritesBenchmark::PointSpritesBenchmark(const PointSpritesParams &params)
: SimpleBenchmark(params.name(), 1280, 720, 2, params.requestedRenderer), : SimpleBenchmark("PointSprites", 1280, 720, 2, params),
mParams(params) mParams(params)
{ {
mDrawIterations = mParams.iterations; mDrawIterations = mParams.iterations;
......
...@@ -8,12 +8,14 @@ ...@@ -8,12 +8,14 @@
struct PointSpritesParams : public BenchmarkParams struct PointSpritesParams : public BenchmarkParams
{ {
unsigned int iterations; virtual std::string suffix() const;
unsigned int count; unsigned int count;
float size; float size;
unsigned int numVaryings; unsigned int numVaryings;
virtual std::string name() const; // static parameters
unsigned int iterations;
}; };
class PointSpritesBenchmark : public SimpleBenchmark class PointSpritesBenchmark : public SimpleBenchmark
......
...@@ -5,33 +5,59 @@ ...@@ -5,33 +5,59 @@
// //
#include "SimpleBenchmark.h" #include "SimpleBenchmark.h"
#include "third_party/perf/perf_test.h"
#include <iostream> #include <iostream>
#include <cassert>
std::string BenchmarkParams::suffix() const
{
switch (requestedRenderer)
{
case EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE: return "_d3d11";
case EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE: return "_d3d9";
default: assert(0); return "_unk";
}
}
SimpleBenchmark::SimpleBenchmark(const std::string &name, size_t width, size_t height, EGLint glesMajorVersion, EGLint requestedRenderer) SimpleBenchmark::SimpleBenchmark(const std::string &name, size_t width, size_t height,
EGLint glesMajorVersion, const BenchmarkParams &params)
: mNumFrames(0), : mNumFrames(0),
mName(name), mName(name),
mRunning(false), mRunning(false),
mDrawIterations(10), mDrawIterations(10),
mRunTimeSeconds(5.0) mRunTimeSeconds(5.0),
mSuffix(params.suffix())
{ {
mOSWindow.reset(CreateOSWindow()); mOSWindow.reset(CreateOSWindow());
mEGLWindow.reset(new EGLWindow(width, height, glesMajorVersion, requestedRenderer)); mEGLWindow.reset(new EGLWindow(width, height, glesMajorVersion, params.requestedRenderer));
mTimer.reset(CreateTimer()); mTimer.reset(CreateTimer());
} }
bool SimpleBenchmark::initialize() bool SimpleBenchmark::initialize()
{ {
std::cout << "========= " << mName << " =========" << std::endl;
return initializeBenchmark(); return initializeBenchmark();
} }
void SimpleBenchmark::printResult(const std::string &trace, double value, const std::string &units, bool important) const
{
perf_test::PrintResult(mName, mSuffix, trace, value, units, important);
}
void SimpleBenchmark::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 SimpleBenchmark::destroy() void SimpleBenchmark::destroy()
{ {
double totalTime = mTimer->getElapsedTime(); double totalTime = mTimer->getElapsedTime();
std::cout << " - total time: " << totalTime << " sec" << std::endl; double averageTime = 1000.0 * totalTime / static_cast<double>(mNumFrames);
std::cout << " - frames: " << mNumFrames << std::endl;
std::cout << " - average frame time: " << 1000.0 * totalTime / mNumFrames << " msec" << std::endl; printResult("total_time", totalTime, "s", true);
std::cout << "=========" << std::endl << std::endl; printResult("frames", static_cast<size_t>(mNumFrames), "frames", true);
printResult("average_time", averageTime, "ms", true);
destroyBenchmark(); destroyBenchmark();
} }
......
...@@ -21,12 +21,19 @@ ...@@ -21,12 +21,19 @@
class Event; class Event;
// Base class
struct BenchmarkParams
{
EGLint requestedRenderer;
virtual std::string suffix() const;
};
class SimpleBenchmark class SimpleBenchmark
{ {
public: public:
SimpleBenchmark(const std::string &name, size_t width, size_t height, SimpleBenchmark(const std::string &name, size_t width, size_t height,
EGLint glesMajorVersion = 2, EGLint glesMajorVersion, const BenchmarkParams &params);
EGLint requestedRenderer = EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE);
virtual ~SimpleBenchmark() { }; virtual ~SimpleBenchmark() { };
...@@ -45,6 +52,9 @@ class SimpleBenchmark ...@@ -45,6 +52,9 @@ class SimpleBenchmark
OSWindow *getWindow(); OSWindow *getWindow();
protected: protected:
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;
unsigned int mDrawIterations; unsigned int mDrawIterations;
double mRunTimeSeconds; double mRunTimeSeconds;
int mNumFrames; int mNumFrames;
...@@ -60,28 +70,13 @@ class SimpleBenchmark ...@@ -60,28 +70,13 @@ class SimpleBenchmark
std::string mName; std::string mName;
bool mRunning; bool mRunning;
std::string mSuffix;
std::unique_ptr<EGLWindow> mEGLWindow; std::unique_ptr<EGLWindow> mEGLWindow;
std::unique_ptr<OSWindow> mOSWindow; std::unique_ptr<OSWindow> mOSWindow;
std::unique_ptr<Timer> mTimer; std::unique_ptr<Timer> mTimer;
}; };
// Base class
struct BenchmarkParams
{
EGLint requestedRenderer;
virtual std::string name() const
{
switch (requestedRenderer)
{
case EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE: return "D3D11";
case EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE: return "D3D9";
default: return "Unknown Renderer";
}
}
};
template <typename BenchmarkT, typename ParamsT> template <typename BenchmarkT, typename ParamsT>
inline int RunBenchmarks(const std::vector<ParamsT> &benchmarks) inline int RunBenchmarks(const std::vector<ParamsT> &benchmarks)
{ {
......
...@@ -18,7 +18,7 @@ EGLint platforms[] = ...@@ -18,7 +18,7 @@ EGLint platforms[] =
GLenum vertexTypes[] = { GL_FLOAT }; GLenum vertexTypes[] = { GL_FLOAT };
GLint componentCounts[] = { 4 }; GLint componentCounts[] = { 4 };
GLboolean vertexNorms[] = { GL_FALSE }; GLboolean vertexNorms[] = { GL_FALSE };
GLsizeiptr updateSizes[] = { 0, 300 }; GLsizeiptr updateSizes[] = { 300 };
GLsizeiptr bufferSizes[] = { 1024 * 1024 }; GLsizeiptr bufferSizes[] = { 1024 * 1024 };
unsigned int iterationCounts[] = { 10 }; unsigned int iterationCounts[] = { 10 };
unsigned int updatesEveryNFrames[] = { 1, 4 }; unsigned int updatesEveryNFrames[] = { 1, 4 };
......
...@@ -11,19 +11,13 @@ ...@@ -11,19 +11,13 @@
#include "shader_utils.h" #include "shader_utils.h"
std::string TexSubImageParams::name() const std::string TexSubImageParams::suffix() const
{ {
std::stringstream strstr; return "";
strstr << "TexSubImage - " << BenchmarkParams::name()
<< " - " << imageWidth << "x" << imageHeight
<< " - " << subImageWidth << "x" << subImageHeight << " updates";
return strstr.str();
} }
TexSubImageBenchmark::TexSubImageBenchmark(const TexSubImageParams &params) TexSubImageBenchmark::TexSubImageBenchmark(const TexSubImageParams &params)
: SimpleBenchmark(params.name(), 512, 512, 2, params.requestedRenderer), : SimpleBenchmark("TexSubImage", 512, 512, 2, params),
mParams(params), mParams(params),
mProgram(0), mProgram(0),
mPositionLoc(-1), mPositionLoc(-1),
...@@ -144,6 +138,13 @@ bool TexSubImageBenchmark::initializeBenchmark() ...@@ -144,6 +138,13 @@ bool TexSubImageBenchmark::initializeBenchmark()
void TexSubImageBenchmark::destroyBenchmark() void TexSubImageBenchmark::destroyBenchmark()
{ {
// print static parameters
printResult("image_width", static_cast<size_t>(mParams.imageWidth), "pix", false);
printResult("image_height", static_cast<size_t>(mParams.imageHeight), "pix", false);
printResult("subimage_width", static_cast<size_t>(mParams.subImageWidth), "pix", false);
printResult("subimage_height", static_cast<size_t>(mParams.subImageHeight), "pix", false);
printResult("iterations", static_cast<size_t>(mParams.iterations), "updates", false);
glDeleteProgram(mProgram); glDeleteProgram(mProgram);
glDeleteBuffers(1, &mVertexBuffer); glDeleteBuffers(1, &mVertexBuffer);
glDeleteBuffers(1, &mIndexBuffer); glDeleteBuffers(1, &mIndexBuffer);
......
...@@ -8,13 +8,14 @@ ...@@ -8,13 +8,14 @@
struct TexSubImageParams : public BenchmarkParams struct TexSubImageParams : public BenchmarkParams
{ {
virtual std::string suffix() const;
// Static parameters
int imageWidth; int imageWidth;
int imageHeight; int imageHeight;
int subImageWidth; int subImageWidth;
int subImageHeight; int subImageHeight;
unsigned int iterations; unsigned int iterations;
virtual std::string name() const;
}; };
class TexSubImageBenchmark : public SimpleBenchmark class TexSubImageBenchmark : public SimpleBenchmark
......
...@@ -49,6 +49,7 @@ class EGLWindow ...@@ -49,6 +49,7 @@ class EGLWindow
void swap(); void swap();
GLuint getClientVersion() const { return mClientVersion; } GLuint getClientVersion() const { return mClientVersion; }
EGLint getRequestedRenderer() const { return mRequestedRenderer; }
EGLConfig getConfig() const; EGLConfig getConfig() const;
EGLDisplay getDisplay() const; EGLDisplay getDisplay() const;
EGLSurface getSurface() const; EGLSurface getSurface() const;
......
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