axmol/tests/cpp-tests/Classes/PerformanceTest/PerformanceMathTest.h

74 lines
2.0 KiB
C
Raw Normal View History

2014-11-22 15:47:23 +08:00
#ifndef __PERFORMANCE_MATH_TEST_H__
#define __PERFORMANCE_MATH_TEST_H__
#include "PerformanceTest.h"
class PerformanceMathLayer : public PerformBasicLayer
{
public:
PerformanceMathLayer(bool bControlMenuVisible, int nMaxCases = 0, int nCurCase = 0):
PerformBasicLayer(bControlMenuVisible, nMaxCases, nCurCase)
, _loopCount(1000)
, _stepCount(500)
, _profileName("")
{
}
virtual void onEnter() override;
virtual void restartCallback(Ref* sender) override;
virtual void nextCallback(Ref* sender) override;
virtual void backCallback(Ref* sender) override;
2014-11-22 15:47:23 +08:00
virtual void showCurrentTest() {}
virtual std::string title() const { return "Math Performance Test"; }
virtual std::string subtitle() const { return "PerformanceMathLayer subTitle"; }
void addLoopCount(Ref* sender);
void subLoopCount(Ref* sender);
protected:
virtual void doPerformanceTest(float dt) {};
void dumpProfilerInfo(float dt);
void updateLoopLabel();
protected:
int _loopCount;
int _stepCount;
std::string _profileName;
};
class PerformanceMathLayer1 : public PerformanceMathLayer
{
public:
PerformanceMathLayer1(bool bControlMenuVisible, int nMaxCases = 0, int nCurCase = 0):
PerformanceMathLayer(bControlMenuVisible, nMaxCases, nCurCase)
{
_profileName = "profile_Mat4*Mat4";
}
virtual void doPerformanceTest(float dt) override;
virtual std::string subtitle() const { return "Mat4 * Mat4"; }
private:
};
class PerformanceMathLayer2 : public PerformanceMathLayer
{
public:
PerformanceMathLayer2(bool bControlMenuVisible, int nMaxCases = 0, int nCurCase = 0):
PerformanceMathLayer(bControlMenuVisible, nMaxCases, nCurCase)
{
_profileName = "profile_MatTransformVec4";
}
virtual void doPerformanceTest(float dt) override;
virtual std::string subtitle() const { return "Mat4 TransformVec4"; }
};
void runMathPerformanceTest();
#endif //__PERFORMANCE_MATH_TEST_H__