xref: /aosp_15_r20/external/angle/src/tests/perf_tests/ANGLEPerfTest.h (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1*8975f5c5SAndroid Build Coastguard Worker //
2*8975f5c5SAndroid Build Coastguard Worker // Copyright 2014 The ANGLE Project Authors. All rights reserved.
3*8975f5c5SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
4*8975f5c5SAndroid Build Coastguard Worker // found in the LICENSE file.
5*8975f5c5SAndroid Build Coastguard Worker //
6*8975f5c5SAndroid Build Coastguard Worker // ANGLEPerfTests:
7*8975f5c5SAndroid Build Coastguard Worker //   Base class for google test performance tests
8*8975f5c5SAndroid Build Coastguard Worker //
9*8975f5c5SAndroid Build Coastguard Worker 
10*8975f5c5SAndroid Build Coastguard Worker #ifndef PERF_TESTS_ANGLE_PERF_TEST_H_
11*8975f5c5SAndroid Build Coastguard Worker #define PERF_TESTS_ANGLE_PERF_TEST_H_
12*8975f5c5SAndroid Build Coastguard Worker 
13*8975f5c5SAndroid Build Coastguard Worker #include <gtest/gtest.h>
14*8975f5c5SAndroid Build Coastguard Worker 
15*8975f5c5SAndroid Build Coastguard Worker #include <mutex>
16*8975f5c5SAndroid Build Coastguard Worker #include <queue>
17*8975f5c5SAndroid Build Coastguard Worker #include <string>
18*8975f5c5SAndroid Build Coastguard Worker #include <unordered_map>
19*8975f5c5SAndroid Build Coastguard Worker #include <vector>
20*8975f5c5SAndroid Build Coastguard Worker 
21*8975f5c5SAndroid Build Coastguard Worker #include "platform/PlatformMethods.h"
22*8975f5c5SAndroid Build Coastguard Worker #include "test_utils/angle_test_configs.h"
23*8975f5c5SAndroid Build Coastguard Worker #include "test_utils/angle_test_instantiate.h"
24*8975f5c5SAndroid Build Coastguard Worker #include "test_utils/angle_test_platform.h"
25*8975f5c5SAndroid Build Coastguard Worker #include "third_party/perf/perf_result_reporter.h"
26*8975f5c5SAndroid Build Coastguard Worker #include "util/EGLWindow.h"
27*8975f5c5SAndroid Build Coastguard Worker #include "util/OSWindow.h"
28*8975f5c5SAndroid Build Coastguard Worker #include "util/Timer.h"
29*8975f5c5SAndroid Build Coastguard Worker #include "util/util_gl.h"
30*8975f5c5SAndroid Build Coastguard Worker 
31*8975f5c5SAndroid Build Coastguard Worker class Event;
32*8975f5c5SAndroid Build Coastguard Worker 
33*8975f5c5SAndroid Build Coastguard Worker #if !defined(ASSERT_GL_NO_ERROR)
34*8975f5c5SAndroid Build Coastguard Worker #    define ASSERT_GL_NO_ERROR() ASSERT_EQ(static_cast<GLenum>(GL_NO_ERROR), glGetError())
35*8975f5c5SAndroid Build Coastguard Worker #endif  // !defined(ASSERT_GL_NO_ERROR)
36*8975f5c5SAndroid Build Coastguard Worker 
37*8975f5c5SAndroid Build Coastguard Worker #if !defined(ASSERT_GLENUM_EQ)
38*8975f5c5SAndroid Build Coastguard Worker #    define ASSERT_GLENUM_EQ(expected, actual) \
39*8975f5c5SAndroid Build Coastguard Worker         ASSERT_EQ(static_cast<GLenum>(expected), static_cast<GLenum>(actual))
40*8975f5c5SAndroid Build Coastguard Worker #endif  // !defined(ASSERT_GLENUM_EQ)
41*8975f5c5SAndroid Build Coastguard Worker 
42*8975f5c5SAndroid Build Coastguard Worker // These are trace events according to Google's "Trace Event Format".
43*8975f5c5SAndroid Build Coastguard Worker // See https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU
44*8975f5c5SAndroid Build Coastguard Worker // Only a subset of the properties are implemented.
45*8975f5c5SAndroid Build Coastguard Worker struct TraceEvent final
46*8975f5c5SAndroid Build Coastguard Worker {
TraceEventfinal47*8975f5c5SAndroid Build Coastguard Worker     TraceEvent() {}
48*8975f5c5SAndroid Build Coastguard Worker     TraceEvent(char phaseIn,
49*8975f5c5SAndroid Build Coastguard Worker                const char *categoryNameIn,
50*8975f5c5SAndroid Build Coastguard Worker                const char *nameIn,
51*8975f5c5SAndroid Build Coastguard Worker                double timestampIn,
52*8975f5c5SAndroid Build Coastguard Worker                uint32_t tidIn);
53*8975f5c5SAndroid Build Coastguard Worker 
54*8975f5c5SAndroid Build Coastguard Worker     static constexpr uint32_t kMaxNameLen = 64;
55*8975f5c5SAndroid Build Coastguard Worker 
56*8975f5c5SAndroid Build Coastguard Worker     char phase               = 0;
57*8975f5c5SAndroid Build Coastguard Worker     const char *categoryName = nullptr;
58*8975f5c5SAndroid Build Coastguard Worker     char name[kMaxNameLen]   = {};
59*8975f5c5SAndroid Build Coastguard Worker     double timestamp         = 0;
60*8975f5c5SAndroid Build Coastguard Worker     uint32_t tid             = 0;
61*8975f5c5SAndroid Build Coastguard Worker };
62*8975f5c5SAndroid Build Coastguard Worker 
63*8975f5c5SAndroid Build Coastguard Worker class ANGLEPerfTest : public testing::Test, angle::NonCopyable
64*8975f5c5SAndroid Build Coastguard Worker {
65*8975f5c5SAndroid Build Coastguard Worker   public:
66*8975f5c5SAndroid Build Coastguard Worker     ANGLEPerfTest(const std::string &name,
67*8975f5c5SAndroid Build Coastguard Worker                   const std::string &backend,
68*8975f5c5SAndroid Build Coastguard Worker                   const std::string &story,
69*8975f5c5SAndroid Build Coastguard Worker                   unsigned int iterationsPerStep,
70*8975f5c5SAndroid Build Coastguard Worker                   const char *units = "ns");
71*8975f5c5SAndroid Build Coastguard Worker     ~ANGLEPerfTest() override;
72*8975f5c5SAndroid Build Coastguard Worker 
73*8975f5c5SAndroid Build Coastguard Worker     virtual void step() = 0;
74*8975f5c5SAndroid Build Coastguard Worker 
75*8975f5c5SAndroid Build Coastguard Worker     // Called right after the timer starts to let the test initialize other metrics if necessary
startTest()76*8975f5c5SAndroid Build Coastguard Worker     virtual void startTest() {}
77*8975f5c5SAndroid Build Coastguard Worker     // Called right before timer is stopped to let the test wait for asynchronous operations.
finishTest()78*8975f5c5SAndroid Build Coastguard Worker     virtual void finishTest() {}
flush()79*8975f5c5SAndroid Build Coastguard Worker     virtual void flush() {}
80*8975f5c5SAndroid Build Coastguard Worker 
81*8975f5c5SAndroid Build Coastguard Worker     // Can be overridden in child tests that require a certain number of steps per trial.
82*8975f5c5SAndroid Build Coastguard Worker     virtual int getStepAlignment() const;
83*8975f5c5SAndroid Build Coastguard Worker 
isRenderTest()84*8975f5c5SAndroid Build Coastguard Worker     virtual bool isRenderTest() const { return false; }
85*8975f5c5SAndroid Build Coastguard Worker 
86*8975f5c5SAndroid Build Coastguard Worker   protected:
87*8975f5c5SAndroid Build Coastguard Worker     enum class RunTrialPolicy
88*8975f5c5SAndroid Build Coastguard Worker     {
89*8975f5c5SAndroid Build Coastguard Worker         FinishEveryStep,
90*8975f5c5SAndroid Build Coastguard Worker         RunContinuouslyWarmup,
91*8975f5c5SAndroid Build Coastguard Worker         RunContinuously,
92*8975f5c5SAndroid Build Coastguard Worker     };
93*8975f5c5SAndroid Build Coastguard Worker 
94*8975f5c5SAndroid Build Coastguard Worker     void run();
95*8975f5c5SAndroid Build Coastguard Worker     void SetUp() override;
96*8975f5c5SAndroid Build Coastguard Worker     void TearDown() override;
97*8975f5c5SAndroid Build Coastguard Worker 
98*8975f5c5SAndroid Build Coastguard Worker     // Normalize a time value according to the number of test trial iterations (mFrameCount)
99*8975f5c5SAndroid Build Coastguard Worker     double normalizedTime(size_t value) const;
100*8975f5c5SAndroid Build Coastguard Worker 
101*8975f5c5SAndroid Build Coastguard Worker     // Call if the test step was aborted and the test should stop running.
abortTest()102*8975f5c5SAndroid Build Coastguard Worker     void abortTest() { mRunning = false; }
103*8975f5c5SAndroid Build Coastguard Worker 
getNumStepsPerformed()104*8975f5c5SAndroid Build Coastguard Worker     int getNumStepsPerformed() const { return mTrialNumStepsPerformed; }
105*8975f5c5SAndroid Build Coastguard Worker 
106*8975f5c5SAndroid Build Coastguard Worker     void runTrial(double maxRunTime, int maxStepsToRun, RunTrialPolicy runPolicy);
107*8975f5c5SAndroid Build Coastguard Worker 
108*8975f5c5SAndroid Build Coastguard Worker     // Overriden in trace perf tests.
computeGPUTime()109*8975f5c5SAndroid Build Coastguard Worker     virtual void computeGPUTime() {}
110*8975f5c5SAndroid Build Coastguard Worker 
111*8975f5c5SAndroid Build Coastguard Worker     void calibrateStepsToRun();
112*8975f5c5SAndroid Build Coastguard Worker     int estimateStepsToRun() const;
113*8975f5c5SAndroid Build Coastguard Worker 
114*8975f5c5SAndroid Build Coastguard Worker     void recordIntegerMetric(const char *metric, size_t value, const std::string &units);
115*8975f5c5SAndroid Build Coastguard Worker     void recordDoubleMetric(const char *metric, double value, const std::string &units);
116*8975f5c5SAndroid Build Coastguard Worker     void addHistogramSample(const char *metric, double value, const std::string &units);
117*8975f5c5SAndroid Build Coastguard Worker 
118*8975f5c5SAndroid Build Coastguard Worker     void processResults();
119*8975f5c5SAndroid Build Coastguard Worker     void processClockResult(const char *metric, double resultSeconds);
120*8975f5c5SAndroid Build Coastguard Worker     void processMemoryResult(const char *metric, uint64_t resultKB);
121*8975f5c5SAndroid Build Coastguard Worker 
skipTest(const std::string & reason)122*8975f5c5SAndroid Build Coastguard Worker     void skipTest(const std::string &reason)
123*8975f5c5SAndroid Build Coastguard Worker     {
124*8975f5c5SAndroid Build Coastguard Worker         mSkipTestReason = reason;
125*8975f5c5SAndroid Build Coastguard Worker         mSkipTest       = true;
126*8975f5c5SAndroid Build Coastguard Worker     }
127*8975f5c5SAndroid Build Coastguard Worker 
failTest(const std::string & reason)128*8975f5c5SAndroid Build Coastguard Worker     void failTest(const std::string &reason)
129*8975f5c5SAndroid Build Coastguard Worker     {
130*8975f5c5SAndroid Build Coastguard Worker         skipTest(reason);
131*8975f5c5SAndroid Build Coastguard Worker         FAIL() << reason;
132*8975f5c5SAndroid Build Coastguard Worker     }
133*8975f5c5SAndroid Build Coastguard Worker 
134*8975f5c5SAndroid Build Coastguard Worker     void atraceCounter(const char *counterName, int64_t counterValue);
135*8975f5c5SAndroid Build Coastguard Worker 
136*8975f5c5SAndroid Build Coastguard Worker     std::string mName;
137*8975f5c5SAndroid Build Coastguard Worker     std::string mBackend;
138*8975f5c5SAndroid Build Coastguard Worker     std::string mStory;
139*8975f5c5SAndroid Build Coastguard Worker     Timer mTrialTimer;
140*8975f5c5SAndroid Build Coastguard Worker     uint64_t mGPUTimeNs;
141*8975f5c5SAndroid Build Coastguard Worker     bool mSkipTest;
142*8975f5c5SAndroid Build Coastguard Worker     std::string mSkipTestReason;
143*8975f5c5SAndroid Build Coastguard Worker     std::unique_ptr<perf_test::PerfResultReporter> mReporter;
144*8975f5c5SAndroid Build Coastguard Worker     int mStepsToRun;
145*8975f5c5SAndroid Build Coastguard Worker     int mTrialNumStepsPerformed;
146*8975f5c5SAndroid Build Coastguard Worker     int mTotalNumStepsPerformed;
147*8975f5c5SAndroid Build Coastguard Worker     int mIterationsPerStep;
148*8975f5c5SAndroid Build Coastguard Worker     bool mRunning;
149*8975f5c5SAndroid Build Coastguard Worker     std::vector<double> mTestTrialResults;
150*8975f5c5SAndroid Build Coastguard Worker 
151*8975f5c5SAndroid Build Coastguard Worker     struct CounterInfo
152*8975f5c5SAndroid Build Coastguard Worker     {
153*8975f5c5SAndroid Build Coastguard Worker         std::string name;
154*8975f5c5SAndroid Build Coastguard Worker         std::vector<GLuint64> samples;
155*8975f5c5SAndroid Build Coastguard Worker     };
156*8975f5c5SAndroid Build Coastguard Worker     std::map<GLuint, CounterInfo> mPerfCounterInfo;
157*8975f5c5SAndroid Build Coastguard Worker     GLuint mPerfMonitor;
158*8975f5c5SAndroid Build Coastguard Worker     std::vector<uint64_t> mProcessMemoryUsageKBSamples;
159*8975f5c5SAndroid Build Coastguard Worker };
160*8975f5c5SAndroid Build Coastguard Worker 
161*8975f5c5SAndroid Build Coastguard Worker enum class SurfaceType
162*8975f5c5SAndroid Build Coastguard Worker {
163*8975f5c5SAndroid Build Coastguard Worker     Window,
164*8975f5c5SAndroid Build Coastguard Worker     WindowWithVSync,
165*8975f5c5SAndroid Build Coastguard Worker     Offscreen,
166*8975f5c5SAndroid Build Coastguard Worker };
167*8975f5c5SAndroid Build Coastguard Worker 
168*8975f5c5SAndroid Build Coastguard Worker struct RenderTestParams : public angle::PlatformParameters
169*8975f5c5SAndroid Build Coastguard Worker {
170*8975f5c5SAndroid Build Coastguard Worker     RenderTestParams();
~RenderTestParamsRenderTestParams171*8975f5c5SAndroid Build Coastguard Worker     virtual ~RenderTestParams() {}
172*8975f5c5SAndroid Build Coastguard Worker 
173*8975f5c5SAndroid Build Coastguard Worker     virtual std::string backend() const;
174*8975f5c5SAndroid Build Coastguard Worker     virtual std::string story() const;
175*8975f5c5SAndroid Build Coastguard Worker     std::string backendAndStory() const;
176*8975f5c5SAndroid Build Coastguard Worker 
177*8975f5c5SAndroid Build Coastguard Worker     EGLint windowWidth             = 64;
178*8975f5c5SAndroid Build Coastguard Worker     EGLint windowHeight            = 64;
179*8975f5c5SAndroid Build Coastguard Worker     unsigned int iterationsPerStep = 0;
180*8975f5c5SAndroid Build Coastguard Worker     bool trackGpuTime              = false;
181*8975f5c5SAndroid Build Coastguard Worker     SurfaceType surfaceType        = SurfaceType::Window;
182*8975f5c5SAndroid Build Coastguard Worker     EGLenum colorSpace             = EGL_COLORSPACE_LINEAR;
183*8975f5c5SAndroid Build Coastguard Worker     bool multisample               = false;
184*8975f5c5SAndroid Build Coastguard Worker     EGLint samples                 = -1;
185*8975f5c5SAndroid Build Coastguard Worker };
186*8975f5c5SAndroid Build Coastguard Worker 
187*8975f5c5SAndroid Build Coastguard Worker class ANGLERenderTest : public ANGLEPerfTest
188*8975f5c5SAndroid Build Coastguard Worker {
189*8975f5c5SAndroid Build Coastguard Worker   public:
190*8975f5c5SAndroid Build Coastguard Worker     ANGLERenderTest(const std::string &name,
191*8975f5c5SAndroid Build Coastguard Worker                     const RenderTestParams &testParams,
192*8975f5c5SAndroid Build Coastguard Worker                     const char *units = "ns");
193*8975f5c5SAndroid Build Coastguard Worker     ~ANGLERenderTest() override;
194*8975f5c5SAndroid Build Coastguard Worker 
195*8975f5c5SAndroid Build Coastguard Worker     void addExtensionPrerequisite(std::string extensionName);
196*8975f5c5SAndroid Build Coastguard Worker     void addIntegerPrerequisite(GLenum target, int min);
197*8975f5c5SAndroid Build Coastguard Worker 
initializeBenchmark()198*8975f5c5SAndroid Build Coastguard Worker     virtual void initializeBenchmark() {}
destroyBenchmark()199*8975f5c5SAndroid Build Coastguard Worker     virtual void destroyBenchmark() {}
200*8975f5c5SAndroid Build Coastguard Worker 
201*8975f5c5SAndroid Build Coastguard Worker     virtual void drawBenchmark() = 0;
202*8975f5c5SAndroid Build Coastguard Worker 
203*8975f5c5SAndroid Build Coastguard Worker     bool popEvent(Event *event);
204*8975f5c5SAndroid Build Coastguard Worker 
205*8975f5c5SAndroid Build Coastguard Worker     OSWindow *getWindow();
206*8975f5c5SAndroid Build Coastguard Worker     GLWindowBase *getGLWindow();
207*8975f5c5SAndroid Build Coastguard Worker 
208*8975f5c5SAndroid Build Coastguard Worker     std::vector<TraceEvent> &getTraceEventBuffer();
209*8975f5c5SAndroid Build Coastguard Worker 
overrideWorkaroundsD3D(angle::FeaturesD3D * featuresD3D)210*8975f5c5SAndroid Build Coastguard Worker     virtual void overrideWorkaroundsD3D(angle::FeaturesD3D *featuresD3D) {}
211*8975f5c5SAndroid Build Coastguard Worker     void onErrorMessage(const char *errorMessage);
212*8975f5c5SAndroid Build Coastguard Worker 
213*8975f5c5SAndroid Build Coastguard Worker     uint32_t getCurrentThreadSerial();
getTraceEventMutex()214*8975f5c5SAndroid Build Coastguard Worker     std::mutex &getTraceEventMutex() { return mTraceEventMutex; }
isRenderTest()215*8975f5c5SAndroid Build Coastguard Worker     bool isRenderTest() const override { return true; }
216*8975f5c5SAndroid Build Coastguard Worker 
217*8975f5c5SAndroid Build Coastguard Worker   protected:
218*8975f5c5SAndroid Build Coastguard Worker     const RenderTestParams &mTestParams;
219*8975f5c5SAndroid Build Coastguard Worker 
220*8975f5c5SAndroid Build Coastguard Worker     void setWebGLCompatibilityEnabled(bool webglCompatibility);
221*8975f5c5SAndroid Build Coastguard Worker     void setRobustResourceInit(bool enabled);
222*8975f5c5SAndroid Build Coastguard Worker 
223*8975f5c5SAndroid Build Coastguard Worker     void startGpuTimer();
224*8975f5c5SAndroid Build Coastguard Worker     void stopGpuTimer();
225*8975f5c5SAndroid Build Coastguard Worker 
226*8975f5c5SAndroid Build Coastguard Worker     void beginInternalTraceEvent(const char *name);
227*8975f5c5SAndroid Build Coastguard Worker     void endInternalTraceEvent(const char *name);
228*8975f5c5SAndroid Build Coastguard Worker     void beginGLTraceEvent(const char *name, double hostTimeSec);
229*8975f5c5SAndroid Build Coastguard Worker     void endGLTraceEvent(const char *name, double hostTimeSec);
230*8975f5c5SAndroid Build Coastguard Worker 
disableTestHarnessSwap()231*8975f5c5SAndroid Build Coastguard Worker     void disableTestHarnessSwap() { mSwapEnabled = false; }
232*8975f5c5SAndroid Build Coastguard Worker     void updatePerfCounters();
233*8975f5c5SAndroid Build Coastguard Worker 
234*8975f5c5SAndroid Build Coastguard Worker     bool mIsTimestampQueryAvailable;
235*8975f5c5SAndroid Build Coastguard Worker     bool mEnableDebugCallback = true;
236*8975f5c5SAndroid Build Coastguard Worker 
237*8975f5c5SAndroid Build Coastguard Worker     void startTest() override;
238*8975f5c5SAndroid Build Coastguard Worker     void finishTest() override;
239*8975f5c5SAndroid Build Coastguard Worker 
240*8975f5c5SAndroid Build Coastguard Worker   private:
241*8975f5c5SAndroid Build Coastguard Worker     void SetUp() override;
242*8975f5c5SAndroid Build Coastguard Worker     void TearDown() override;
243*8975f5c5SAndroid Build Coastguard Worker 
244*8975f5c5SAndroid Build Coastguard Worker     void step() override;
245*8975f5c5SAndroid Build Coastguard Worker     void computeGPUTime() override;
246*8975f5c5SAndroid Build Coastguard Worker 
247*8975f5c5SAndroid Build Coastguard Worker     void skipTestIfMissingExtensionPrerequisites();
248*8975f5c5SAndroid Build Coastguard Worker     void skipTestIfFailsIntegerPrerequisite();
249*8975f5c5SAndroid Build Coastguard Worker 
250*8975f5c5SAndroid Build Coastguard Worker     void initPerfCounters();
251*8975f5c5SAndroid Build Coastguard Worker 
252*8975f5c5SAndroid Build Coastguard Worker     GLWindowBase *mGLWindow;
253*8975f5c5SAndroid Build Coastguard Worker     OSWindow *mOSWindow;
254*8975f5c5SAndroid Build Coastguard Worker     std::vector<std::string> mExtensionPrerequisites;
255*8975f5c5SAndroid Build Coastguard Worker     struct IntegerPrerequisite
256*8975f5c5SAndroid Build Coastguard Worker     {
257*8975f5c5SAndroid Build Coastguard Worker         GLenum target;
258*8975f5c5SAndroid Build Coastguard Worker         int min;
259*8975f5c5SAndroid Build Coastguard Worker     };
260*8975f5c5SAndroid Build Coastguard Worker     std::vector<IntegerPrerequisite> mIntegerPrerequisites;
261*8975f5c5SAndroid Build Coastguard Worker     angle::PlatformMethods mPlatformMethods;
262*8975f5c5SAndroid Build Coastguard Worker     ConfigParameters mConfigParams;
263*8975f5c5SAndroid Build Coastguard Worker     bool mSwapEnabled;
264*8975f5c5SAndroid Build Coastguard Worker 
265*8975f5c5SAndroid Build Coastguard Worker     struct TimestampSample
266*8975f5c5SAndroid Build Coastguard Worker     {
267*8975f5c5SAndroid Build Coastguard Worker         GLuint beginQuery;
268*8975f5c5SAndroid Build Coastguard Worker         GLuint endQuery;
269*8975f5c5SAndroid Build Coastguard Worker     };
270*8975f5c5SAndroid Build Coastguard Worker 
271*8975f5c5SAndroid Build Coastguard Worker     GLuint mCurrentTimestampBeginQuery = 0;
272*8975f5c5SAndroid Build Coastguard Worker     std::queue<TimestampSample> mTimestampQueries;
273*8975f5c5SAndroid Build Coastguard Worker 
274*8975f5c5SAndroid Build Coastguard Worker     // Trace event record that can be output.
275*8975f5c5SAndroid Build Coastguard Worker     std::vector<TraceEvent> mTraceEventBuffer;
276*8975f5c5SAndroid Build Coastguard Worker 
277*8975f5c5SAndroid Build Coastguard Worker     // Handle to the entry point binding library.
278*8975f5c5SAndroid Build Coastguard Worker     std::unique_ptr<angle::Library> mEntryPointsLib;
279*8975f5c5SAndroid Build Coastguard Worker 
280*8975f5c5SAndroid Build Coastguard Worker     std::vector<uint64_t> mThreadIDs;
281*8975f5c5SAndroid Build Coastguard Worker     std::mutex mTraceEventMutex;
282*8975f5c5SAndroid Build Coastguard Worker };
283*8975f5c5SAndroid Build Coastguard Worker 
284*8975f5c5SAndroid Build Coastguard Worker // Mixins.
285*8975f5c5SAndroid Build Coastguard Worker namespace params
286*8975f5c5SAndroid Build Coastguard Worker {
287*8975f5c5SAndroid Build Coastguard Worker template <typename ParamsT>
Offscreen(const ParamsT & input)288*8975f5c5SAndroid Build Coastguard Worker ParamsT Offscreen(const ParamsT &input)
289*8975f5c5SAndroid Build Coastguard Worker {
290*8975f5c5SAndroid Build Coastguard Worker     ParamsT output     = input;
291*8975f5c5SAndroid Build Coastguard Worker     output.surfaceType = SurfaceType::Offscreen;
292*8975f5c5SAndroid Build Coastguard Worker     return output;
293*8975f5c5SAndroid Build Coastguard Worker }
294*8975f5c5SAndroid Build Coastguard Worker 
295*8975f5c5SAndroid Build Coastguard Worker template <typename ParamsT>
NullDevice(const ParamsT & input)296*8975f5c5SAndroid Build Coastguard Worker ParamsT NullDevice(const ParamsT &input)
297*8975f5c5SAndroid Build Coastguard Worker {
298*8975f5c5SAndroid Build Coastguard Worker     ParamsT output                  = input;
299*8975f5c5SAndroid Build Coastguard Worker     output.eglParameters.deviceType = EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE;
300*8975f5c5SAndroid Build Coastguard Worker     output.trackGpuTime             = false;
301*8975f5c5SAndroid Build Coastguard Worker     return output;
302*8975f5c5SAndroid Build Coastguard Worker }
303*8975f5c5SAndroid Build Coastguard Worker 
304*8975f5c5SAndroid Build Coastguard Worker template <typename ParamsT>
Passthrough(const ParamsT & input)305*8975f5c5SAndroid Build Coastguard Worker ParamsT Passthrough(const ParamsT &input)
306*8975f5c5SAndroid Build Coastguard Worker {
307*8975f5c5SAndroid Build Coastguard Worker     return input;
308*8975f5c5SAndroid Build Coastguard Worker }
309*8975f5c5SAndroid Build Coastguard Worker }  // namespace params
310*8975f5c5SAndroid Build Coastguard Worker 
311*8975f5c5SAndroid Build Coastguard Worker namespace angle
312*8975f5c5SAndroid Build Coastguard Worker {
313*8975f5c5SAndroid Build Coastguard Worker // Returns the time of the host since the application started in seconds.
314*8975f5c5SAndroid Build Coastguard Worker double GetHostTimeSeconds();
315*8975f5c5SAndroid Build Coastguard Worker }  // namespace angle
316*8975f5c5SAndroid Build Coastguard Worker #endif  // PERF_TESTS_ANGLE_PERF_TEST_H_
317