void printbuf() { log_printline(m_lev, m_buf); #ifdef __ANDROID__ __android_log_print(ANDROID_LOG_ERROR, PROJECT_NAME, "%s", m_buf.c_str()); #endif }
// log([level,] text) // Writes a line to the logger. // The one-argument version logs to infostream. // The two-argument version accept a log level: error, action, info, or verbose. int ModApiUtil::l_log(lua_State *L) { NO_MAP_LOCK_REQUIRED; std::string text; LogMessageLevel level = LMT_INFO; if (lua_isnone(L, 2)) { text = lua_tostring(L, 1); } else { std::string levelname = luaL_checkstring(L, 1); text = luaL_checkstring(L, 2); if(levelname == "error") level = LMT_ERROR; else if(levelname == "action") level = LMT_ACTION; else if(levelname == "verbose") level = LMT_VERBOSE; else if (levelname == "deprecated") { log_deprecated(L,text); return 0; } } log_printline(level, text); return 0; }
void printbuf() { log_printline(m_lev, m_buf); #ifdef __ANDROID__ __android_log_print(android_log_level_mapping[m_lev], PROJECT_NAME, "%s", m_buf.c_str()); #endif }
static void set_bench_modify_randomly() { int i; log_printline("[number of modify: %d]", __num_modify); dbg_assert(iset_empty(__set)); for (i = 0; i < __num_modify; i ++) { intptr_t x = rand() % __data_diff_type; bool found = iset_contains(__set, s_test_data_addr[x]); if (found == false) { iset_insert(__set, s_test_data_addr[x]); data_count[x] ++; } else { iset_remove(__set, s_test_data_addr[x]); data_count[x] --; } } iset_clear(__set); }
// log([level,] text) // Writes a line to the logger. // The one-argument version logs to infostream. // The two-argument version accept a log level: error, action, info, or verbose. static int l_log(lua_State *L) { std::string text; LogMessageLevel level = LMT_INFO; if(lua_isnone(L, 2)) { text = lua_tostring(L, 1); } else { std::string levelname = luaL_checkstring(L, 1); text = luaL_checkstring(L, 2); if(levelname == "error") level = LMT_ERROR; else if(levelname == "action") level = LMT_ACTION; else if(levelname == "verbose") level = LMT_VERBOSE; } log_printline(level, text); return 0; }
static void set_bench_search_randomly() { int i; dbg_assert(iset_empty(__set)); log_printline("[number of search: %d]", __num_search); for (i = 0; i < __data_diff_type; i ++) { /* insert all data one by one */ iset_insert(__set, s_test_data_addr[i]); } /* now the set contains __data_diff_type * 2 of data, each elememt int [0, __data_diff_type) * appears at least once */ for (i = 0; i < __num_search; i ++) { intptr_t x = rand() % __data_diff_type; bool res = iset_contains(__set, s_test_data_addr[x]); dbg_assert(res == true); } iset_clear(__set); }
void printbuf() { log_printline(m_lev, m_buf); }
void set_test_bench(_object* set, struct test_data_desc* td_desc) { __set = set; __data_diff_type = 100; __data_max_count = 1; __num_modify = 100; __num_search = 100; iset_clear(__set); log_printline("[data type: %d, single data max dup: %d]", __data_diff_type, __data_max_count); s_test_data_addr = td_desc->data_repo; __create_data(); test_run_single("randomly modify test", set_bench_modify_randomly); __destroy_data(); test_run_single("randomly search test", set_bench_search_randomly); __num_modify = 100000; __num_search = 100; __create_data(); test_run_single("randomly modify test", set_bench_modify_randomly); __destroy_data(); __num_modify = 100; __num_search = 100000; test_run_single("randomly search test", set_bench_search_randomly); __data_diff_type = 5000; log_printline("[data type: %d, single data max dup: %d]", __data_diff_type, __data_max_count); __num_modify = 100000; __num_search = 100; __create_data(); test_run_single("randomly modify test", set_bench_modify_randomly); __destroy_data(); __num_modify = 100; __num_search = 100000; test_run_single("randomly search test", set_bench_search_randomly); __data_diff_type = 100000; log_printline("[data type: %d, single data max dup: %d]", __data_diff_type, __data_max_count); __num_modify = 100000; __num_search = 100; __create_data(); test_run_single("randomly modify test", set_bench_modify_randomly); __destroy_data(); __num_modify = 100; __num_search = 100000; test_run_single("randomly search test", set_bench_search_randomly); __data_diff_type = 100000; log_printline("[data type: %d, single data max dup: %d]", __data_diff_type, __data_max_count); __num_modify = 1000000; __num_search = 100; __create_data(); test_run_single("randomly modify test", set_bench_modify_randomly); __destroy_data(); __num_modify = 100; __num_search = 1000000; test_run_single("randomly search test", set_bench_search_randomly); }