2013-09-06 11:02:04 +08:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#ifndef __PERFORMANCE_ALLOC_TEST_H__
|
|
|
|
#define __PERFORMANCE_ALLOC_TEST_H__
|
|
|
|
|
2015-05-11 16:26:14 +08:00
|
|
|
#include "BaseTest.h"
|
2013-09-06 11:02:04 +08:00
|
|
|
|
2015-05-11 16:26:14 +08:00
|
|
|
DEFINE_TEST_SUITE(PerformceAllocTests);
|
2013-09-06 11:02:04 +08:00
|
|
|
|
2015-05-11 16:26:14 +08:00
|
|
|
class PerformceAllocScene : public TestCase
|
2013-09-06 11:02:04 +08:00
|
|
|
{
|
|
|
|
public:
|
2015-05-11 16:26:14 +08:00
|
|
|
virtual bool init() override;
|
2013-09-06 11:02:04 +08:00
|
|
|
virtual void initWithQuantityOfNodes(unsigned int nNodes);
|
2015-07-15 12:04:48 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
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;
|
2015-05-11 16:26:14 +08:00
|
|
|
static int quantityOfNodes;
|
2013-09-06 11:02:04 +08:00
|
|
|
int currentQuantityOfNodes;
|
|
|
|
};
|
|
|
|
|
|
|
|
class NodeCreateTest : public PerformceAllocScene
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 07:55:36 +08:00
|
|
|
CREATE_FUNC(NodeCreateTest);
|
|
|
|
|
2015-03-15 07:10:08 +08:00
|
|
|
virtual void updateQuantityOfNodes() override;
|
|
|
|
virtual void initWithQuantityOfNodes(unsigned int nNodes) override;
|
2015-03-15 02:33:15 +08:00
|
|
|
virtual void update(float dt) override;
|
2015-03-15 07:10:08 +08:00
|
|
|
virtual const char* testName() override;
|
2013-09-06 11:02:04 +08:00
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
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);
|
|
|
|
|
2015-03-15 07:10:08 +08:00
|
|
|
virtual void updateQuantityOfNodes() override;
|
|
|
|
virtual void initWithQuantityOfNodes(unsigned int nNodes) override;
|
2015-03-15 02:33:15 +08:00
|
|
|
virtual void update(float dt) override;
|
2015-03-15 07:10:08 +08:00
|
|
|
virtual const char* testName() override;
|
2013-09-06 11:02:04 +08:00
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
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);
|
|
|
|
|
2015-03-15 07:10:08 +08:00
|
|
|
virtual void updateQuantityOfNodes() override;
|
|
|
|
virtual void initWithQuantityOfNodes(unsigned int nNodes) override;
|
2015-03-15 02:33:15 +08:00
|
|
|
virtual void update(float dt) override;
|
2015-03-15 07:10:08 +08:00
|
|
|
virtual const char* testName() override;
|
2013-09-06 12:35:15 +08:00
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
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);
|
|
|
|
|
2015-03-15 07:10:08 +08:00
|
|
|
virtual void updateQuantityOfNodes() override;
|
|
|
|
virtual void initWithQuantityOfNodes(unsigned int nNodes) override;
|
2015-03-15 02:33:15 +08:00
|
|
|
virtual void update(float dt) override;
|
2015-03-15 07:10:08 +08:00
|
|
|
virtual const char* testName() override;
|
2013-09-06 11:02:04 +08:00
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
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);
|
|
|
|
|
2015-03-15 07:10:08 +08:00
|
|
|
virtual void updateQuantityOfNodes() override;
|
|
|
|
virtual void initWithQuantityOfNodes(unsigned int nNodes) override;
|
2015-03-15 02:33:15 +08:00
|
|
|
virtual void update(float dt) override;
|
2015-03-15 07:10:08 +08:00
|
|
|
virtual const char* testName() override;
|
2013-09-06 11:02:04 +08:00
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2013-09-06 11:02:04 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __PERFORMANCE_ALLOC_TEST_H__
|