diff --git a/src/maat_compile.c b/src/maat_compile.c index 44e1f8f..8e8961d 100644 --- a/src/maat_compile.c +++ b/src/maat_compile.c @@ -132,10 +132,10 @@ struct clause_literal { struct compile_clause { long long clause_id; - UT_array *literals; - char not_flag; // 1 byte - char in_use; // 1 byte - char pad[6]; // for 8 bytes alignment + UT_array *literals; //struct clause_literal + char not_flag; // 1 byte + char in_use; // 1 byte + char pad[6]; // for 8 bytes alignment }; struct compile_sort_para { @@ -854,8 +854,8 @@ static inline int compare_group_id(const void *a, const void *b) } } -void compile_clause_add_literal(struct compile_clause *clause, - struct group2compile_item *g2c_item) +static void compile_clause_add_literal(struct compile_clause *clause, + struct group2compile_item *g2c_item) { struct clause_literal tmp_literal; tmp_literal.vtable_id = g2c_item->vtable_id; @@ -865,7 +865,7 @@ void compile_clause_add_literal(struct compile_clause *clause, for (size_t i = 0; i < utarray_len(g2c_item->group_ids); i++) { tmp_literal.group_ids[i] = *(long long *)utarray_eltptr(g2c_item->group_ids, i); } - utarray_push_back(clause->literals, &tmp_literal); + utarray_push_back(clause->literals, &tmp_literal); } void compile_clause_remove_literal(struct compile_clause *clause, @@ -883,11 +883,12 @@ void compile_clause_remove_literal(struct compile_clause *clause, } } -int compile_clause_find_literal(struct compile_clause *clause, - struct group2compile_item *g2c_item) +static int maat_compile_clause_find_literal(struct maat_compile *compile, + struct group2compile_item *g2c_item) { - int found = 0; + struct compile_clause *clause = compile->clauses + g2c_item->clause_index; struct clause_literal *tmp_literal = NULL; + int found = 0; for (size_t i = 0; i < utarray_len(clause->literals); i++) { tmp_literal = (struct clause_literal *)utarray_eltptr(clause->literals, i); @@ -899,8 +900,8 @@ int compile_clause_find_literal(struct compile_clause *clause, return found; } -static int maat_compile_clause_add_literal(struct maat_compile *compile, - struct group2compile_item *g2c_item) +static void maat_compile_clause_add_literal(struct maat_compile *compile, + struct group2compile_item *g2c_item) { struct compile_clause *clause = compile->clauses + g2c_item->clause_index; @@ -911,35 +912,19 @@ static int maat_compile_clause_add_literal(struct maat_compile *compile, compile->actual_clause_num++; } - if (compile_clause_find_literal(clause, g2c_item) > 0) { - //found - return -1; - } - compile_clause_add_literal(clause, g2c_item); - - return 0; } -static int maat_compile_clause_remove_literal(struct maat_compile *compile, - struct group2compile_item *g2c_item) +static void maat_compile_clause_remove_literal(struct maat_compile *compile, + struct group2compile_item *g2c_item) { struct compile_clause *clause = compile->clauses + g2c_item->clause_index; - - if (0 == compile_clause_find_literal(clause, g2c_item)) { - //not found - return -1; - } - compile_clause_remove_literal(clause, g2c_item); - if (0 == utarray_len(clause->literals)) { clause->in_use = 0; compile->actual_clause_num--; } - - return 0; } static struct bool_matcher * @@ -1328,23 +1313,23 @@ static int maat_add_group_to_compile(struct rcu_hash_table *hash_tbl, if (1 == updating_flag) { compile = rcu_updating_hash_find(hash_tbl, (char *)&compile_id, sizeof(long long)); if (compile != NULL) { - /* compile found in updating hash(added by compile runtime), it can be modified directly */ - ret = maat_compile_clause_add_literal(compile, g2c_item); - if (ret < 0) { + ret = maat_compile_clause_find_literal(compile, g2c_item); + if (ret > 0) { log_fatal(logger, MODULE_COMPILE, - "[%s:%d] add clause(index:%d) to compile %lld failed", - __FUNCTION__, __LINE__, g2c_item->clause_index, compile_id); + "[%s:%d]compile:%lld clause(index:%d) already has vtable_id:%d's " + "literal, can't add again", __FUNCTION__, __LINE__, compile->compile_id, + g2c_item->clause_index, g2c_item->vtable_id); + return -1; } + /* compile found in updating hash(added by compile runtime), it can + * be modified directly */ + maat_compile_clause_add_literal(compile, g2c_item); } else { /* compile neither in effective hash nor in updating hash, so new one */ compile = maat_compile_new(compile_id); assert(compile != NULL); - ret = maat_compile_clause_add_literal(compile, g2c_item); - if (ret < 0) { - log_fatal(logger, MODULE_COMPILE, - "[%s:%d] add clause(index:%d) to compile %lld failed", - __FUNCTION__, __LINE__, g2c_item->clause_index, compile_id); - } + + maat_compile_clause_add_literal(compile, g2c_item); rcu_hash_add(hash_tbl, (char *)&compile_id, sizeof(long long), compile); } } else { @@ -1359,29 +1344,28 @@ static int maat_add_group_to_compile(struct rcu_hash_table *hash_tbl, can only be deleted but not modified before delete it, we need to make a copy for further use *********************************************************************/ + ret = maat_compile_clause_find_literal(compile, g2c_item); + if (ret > 0) { + log_fatal(logger, MODULE_COMPILE, + "[%s:%d]compile:%lld clause(index:%d) already has vtable_id:%d's " + "literal, can't add again", __FUNCTION__, __LINE__, compile->compile_id, + g2c_item->clause_index, g2c_item->vtable_id); + return -1; + } + struct maat_compile *copy_compile = maat_compile_clone(compile, 1); assert(copy_compile != NULL); /* delete compile from rcu hash */ rcu_hash_del(hash_tbl, (char *)&compile_id, sizeof(long long)); - ret = maat_compile_clause_add_literal(copy_compile, g2c_item); - if (ret < 0) { - log_fatal(logger, MODULE_COMPILE, - "[%s:%d] add clause(index:%d) to compile %lld failed", - __FUNCTION__, __LINE__, g2c_item->clause_index, compile_id); - } - + maat_compile_clause_add_literal(copy_compile, g2c_item); rcu_hash_add(hash_tbl, (char *)&compile_id, sizeof(long long), copy_compile); } else { compile = maat_compile_new(compile_id); assert(compile != NULL); - ret = maat_compile_clause_add_literal(compile, g2c_item); - if (ret < 0) { - log_fatal(logger, MODULE_COMPILE, - "[%s:%d] add clause(index:%d) to compile %lld failed", - __FUNCTION__, __LINE__, g2c_item->clause_index, compile_id); - } + + maat_compile_clause_add_literal(compile, g2c_item); rcu_hash_add(hash_tbl, (char *)&compile_id, sizeof(long long), compile); } } @@ -1408,15 +1392,17 @@ static int maat_remove_group_from_compile(struct rcu_hash_table *hash_tbl, g2c_item->clause_index, compile_id); return -1; } else { - /* compile found in updating hash, it can be modified directly */ - ret = maat_compile_clause_remove_literal(compile, g2c_item); - if (ret < 0) { + ret = maat_compile_clause_find_literal(compile, g2c_item); + if (0 == ret) { log_fatal(logger, MODULE_COMPILE, - "[%s:%d] Remove clause(index:%d) from compile %lld failed," - "clause not exist.", __FUNCTION__, __LINE__, - g2c_item->clause_index, compile_id); + "[%s:%d]compile:%lld clause(index:%d) has no vtable_id:%d's " + "literal, can't be removed", __FUNCTION__, __LINE__, + compile->compile_id, g2c_item->clause_index, g2c_item->vtable_id); + return -1; } + /* compile found in updating hash, it can be modified directly */ + maat_compile_clause_remove_literal(compile, g2c_item); if (0 == compile->actual_clause_num && NULL == compile->user_data) { rcu_hash_del(hash_tbl, (char *)&compile_id, sizeof(long long)); } @@ -1425,6 +1411,15 @@ static int maat_remove_group_from_compile(struct rcu_hash_table *hash_tbl, //find in effetive hash compile = rcu_hash_find(hash_tbl, (char *)&compile_id, sizeof(long long)); if (compile != NULL) { + ret = maat_compile_clause_find_literal(compile, g2c_item); + if (0 == ret) { + log_fatal(logger, MODULE_COMPILE, + "[%s:%d]compile:%lld clause(index:%d) has no vtable_id:%d's " + "literal, can't be removed", __FUNCTION__, __LINE__, + compile->compile_id, g2c_item->clause_index, g2c_item->vtable_id); + return -1; + } + /******************************************************************* compile found in effective hash, which means @@ -1439,15 +1434,8 @@ static int maat_remove_group_from_compile(struct rcu_hash_table *hash_tbl, /* delete compile from rcu hash */ rcu_hash_del(hash_tbl, (char *)&compile_id, sizeof(long long)); + maat_compile_clause_remove_literal(copy_compile, g2c_item); - ret = maat_compile_clause_remove_literal(copy_compile, g2c_item); - if (ret < 0) { - log_fatal(logger, MODULE_COMPILE, - "[%s:%d] Remove clause(index:%d) from compile %lld failed," - "clause not exist.", __FUNCTION__, __LINE__, - g2c_item->clause_index, compile_id); - } - if (0 == copy_compile->actual_clause_num && NULL == copy_compile->user_data) { maat_compile_free(copy_compile); } else { @@ -1787,8 +1775,8 @@ static void compile_state_add_exclude_not_clauses(struct compile_state *compile_ continue; } utarray_push_back(compile_state->exclude_not_clauses, clause_id); - utarray_sort(compile_state->exclude_not_clauses, compare_clause_id); } + utarray_sort(compile_state->exclude_not_clauses, compare_clause_id); } static void compile_state_add_hit_not_clauses(struct compile_state *compile_state, @@ -1895,9 +1883,12 @@ static void compile_state_cache_hit_not_groups(struct compile_state *compile_sta if (!utarray_find(tbl_group->group_ids, &(clause_id_kv->key.group_id), compare_group_id)) { utarray_push_back(tbl_group->group_ids, &(clause_id_kv->key.group_id)); - utarray_sort(tbl_group->group_ids, compare_group_id); } } + + if (tbl_group != NULL) { + utarray_sort(tbl_group->group_ids, compare_group_id); + } } int compile_state_get_compile_table_id(struct compile_state *compile_state, diff --git a/test/benchmark/benchmark_hs_gtest.cpp b/test/benchmark/benchmark_hs_gtest.cpp index 150cda3..caa6d28 100644 --- a/test/benchmark/benchmark_hs_gtest.cpp +++ b/test/benchmark/benchmark_hs_gtest.cpp @@ -148,7 +148,8 @@ void generate_compile_sample(const char *table_name, int sample_count) fclose(fp); } -void generate_group2compile_sample(const char *table_name, int sample_count) +void generate_group2compile_sample(const char *table_name, const char *vtable_name, + int sample_count) { FILE *fp = fopen(table_name, "w+"); if (NULL == fp) { @@ -159,7 +160,7 @@ void generate_group2compile_sample(const char *table_name, int sample_count) fprintf(fp, "%d\n", sample_count); for (int i = 0; i < sample_count; i++) { - fprintf(fp, "%d\t%d\t1\t0\t%s\t1\n", i+1, 100+i, "null"); + fprintf(fp, "%d\t%d\t0\t%s\t1\t1\n", i+1, 100+i, vtable_name); } fclose(fp); @@ -542,11 +543,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF\t10\t./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "REGEX_100", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -554,6 +560,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("./COMPILE_PERF"); + system_cmd_rmdir("./GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -627,11 +635,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF\t10\t./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "REGEX_200", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -639,6 +652,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("./COMPILE_PERF"); + system_cmd_rmdir("./GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -712,11 +727,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF\t10\t./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "REGEX_300", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -724,6 +744,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("./COMPILE_PERF"); + system_cmd_rmdir("./GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -797,11 +819,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF\t10\t./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "REGEX_500", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -809,6 +836,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("./COMPILE_PERF"); + system_cmd_rmdir("./GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -882,11 +911,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF\t10\t./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "REGEX_1K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -894,6 +928,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("./COMPILE_PERF"); + system_cmd_rmdir("./GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -967,11 +1003,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF\t10\t./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "REGEX_2K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -979,6 +1020,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("./COMPILE_PERF"); + system_cmd_rmdir("./GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -1052,11 +1095,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF\t10\t./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "REGEX_3K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -1064,6 +1112,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -1137,11 +1187,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF\t10\t./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "REGEX_5K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -1149,6 +1204,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -1222,11 +1279,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF\t10\t./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "REGEX_10K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -1234,6 +1296,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -1307,11 +1371,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF\t10\t./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "REGEX_15K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -1319,6 +1388,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -1393,11 +1464,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "EXPR_LITERAL_1K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -1405,6 +1481,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -1479,11 +1557,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "EXPR_LITERAL_5K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -1491,6 +1574,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -1565,11 +1650,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "EXPR_LITERAL_10K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -1577,6 +1667,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -1651,11 +1743,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "EXPR_LITERAL_50K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -1663,6 +1760,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -1737,11 +1836,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "EXPR_LITERAL_100K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -1749,6 +1853,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -1823,11 +1929,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "EXPR_LITERAL_500K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -1835,6 +1946,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -1909,11 +2022,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "EXPR_LITERAL_1M", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -1921,6 +2039,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -1995,11 +2115,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "EXPR_LITERAL_2M", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -2007,6 +2132,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -2081,11 +2208,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "STREAM_1K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -2093,6 +2225,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -2164,11 +2298,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "STREAM_5K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -2176,6 +2315,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -2247,11 +2388,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "STREAM_10K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -2259,6 +2405,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -2330,11 +2478,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "STREAM_50K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -2342,6 +2495,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -2413,11 +2568,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "STREAM_100K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -2425,6 +2585,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -2496,11 +2658,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "STREAM_500K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -2508,6 +2675,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -2579,11 +2748,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "STREAM_1M", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -2591,6 +2765,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -2662,11 +2838,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "STREAM_2M", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); + maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_HS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -2674,6 +2855,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -2745,6 +2928,9 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "IP_1K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); @@ -2757,6 +2943,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -2831,6 +3019,9 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "IP_5K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); @@ -2843,6 +3034,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -2917,6 +3110,9 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "IP_10K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); @@ -2929,6 +3125,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -3003,6 +3201,9 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "IP_50K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); @@ -3015,6 +3216,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -3089,6 +3292,9 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "IP_100K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); @@ -3101,6 +3307,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -3175,6 +3383,9 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "IP_500K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); @@ -3187,6 +3398,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -3261,6 +3474,9 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "IP_1M", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); @@ -3273,6 +3489,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -3347,6 +3565,9 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "IP_5M", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); @@ -3359,6 +3580,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -3433,6 +3656,9 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "IP_10M", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); @@ -3445,6 +3671,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -3519,6 +3747,9 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "INTEGER_1K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); @@ -3531,6 +3762,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -3605,6 +3838,9 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "INTEGER_5K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); @@ -3617,6 +3853,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -3691,6 +3929,9 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "INTEGER_10K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); @@ -3703,6 +3944,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -3777,6 +4020,9 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "FLAG_1K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); @@ -3789,6 +4035,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -3863,6 +4111,9 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "FLAG_5K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); @@ -3875,6 +4126,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -3949,6 +4202,9 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "FLAG_10K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_hs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); @@ -3961,6 +4217,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -4024,9 +4282,6 @@ int main(int argc, char ** argv) ::testing::InitGoogleTest(&argc, argv); g_logger = log_handle_create("./benchmark_hs_gtest.log", 0); - generate_compile_sample("COMPILE_PERF", 10); - generate_group2compile_sample("GROUP2COMPILE_PERF", 10); - ret=RUN_ALL_TESTS(); log_handle_destroy(g_logger); diff --git a/test/benchmark/benchmark_rs_gtest.cpp b/test/benchmark/benchmark_rs_gtest.cpp index c58d9a8..ae97759 100644 --- a/test/benchmark/benchmark_rs_gtest.cpp +++ b/test/benchmark/benchmark_rs_gtest.cpp @@ -148,7 +148,8 @@ void generate_compile_sample(const char *table_name, int sample_count) fclose(fp); } -void generate_group2compile_sample(const char *table_name, int sample_count) +void generate_group2compile_sample(const char *table_name, const char *vtable_name, + int sample_count) { FILE *fp = fopen(table_name, "w+"); if (NULL == fp) { @@ -159,7 +160,7 @@ void generate_group2compile_sample(const char *table_name, int sample_count) fprintf(fp, "%d\n", sample_count); for (int i = 0; i < sample_count; i++) { - fprintf(fp, "%d\t%d\t1\t0\t%s\t1\n", i+1, 100+i, "null"); + fprintf(fp, "%d\t%d\t0\t%s\t1\t1\n", i+1, 100+i, vtable_name); } fclose(fp); @@ -542,12 +543,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF\t10\t./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "REGEX_100", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -555,6 +560,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -628,12 +635,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF\t10\t./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "REGEX_200", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -641,6 +652,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -714,12 +727,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF\t10\t./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "REGEX_300", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -727,6 +744,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -801,12 +820,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "EXPR_LITERAL_1K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -814,6 +837,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -888,12 +913,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "EXPR_LITERAL_5K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -901,6 +930,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -975,12 +1006,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "EXPR_LITERAL_10K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -988,6 +1023,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -1062,12 +1099,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "EXPR_LITERAL_50K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -1075,6 +1116,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -1149,12 +1192,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "EXPR_LITERAL_100K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -1162,6 +1209,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -1236,12 +1285,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "EXPR_LITERAL_500K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -1249,6 +1302,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -1323,12 +1378,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "EXPR_LITERAL_1M", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -1336,6 +1395,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -1410,12 +1471,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "EXPR_LITERAL_2M", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -1423,6 +1488,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -1497,12 +1564,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "STREAM_1K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -1510,6 +1581,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -1581,12 +1654,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "STREAM_5K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -1594,6 +1671,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -1665,12 +1744,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "STREAM_10K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -1678,6 +1761,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -1749,12 +1834,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "STREAM_50K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -1762,6 +1851,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -1833,12 +1924,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "STREAM_100K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -1846,6 +1941,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -1917,12 +2014,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "STREAM_500K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -1930,6 +2031,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -2001,12 +2104,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "STREAM_1M", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -2014,6 +2121,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -2085,12 +2194,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "STREAM_2M", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -2098,6 +2211,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -2169,12 +2284,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "IP_1K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -2182,6 +2301,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -2256,12 +2377,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "IP_5K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -2269,6 +2394,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -2343,12 +2470,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "IP_10K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -2356,6 +2487,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -2430,12 +2563,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "IP_50K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -2443,6 +2580,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -2517,12 +2656,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "IP_100K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -2530,6 +2673,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -2604,12 +2749,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "IP_500K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -2617,6 +2766,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -2691,12 +2842,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "IP_1M", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -2704,6 +2859,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -2778,12 +2935,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "IP_5M", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -2791,6 +2952,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -2865,6 +3028,9 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "IP_10M", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); @@ -2878,6 +3044,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -2952,12 +3120,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "INTEGER_1K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -2965,6 +3137,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -3039,12 +3213,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "INTEGER_5K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -3052,6 +3230,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -3126,12 +3306,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "INTEGER_10K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -3139,6 +3323,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -3213,12 +3399,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "FLAG_1K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -3226,6 +3416,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -3300,12 +3492,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "FLAG_5K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -3313,6 +3509,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -3387,12 +3585,16 @@ protected: fprintf(fp, "GROUP2COMPILE_PERF 10 ./GROUP2COMPILE_PERF\n"); fclose(fp); + generate_compile_sample("COMPILE_PERF", 10); + generate_group2compile_sample("GROUP2COMPILE_PERF", "FLAG_10K", 10); + struct maat_options *opts = maat_options_new(); maat_options_set_logger(opts, "./benchmark_rs_gtest.log", LOG_LEVEL_INFO); maat_options_set_iris(opts, "./", "./"); maat_options_set_rule_effect_interval_ms(opts, 1000); maat_options_set_caller_thread_number(opts, PERF_THREAD_NUM); maat_options_set_expr_engine(opts, MAAT_EXPR_ENGINE_RS); + _shared_maat_inst = maat_new(opts, table_info_path); maat_options_free(opts); } @@ -3400,6 +3602,8 @@ protected: static void TearDownTestCase() { maat_free(_shared_maat_inst); log_handle_destroy(logger); + system_cmd_rmdir("COMPILE_PERF"); + system_cmd_rmdir("GROUP2COMPILE_PERF"); } static struct log_handle *logger; @@ -3463,9 +3667,6 @@ int main(int argc, char ** argv) ::testing::InitGoogleTest(&argc, argv); g_logger = log_handle_create("./benchmark_rs_gtest.log", 0); - generate_compile_sample("COMPILE_PERF", 10); - generate_group2compile_sample("GROUP2COMPILE_PERF", 10); - ret=RUN_ALL_TESTS(); log_handle_destroy(g_logger); diff --git a/test/benchmark/benchmark_table_info.conf b/test/benchmark/benchmark_table_info.conf index c2f1d31..9344f97 100644 --- a/test/benchmark/benchmark_table_info.conf +++ b/test/benchmark/benchmark_table_info.conf @@ -555,11 +555,12 @@ "table_id":39, "table_name":"COMPILE_PERF", "table_type":"compile", - "valid_column":8, + "default_compile_table":39, + "valid_column":9, "custom": { "compile_id":1, "tags":6, - "clause_num":9 + "clause_num":8 } }, { @@ -567,13 +568,13 @@ "table_name":"GROUP2COMPILE_PERF", "table_type":"group2compile", "associated_compile_table_id":39, - "valid_column":3, + "valid_column":6, "custom": { "group_id":1, "compile_id":2, - "not_flag":4, - "virtual_table_name":5, - "clause_index":6 + "not_flag":3, + "virtual_table_name":4, + "clause_index":5 } }, { diff --git a/test/benchmark/regex_rules/REGEX_15K b/test/benchmark/regex_rules/REGEX_15K index 28fe790..792214d 100644 --- a/test/benchmark/regex_rules/REGEX_15K +++ b/test/benchmark/regex_rules/REGEX_15K @@ -1,4 +1,4 @@ -150000 +15000 1 1 User-Agent:\s.*.abc.net 2 0 0 1 2 2 ]*classid\s*=\s*[\x22\x27]?\s*clsid\s*\x3a\s*\x7B?\s*66757BFC-DA0C-41E6-B3FE-B6D461223FF5 2 0 0 1 3 3 ]*classid\s*=\s*[\x22\x27]?\s*clsid\s*\x3a\s*\x7B?\s*1BE49F30-0E1B-11D3-9D8E-00C04F72D980 2 0 0 1