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
}
std::string BufferSubDataParams::name() const
std::string BufferSubDataParams::suffix() const
{
std::stringstream strstr;
strstr << "BufferSubData - " << BenchmarkParams::name() << " - ";
if (vertexNormalized)
{
strstr << "Norm";
strstr << "_norm";
}
switch (vertexType)
{
case GL_FLOAT: strstr << "Float"; break;
case GL_INT: strstr << "Int"; break;
case GL_BYTE: strstr << "Byte"; break;
case GL_SHORT: strstr << "Short"; break;
case GL_UNSIGNED_INT: strstr << "UInt"; break;
case GL_UNSIGNED_BYTE: strstr << "UByte"; break;
case GL_UNSIGNED_SHORT: strstr << "UShort"; break;
default: strstr << "UNKNOWN FORMAT (" << vertexType << ")"; break;
case GL_FLOAT: strstr << "_float"; break;
case GL_INT: strstr << "_int"; break;
case GL_BYTE: strstr << "_byte"; break;
case GL_SHORT: strstr << "_short"; break;
case GL_UNSIGNED_INT: strstr << "_uint"; break;
case GL_UNSIGNED_BYTE: strstr << "_ubyte"; break;
case GL_UNSIGNED_SHORT: strstr << "_ushort"; break;
default: strstr << "_vunk_" << vertexType << "_"; break;
}
strstr << vertexComponentCount;
strstr << " - " << updateSize << "b updates (per " << updatesEveryNFrames << ") - ";
strstr << (bufferSize >> 10) << "k buffer - ";
strstr << iterations << " updates";
strstr << "_every" << updatesEveryNFrames;
return strstr.str();
}
BufferSubDataBenchmark::BufferSubDataBenchmark(const BufferSubDataParams &params)
: SimpleBenchmark(params.name(), 1280, 720, 2, params.requestedRenderer),
: SimpleBenchmark("BufferSubData", 1280, 720, 2, params),
mProgram(0),
mBuffer(0),
mUpdateData(NULL),
......@@ -266,6 +261,11 @@ bool BufferSubDataBenchmark::initializeBenchmark()
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);
glDeleteBuffers(1, &mBuffer);
delete[] mUpdateData;
......
......@@ -8,16 +8,17 @@
struct BufferSubDataParams : public BenchmarkParams
{
EGLint requestedRenderer;
virtual std::string suffix() const;
GLboolean vertexNormalized;
GLenum vertexType;
GLint vertexComponentCount;
GLboolean vertexNormalized;
unsigned int updatesEveryNFrames;
// static parameters
GLsizeiptr updateSize;
GLsizeiptr bufferSize;
unsigned int iterations;
unsigned int updatesEveryNFrames;
virtual std::string name() const;
};
class BufferSubDataBenchmark : public SimpleBenchmark
......
......@@ -13,19 +13,18 @@
#include "shader_utils.h"
#include "random_utils.h"
std::string PointSpritesParams::name() const
std::string PointSpritesParams::suffix() const
{
std::stringstream strstr;
strstr << "PointSprites - " << BenchmarkParams::name()
<< " - " << count << " sprites - size " << size
<< " - " << numVaryings << " varyings";
strstr << "_" << count << "_" << size << "px"
<< "_" << numVaryings << "vars";
return strstr.str();
}
PointSpritesBenchmark::PointSpritesBenchmark(const PointSpritesParams &params)
: SimpleBenchmark(params.name(), 1280, 720, 2, params.requestedRenderer),
: SimpleBenchmark("PointSprites", 1280, 720, 2, params),
mParams(params)
{
mDrawIterations = mParams.iterations;
......
......@@ -8,12 +8,14 @@
struct PointSpritesParams : public BenchmarkParams
{
unsigned int iterations;
virtual std::string suffix() const;
unsigned int count;
float size;
unsigned int numVaryings;
virtual std::string name() const;
// static parameters
unsigned int iterations;
};
class PointSpritesBenchmark : public SimpleBenchmark
......
......@@ -5,33 +5,59 @@
//
#include "SimpleBenchmark.h"
#include "third_party/perf/perf_test.h"
#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),
mName(name),
mRunning(false),
mDrawIterations(10),
mRunTimeSeconds(5.0)
mRunTimeSeconds(5.0),
mSuffix(params.suffix())
{
mOSWindow.reset(CreateOSWindow());
mEGLWindow.reset(new EGLWindow(width, height, glesMajorVersion, requestedRenderer));
mEGLWindow.reset(new EGLWindow(width, height, glesMajorVersion, params.requestedRenderer));
mTimer.reset(CreateTimer());
}
bool SimpleBenchmark::initialize()
{
std::cout << "========= " << mName << " =========" << std::endl;
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()
{
double totalTime = mTimer->getElapsedTime();
std::cout << " - total time: " << totalTime << " sec" << std::endl;
std::cout << " - frames: " << mNumFrames << std::endl;
std::cout << " - average frame time: " << 1000.0 * totalTime / mNumFrames << " msec" << std::endl;
std::cout << "=========" << std::endl << std::endl;
double averageTime = 1000.0 * totalTime / static_cast<double>(mNumFrames);
printResult("total_time", totalTime, "s", true);
printResult("frames", static_cast<size_t>(mNumFrames), "frames", true);
printResult("average_time", averageTime, "ms", true);
destroyBenchmark();
}
......
......@@ -21,12 +21,19 @@
class Event;
// Base class
struct BenchmarkParams
{
EGLint requestedRenderer;
virtual std::string suffix() const;
};
class SimpleBenchmark
{
public:
SimpleBenchmark(const std::string &name, size_t width, size_t height,
EGLint glesMajorVersion = 2,
EGLint requestedRenderer = EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE);
EGLint glesMajorVersion, const BenchmarkParams &params);
virtual ~SimpleBenchmark() { };
......@@ -45,6 +52,9 @@ class SimpleBenchmark
OSWindow *getWindow();
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;
double mRunTimeSeconds;
int mNumFrames;
......@@ -60,28 +70,13 @@ class SimpleBenchmark
std::string mName;
bool mRunning;
std::string mSuffix;
std::unique_ptr<EGLWindow> mEGLWindow;
std::unique_ptr<OSWindow> mOSWindow;
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>
inline int RunBenchmarks(const std::vector<ParamsT> &benchmarks)
{
......
......@@ -18,7 +18,7 @@ EGLint platforms[] =
GLenum vertexTypes[] = { GL_FLOAT };
GLint componentCounts[] = { 4 };
GLboolean vertexNorms[] = { GL_FALSE };
GLsizeiptr updateSizes[] = { 0, 300 };
GLsizeiptr updateSizes[] = { 300 };
GLsizeiptr bufferSizes[] = { 1024 * 1024 };
unsigned int iterationCounts[] = { 10 };
unsigned int updatesEveryNFrames[] = { 1, 4 };
......
......@@ -11,19 +11,13 @@
#include "shader_utils.h"
std::string TexSubImageParams::name() const
std::string TexSubImageParams::suffix() const
{
std::stringstream strstr;
strstr << "TexSubImage - " << BenchmarkParams::name()
<< " - " << imageWidth << "x" << imageHeight
<< " - " << subImageWidth << "x" << subImageHeight << " updates";
return strstr.str();
return "";
}
TexSubImageBenchmark::TexSubImageBenchmark(const TexSubImageParams &params)
: SimpleBenchmark(params.name(), 512, 512, 2, params.requestedRenderer),
: SimpleBenchmark("TexSubImage", 512, 512, 2, params),
mParams(params),
mProgram(0),
mPositionLoc(-1),
......@@ -144,6 +138,13 @@ bool TexSubImageBenchmark::initializeBenchmark()
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);
glDeleteBuffers(1, &mVertexBuffer);
glDeleteBuffers(1, &mIndexBuffer);
......
......@@ -8,13 +8,14 @@
struct TexSubImageParams : public BenchmarkParams
{
virtual std::string suffix() const;
// Static parameters
int imageWidth;
int imageHeight;
int subImageWidth;
int subImageHeight;
unsigned int iterations;
virtual std::string name() const;
};
class TexSubImageBenchmark : public SimpleBenchmark
......
......@@ -49,6 +49,7 @@ class EGLWindow
void swap();
GLuint getClientVersion() const { return mClientVersion; }
EGLint getRequestedRenderer() const { return mRequestedRenderer; }
EGLConfig getConfig() const;
EGLDisplay getDisplay() 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