bool switchBenchmark() { std::cout << "===== switch benchmark =====" << std::endl; { std::cout << "switch" << std::endl; BenchmarkSet bs; bs.prefixes.push_back("switch"); for(size_t i = 0; i < funCount; ++i) { BenchmarkParameters params; params.itemCount = counts[i]; params.iterCount = iterCount; params.testName = "switch"; if(!runSwitch(params, i)) { return false; } bs.params.push_back(params); } resultToFile(bs); } std::cout << "map" << std::endl; if(!runMap<std::map<uint32_t, uint32_t>>("map")) { return false; } std::cout << "unordered_map" << std::endl; if(!runMap<std::unordered_map<uint32_t, uint32_t>>("unordered_map")) { return false; } return true; }
void CDttSP::process() { while (m_running) { m_buffer->Wait(); while (canHold()) { getHold(); m_update->Wait(); switch (m_state) { case RUN_PLAY: runPlay(); break; case RUN_SWITCH: runSwitch(); break; } m_update->Post(); } } }