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

123 lines
3.0 KiB
C
Raw Normal View History

2013-09-06 11:02:04 +08:00
/*
*
*/
#ifndef __PERFORMANCE_ALLOC_TEST_H__
#define __PERFORMANCE_ALLOC_TEST_H__
#include "PerformanceTest.h"
#include "CCProfiling.h"
2013-09-06 11:02:04 +08:00
class AllocBasicLayer : public PerformBasicLayer
{
public:
AllocBasicLayer(bool bControlMenuVisible, int nMaxCases = 0, int nCurCase = 0);
virtual void showCurrentTest();
};
class PerformceAllocScene : public Scene
{
public:
virtual void initWithQuantityOfNodes(unsigned int nNodes);
virtual std::string title() const;
virtual std::string subtitle() const;
2013-09-06 11:02:04 +08:00
virtual void updateQuantityOfNodes() = 0;
const char* profilerName();
void updateProfilerName();
// for the profiler
virtual const char* testName() = 0;
void updateQuantityLabel();
int getQuantityOfNodes() { return quantityOfNodes; }
void dumpProfilerInfo(float dt);
// overrides
virtual void onExitTransitionDidStart() override;
virtual void onEnterTransitionDidFinish() override;
protected:
char _profilerName[256];
int lastRenderedCount;
int quantityOfNodes;
int currentQuantityOfNodes;
};
class NodeCreateTest : public PerformceAllocScene
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(NodeCreateTest);
2013-09-06 11:02:04 +08:00
virtual void updateQuantityOfNodes();
virtual void initWithQuantityOfNodes(unsigned int nNodes);
virtual void update(float dt);
virtual const char* testName();
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-09-06 11:02:04 +08:00
};
class NodeDeallocTest : public PerformceAllocScene
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(NodeDeallocTest);
2013-09-06 11:02:04 +08:00
virtual void updateQuantityOfNodes();
virtual void initWithQuantityOfNodes(unsigned int nNodes);
virtual void update(float dt);
virtual const char* testName();
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-09-06 11:02:04 +08:00
};
2013-09-06 12:35:15 +08:00
class SpriteCreateEmptyTest : public PerformceAllocScene
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(SpriteCreateEmptyTest);
2013-09-06 12:35:15 +08:00
virtual void updateQuantityOfNodes();
virtual void initWithQuantityOfNodes(unsigned int nNodes);
virtual void update(float dt);
virtual const char* testName();
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-09-06 12:35:15 +08:00
};
2013-09-06 11:02:04 +08:00
class SpriteCreateTest : public PerformceAllocScene
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(SpriteCreateTest);
2013-09-06 11:02:04 +08:00
virtual void updateQuantityOfNodes();
virtual void initWithQuantityOfNodes(unsigned int nNodes);
virtual void update(float dt);
virtual const char* testName();
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-09-06 11:02:04 +08:00
};
class SpriteDeallocTest : public PerformceAllocScene
{
public:
2013-11-14 07:55:36 +08:00
CREATE_FUNC(SpriteDeallocTest);
2013-09-06 11:02:04 +08:00
virtual void updateQuantityOfNodes();
virtual void initWithQuantityOfNodes(unsigned int nNodes);
virtual void update(float dt);
virtual const char* testName();
virtual std::string title() const override;
virtual std::string subtitle() const override;
2013-09-06 11:02:04 +08:00
};
void runAllocPerformanceTest();
#endif // __PERFORMANCE_ALLOC_TEST_H__