#include "center.h" #include "defs.h" #include "log.h" #include "util.h" #include #include #include #include #include #include namespace { bool InitLog() { ns_log::AddLog("/tmp/bhshmq_test.log", true, true); ns_log::ResetLogLevel(ns_log::LogLevel::debug); return true; } static bool g_test_init_log = InitLog(); } // namespace using namespace bhome_shm; using namespace bhome_msg; SharedMemory &TestShm() { static SharedMemory shm("utest_0", 1024 * 1024 * 512); return shm; } template struct IsSameType { static const bool value = false; }; template struct IsSameType { static const bool value = true; }; BOOST_AUTO_TEST_CASE(Temp) { const std::string shm_name("ShmTemp"); ShmRemover auto_remove(shm_name); //remove twice? in case of killed? SharedMemory shm(shm_name, 1024 * 1024 * 10); typedef std::chrono::steady_clock clock; int n = 1000 * 1000; std::vector tps(n); { printf("thread switch %d times, ", n); boost::timer::auto_cpu_timer timer; for (auto &tp : tps) { tp = clock::now(); std::this_thread::yield(); } } printf("time: %ld ns\n", (tps.back() - tps.front()).count()); } int test_main(int argc, char *argv[]) { printf("test main\n"); int a = 0; int b = 0; BOOST_CHECK_EQUAL(a, b); return 0; }