void SpriteMainScene::endStat(float dt) { unschedule(CC_SCHEDULE_SELECTOR(SpriteMainScene::endStat)); isStating = false; // record test data auto typeStr = getTestCaseName(); auto avgStr = genStr("%.2f", (float) statCount / totalStatTime); Profile::getInstance()->addTestResult(genStrVector(genStr("%d", _quantityNodes).c_str(), typeStr.c_str(), genStr("%d", _subtestNumber).c_str(), nullptr), genStrVector(avgStr.c_str(), genStr("%.2f", minFrameRate).c_str(), genStr("%.2f", maxFrameRate).c_str(), nullptr)); // check the auto test is end or not int autoTestCount = sizeof(autoTestSpriteCounts) / sizeof(int); if (autoTestIndex >= (autoTestCount - 1) && _subtestNumber >= MAX_SUB_TEST_NUM) { // auto test end Profile::getInstance()->testCaseEnd(); setAutoTesting(false); return; } if (autoTestIndex >= (autoTestCount - 1)) { autoTestIndex = 0; _subtestNumber++; } else { autoTestIndex++; } doAutoTest(); }
void NodeChildrenMainScene::dumpProfilerInfo(float dt) { CC_PROFILER_DISPLAY_TIMERS(); if (this->isAutoTesting()) { // record the test result to class Profile auto timer = Profiler::getInstance()->_activeTimers.at(_profilerName); auto numStr = genStr("%d", quantityOfNodes); auto avgStr = genStr("%ldµ", timer->_averageTime2); auto minStr = genStr("%ldµ", timer->minTime); auto maxStr = genStr("%ldµ", timer->maxTime); Profile::getInstance()->addTestResult(genStrVector(getTestCaseName().c_str(), numStr.c_str(), nullptr), genStrVector(avgStr.c_str(), minStr.c_str(), maxStr.c_str(), nullptr)); auto testsSize = sizeof(autoTestNodesNums)/sizeof(int); if (autoTestIndex >= (testsSize - 1)) { // if it's the last one of auto test. End the auto test. this->setAutoTesting(false); Profile::getInstance()->testCaseEnd(); } else { // update the auto test index autoTestIndex++; quantityOfNodes = autoTestNodesNums[autoTestIndex]; updateQuantityLabel(); updateQuantityOfNodes(); updateProfilerName(); CC_PROFILER_PURGE_ALL(); } } }