Hash :
9e582b93
Author :
Date :
2015-06-22T11:18:32
perf_tests: Normalize MS counts in EGL init test. The un-normalized values depend on the number of frames rendered, so if we optimize down one time, the other ms values all increase, because we are rendering more frames. This generates spurious perf alerts from the perf dashboard. BUG=None Change-Id: I1bc480141a8cad7eee96bcdf4d6747a3cbae30f2 Reviewed-on: https://chromium-review.googlesource.com/280980 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Tested-by: Jamie Madill <jmadill@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ANGLEPerfTests:
// Base class for google test performance tests
//
#ifndef PERF_TESTS_ANGLE_PERF_TEST_H_
#define PERF_TESTS_ANGLE_PERF_TEST_H_
#include <gtest/gtest.h>
#include <string>
#include <vector>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include "EGLWindow.h"
#include "OSWindow.h"
#include "Timer.h"
#include "common/angleutils.h"
#include "common/debug.h"
#include "test_utils/angle_test_configs.h"
#include "test_utils/angle_test_instantiate.h"
class Event;
#ifndef ASSERT_GL_NO_ERROR
#define ASSERT_GL_NO_ERROR() ASSERT_TRUE(glGetError() == GL_NO_ERROR)
#endif
class ANGLEPerfTest : public testing::Test, angle::NonCopyable
{
public:
ANGLEPerfTest(const std::string &name, const std::string &suffix);
virtual ~ANGLEPerfTest();
virtual void step(float dt, double totalTime) = 0;
protected:
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 TearDown() override;
// Normalize a time value according to the number of test loop iterations (mFrameCount)
double normalizedTime(size_t value) const;
std::string mName;
std::string mSuffix;
bool mRunning;
Timer *mTimer;
int mNumFrames;
};
struct RenderTestParams : public angle::PlatformParameters
{
virtual std::string suffix() const;
EGLint widowWidth;
EGLint windowHeight;
};
class ANGLERenderTest : public ANGLEPerfTest
{
public:
ANGLERenderTest(const std::string &name, const RenderTestParams &testParams);
~ANGLERenderTest();
virtual void initializeBenchmark() { }
virtual void destroyBenchmark() { }
virtual void stepBenchmark(float dt, double totalTime) { }
virtual void beginDrawBenchmark() { }
virtual void drawBenchmark() = 0;
virtual void endDrawBenchmark() { }
bool popEvent(Event *event);
OSWindow *getWindow();
protected:
const RenderTestParams &mTestParams;
unsigned int mDrawIterations;
double mRunTimeSeconds;
private:
void SetUp() override;
void TearDown() override;
void step(float dt, double totalTime) override;
void draw();
EGLWindow *mEGLWindow;
OSWindow *mOSWindow;
};
#endif // PERF_TESTS_ANGLE_PERF_TEST_H_