void PerformanceMainLayer::menuCallback(CCObject* pSender) { CCMenuItemFont* pItem = (CCMenuItemFont*)pSender; int nIndex = pItem->getZOrder() - kItemTagBasic; switch (nIndex) { case 0: runNodeChildrenTest(); break; case 1: runParticleTest(); break; case 2: runSpriteTest(); break; case 3: runTextureTest(); break; case 4: runTouchesTest(); break; default: break; } }
#include "PerformanceMathTest.h" enum { LINE_SPACE = 40, kItemTagBasic = 1000, }; struct { const char *name; std::function<void(Ref*)> callback; } g_testsName[] = { { "Alloc Test", [](Ref*sender){runAllocPerformanceTest(); } }, { "NodeChildren Test", [](Ref*sender){runNodeChildrenTest();} }, { "Particle Test",[](Ref*sender){runParticleTest();} }, { "Particle3D Perf Test",[](Ref*sender){runParticle3DTest();} }, { "Sprite Perf Test",[](Ref*sender){runSpriteTest();} }, { "Texture Perf Test",[](Ref*sender){runTextureTest();} }, { "Touches Perf Test",[](Ref*sender){runTouchesTest();} }, { "Label Perf Test",[](Ref*sender){runLabelTest();} }, //{ "Renderer Perf Test",[](Ref*sender){runRendererTest();} }, { "Container Perf Test", [](Ref* sender ) { runContainerPerformanceTest(); } }, { "EventDispatcher Perf Test", [](Ref* sender ) { runEventDispatcherPerformanceTest(); } }, { "Scenario Perf Test", [](Ref* sender ) { runScenarioTest(); } }, { "Callback Perf Test", [](Ref* sender ) { runCallbackPerformanceTest(); } }, { "Math Perf Test", [](Ref* sender ) { runMathPerformanceTest(); } }, }; static const int g_testMax = sizeof(g_testsName)/sizeof(g_testsName[0]);
int main(int argc, char *argv[]) { // Initialize POOMA and output stream, using Tester class startParticleTest(argc, argv, "SpatialLayout: A=MPDynamic, F=RM+MPBrick"); // Typedefs for what we are simulating here. typedef MultiPatch<DynamicTag,Dynamic> AttrEngineTag_t; typedef MultiPatch<GridTag,Brick> FieldEngineTag_t; typedef RectilinearMesh<2> Mesh_t; typedef Field<Mesh_t,double,FieldEngineTag_t> Field_t; typedef Field_t::Layout_t FieldLayout_t; typedef SpatialLayout<Mesh_t,FieldLayout_t> ParLayout_t; typedef TestParTraits<AttrEngineTag_t,ParLayout_t> ParTraits_t; typedef ParLayout_t::PointType_t PointType_t; // Specify the mesh parameters. Interval<2> meshDomain(12, 24); PointType_t meshOrigin(1.0, 2.0); PointType_t meshSpacing(0.5, 0.5); // Let things catch up Pooma::blockAndEvaluate(); // The size of the mesh. Region<2,double> box; for (int d=0; d < 2; ++d) box[d] = Region<1>(meshOrigin(d), meshOrigin(d) + 0.5 * (meshDomain[d].length() - 1)); // Create a FieldLayout object. We don't actually need a Field in // this example, though, just the layout. Loc<2> blocks(3, 4); FieldLayout_t flayout(meshDomain, blocks, ReplicatedTag()); // Create a Mesh and Geometry. Mesh_t mesh(flayout, meshOrigin, meshSpacing); // Create a particle layout object. ParLayout_t layout(mesh, flayout); // Create a Particles object, using our special subclass. TestParticles<ParTraits_t> P(layout); // Run the tests. runParticleTest(P, box); // Return resulting error code and exit return endParticleTest("SpatialLayout: A=MPDynamic, F=RM+MPBrick"); }