[PATCH]variable naming optimization
This commit is contained in:
@@ -291,6 +291,10 @@ void maat_state_reset(struct maat_state *state);
|
|||||||
|
|
||||||
void maat_state_free(struct maat_state *state);
|
void maat_state_free(struct maat_state *state);
|
||||||
|
|
||||||
|
void maat_state_set_logic_not_disabled(struct maat_state *state);
|
||||||
|
|
||||||
|
void maat_state_set_logic_not_enabled(struct maat_state *state);
|
||||||
|
|
||||||
int maat_state_set_scan_district(struct maat_state *state, int table_id,
|
int maat_state_set_scan_district(struct maat_state *state, int table_id,
|
||||||
const char *district, size_t district_len);
|
const char *district, size_t district_len);
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ extern "C"
|
|||||||
|
|
||||||
struct compile_schema;
|
struct compile_schema;
|
||||||
struct compile_runtime;
|
struct compile_runtime;
|
||||||
struct maat_compile_state;
|
struct compile_state;
|
||||||
struct group2group_runtime;
|
struct group2group_runtime;
|
||||||
|
|
||||||
/* compile schema API */
|
/* compile schema API */
|
||||||
@@ -66,7 +66,7 @@ int compile_runtime_match(struct compile_runtime *compile_rt, long long *compile
|
|||||||
size_t compile_ids_size, struct maat_state *state);
|
size_t compile_ids_size, struct maat_state *state);
|
||||||
|
|
||||||
size_t compile_runtime_get_hit_paths(struct compile_runtime *compile_rt, int thread_id,
|
size_t compile_runtime_get_hit_paths(struct compile_runtime *compile_rt, int thread_id,
|
||||||
struct maat_compile_state *compile_state,
|
struct compile_state *compile_state,
|
||||||
struct maat_hit_path *hit_path_array,
|
struct maat_hit_path *hit_path_array,
|
||||||
size_t array_size, size_t n_hit_path);
|
size_t array_size, size_t n_hit_path);
|
||||||
|
|
||||||
@@ -98,31 +98,33 @@ long long group2compile_runtime_rule_count(void *g2c_runtime);
|
|||||||
long long group2compile_runtime_update_err_count(void *g2c_runtime);
|
long long group2compile_runtime_update_err_count(void *g2c_runtime);
|
||||||
|
|
||||||
/* maat compile state API */
|
/* maat compile state API */
|
||||||
struct maat_compile_state;
|
struct compile_state;
|
||||||
struct maat_compile_state *maat_compile_state_new(void);
|
struct compile_state *compile_state_new(void);
|
||||||
void maat_compile_state_reset(struct maat_compile_state *compile_state);
|
|
||||||
void maat_compile_state_free(struct maat_compile_state *compile_state,
|
void compile_state_reset(struct compile_state *compile_state);
|
||||||
|
|
||||||
|
void compile_state_free(struct compile_state *compile_state,
|
||||||
struct maat *maat_instance, int thread_id);
|
struct maat *maat_instance, int thread_id);
|
||||||
|
|
||||||
int maat_compile_state_update(int vtable_id, struct maat_item *hit_items,
|
int compile_state_update(int vtable_id, struct maat_item *hit_items,
|
||||||
size_t n_hit_item, struct maat_state *state);
|
size_t n_hit_item, struct maat_state *state);
|
||||||
|
|
||||||
size_t maat_compile_state_get_internal_hit_paths(struct maat_compile_state *compile_state,
|
size_t compile_state_get_internal_hit_paths(struct compile_state *compile_state,
|
||||||
struct compile_runtime *compile_rt,
|
struct compile_runtime *compile_rt,
|
||||||
struct group2group_runtime *g2g_rt,
|
struct group2group_runtime *g2g_rt,
|
||||||
struct maat_hit_path *hit_path_array,
|
struct maat_hit_path *hit_path_array,
|
||||||
size_t array_size);
|
size_t array_size);
|
||||||
|
|
||||||
size_t maat_compile_state_get_direct_hit_groups(struct maat_compile_state *compile_state,
|
size_t compile_state_get_direct_hit_groups(struct compile_state *compile_state,
|
||||||
enum maat_list_type type,
|
enum maat_list_type type,
|
||||||
struct maat_hit_group *group_array,
|
struct maat_hit_group *group_array,
|
||||||
size_t array_size);
|
size_t array_size);
|
||||||
|
|
||||||
size_t maat_compile_state_get_indirect_hit_groups(struct maat_compile_state *compile_state,
|
size_t compile_state_get_indirect_hit_groups(struct compile_state *compile_state,
|
||||||
struct maat_hit_group *group_array,
|
struct maat_hit_group *group_array,
|
||||||
size_t array_size);
|
size_t array_size);
|
||||||
|
|
||||||
int maat_compile_state_has_NOT_clause(struct maat_compile_state *compile_state);
|
int compile_state_has_NOT_clause(struct compile_state *compile_state);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ struct maat_stat {
|
|||||||
long long *stream_num;
|
long long *stream_num;
|
||||||
long long *hit_cnt;
|
long long *hit_cnt;
|
||||||
long long *maat_state_cnt;
|
long long *maat_state_cnt;
|
||||||
long long *maat_compile_state_cnt;
|
long long *compile_state_cnt;
|
||||||
long long *maat_state_free_cnt;
|
long long *maat_state_free_cnt;
|
||||||
long long *maat_state_free_bytes;
|
long long *maat_state_free_bytes;
|
||||||
|
|
||||||
@@ -191,12 +191,13 @@ struct maat {
|
|||||||
|
|
||||||
struct maat_state {
|
struct maat_state {
|
||||||
struct maat *maat_inst;
|
struct maat *maat_inst;
|
||||||
struct maat_compile_state *compile_state;
|
struct compile_state *compile_state;
|
||||||
int scan_cnt;
|
int scan_cnt;
|
||||||
int district_id; //-1: Any District; -2: Unkonwn District;
|
int district_id; //-1: Any District; -2: Unkonwn District;
|
||||||
uint16_t thread_id;
|
uint16_t thread_id;
|
||||||
int16_t compile_table_id;
|
int16_t compile_table_id;
|
||||||
uint8_t is_set_district;
|
uint8_t district_flag;
|
||||||
|
uint8_t logic_not_flag;
|
||||||
};
|
};
|
||||||
|
|
||||||
int my_scandir(const char *dir, struct dirent ***namelist,
|
int my_scandir(const char *dir, struct dirent ***namelist,
|
||||||
|
|||||||
@@ -50,6 +50,11 @@ enum district_flag {
|
|||||||
DISTRICT_FLAG_SET
|
DISTRICT_FLAG_SET
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum logic_not_flag {
|
||||||
|
LOGIC_NOT_FLAG_UNSET,
|
||||||
|
LOGIC_NOT_FLAG_SET
|
||||||
|
};
|
||||||
|
|
||||||
struct maat_stream {
|
struct maat_stream {
|
||||||
struct maat *ref_maat_inst;
|
struct maat *ref_maat_inst;
|
||||||
struct expr_matcher_stream *handle; //each physical table open one stream
|
struct expr_matcher_stream *handle; //each physical table open one stream
|
||||||
@@ -1029,7 +1034,7 @@ static int flag_scan(struct table_manager *tbl_mgr, int thread_id, long long fla
|
|||||||
{
|
{
|
||||||
enum table_type table_type = table_manager_get_table_type(tbl_mgr, phy_table_id);
|
enum table_type table_type = table_manager_get_table_type(tbl_mgr, phy_table_id);
|
||||||
if (table_type == TABLE_TYPE_FLAG_PLUS &&
|
if (table_type == TABLE_TYPE_FLAG_PLUS &&
|
||||||
DISTRICT_FLAG_UNSET == state->is_set_district) {
|
DISTRICT_FLAG_UNSET == state->district_flag) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1059,7 +1064,7 @@ static int interval_scan(struct table_manager *tbl_mgr, int thread_id, long long
|
|||||||
|
|
||||||
enum table_type table_type = table_manager_get_table_type(tbl_mgr, phy_table_id);
|
enum table_type table_type = table_manager_get_table_type(tbl_mgr, phy_table_id);
|
||||||
if (table_type == TABLE_TYPE_INTERVAL_PLUS &&
|
if (table_type == TABLE_TYPE_INTERVAL_PLUS &&
|
||||||
DISTRICT_FLAG_UNSET == state->is_set_district) {
|
DISTRICT_FLAG_UNSET == state->district_flag) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1141,7 +1146,7 @@ static int string_scan(struct table_manager *tbl_mgr, int thread_id,
|
|||||||
{
|
{
|
||||||
enum table_type table_type = table_manager_get_table_type(tbl_mgr, phy_table_id);
|
enum table_type table_type = table_manager_get_table_type(tbl_mgr, phy_table_id);
|
||||||
if (table_type == TABLE_TYPE_EXPR_PLUS &&
|
if (table_type == TABLE_TYPE_EXPR_PLUS &&
|
||||||
DISTRICT_FLAG_UNSET == state->is_set_district) {
|
DISTRICT_FLAG_UNSET == state->district_flag) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1177,7 +1182,7 @@ static int expr_stream_scan(struct maat_stream *stream, const char *data,
|
|||||||
struct table_manager *tbl_mgr = stream->ref_maat_inst->tbl_mgr;
|
struct table_manager *tbl_mgr = stream->ref_maat_inst->tbl_mgr;
|
||||||
table_type = table_manager_get_table_type(tbl_mgr, stream->phy_table_id);
|
table_type = table_manager_get_table_type(tbl_mgr, stream->phy_table_id);
|
||||||
if (table_type == TABLE_TYPE_EXPR_PLUS &&
|
if (table_type == TABLE_TYPE_EXPR_PLUS &&
|
||||||
DISTRICT_FLAG_UNSET == state->is_set_district) {
|
DISTRICT_FLAG_UNSET == state->district_flag) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1794,7 +1799,7 @@ struct maat_state *maat_state_new(struct maat *maat_inst, int thread_id)
|
|||||||
struct maat_state *state = ALLOC(struct maat_state, 1);
|
struct maat_state *state = ALLOC(struct maat_state, 1);
|
||||||
|
|
||||||
state->maat_inst = maat_inst;
|
state->maat_inst = maat_inst;
|
||||||
state->is_set_district = DISTRICT_FLAG_UNSET;
|
state->district_flag = DISTRICT_FLAG_UNSET;
|
||||||
state->district_id = DISTRICT_ANY;
|
state->district_id = DISTRICT_ANY;
|
||||||
state->thread_id = thread_id;
|
state->thread_id = thread_id;
|
||||||
|
|
||||||
@@ -1811,12 +1816,12 @@ void maat_state_reset(struct maat_state *state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
state->compile_table_id = 0;
|
state->compile_table_id = 0;
|
||||||
state->is_set_district = DISTRICT_FLAG_UNSET;
|
state->district_flag = DISTRICT_FLAG_UNSET;
|
||||||
state->district_id = DISTRICT_ANY;
|
state->district_id = DISTRICT_ANY;
|
||||||
state->scan_cnt = 0;
|
state->scan_cnt = 0;
|
||||||
|
|
||||||
if (state->compile_state != NULL) {
|
if (state->compile_state != NULL) {
|
||||||
maat_compile_state_reset(state->compile_state);
|
compile_state_reset(state->compile_state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1832,9 +1837,9 @@ void maat_state_free(struct maat_state *state)
|
|||||||
long long thread_id = state->thread_id;
|
long long thread_id = state->thread_id;
|
||||||
|
|
||||||
if (state->compile_state != NULL) {
|
if (state->compile_state != NULL) {
|
||||||
maat_compile_state_free(state->compile_state, maat_inst, thread_id);
|
compile_state_free(state->compile_state, maat_inst, thread_id);
|
||||||
state->compile_state = NULL;
|
state->compile_state = NULL;
|
||||||
alignment_int64_array_add(maat_inst->stat->maat_compile_state_cnt,
|
alignment_int64_array_add(maat_inst->stat->compile_state_cnt,
|
||||||
thread_id, -1);
|
thread_id, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1849,6 +1854,16 @@ void maat_state_free(struct maat_state *state)
|
|||||||
thread_id, sizeof(struct maat_state));
|
thread_id, sizeof(struct maat_state));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void maat_state_set_logic_not_disabled(struct maat_state *state)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void maat_state_set_logic_not_enabled(struct maat_state *state)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
int maat_state_set_scan_district(struct maat_state *state, int table_id,
|
int maat_state_set_scan_district(struct maat_state *state, int table_id,
|
||||||
const char *district, size_t district_len)
|
const char *district, size_t district_len)
|
||||||
{
|
{
|
||||||
@@ -1912,7 +1927,7 @@ int maat_state_set_scan_district(struct maat_state *state, int table_id,
|
|||||||
state->district_id = (int)district_id;
|
state->district_id = (int)district_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
state->is_set_district = DISTRICT_FLAG_SET;
|
state->district_flag = DISTRICT_FLAG_SET;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1966,7 +1981,7 @@ int maat_state_get_hit_paths(struct maat_state *state, struct maat_hit_path *pat
|
|||||||
int g2g_table_id = table_manager_get_group2group_table_id(maat_inst->tbl_mgr);
|
int g2g_table_id = table_manager_get_group2group_table_id(maat_inst->tbl_mgr);
|
||||||
void *g2g_runtime = table_manager_get_runtime(maat_inst->tbl_mgr, g2g_table_id);
|
void *g2g_runtime = table_manager_get_runtime(maat_inst->tbl_mgr, g2g_table_id);
|
||||||
|
|
||||||
size_t hit_path_cnt = maat_compile_state_get_internal_hit_paths(state->compile_state,
|
size_t hit_path_cnt = compile_state_get_internal_hit_paths(state->compile_state,
|
||||||
(struct compile_runtime *)compile_rt,
|
(struct compile_runtime *)compile_rt,
|
||||||
(struct group2group_runtime *)g2g_runtime,
|
(struct group2group_runtime *)g2g_runtime,
|
||||||
path_array, array_size);
|
path_array, array_size);
|
||||||
@@ -1996,7 +2011,7 @@ int maat_state_get_direct_hit_groups(struct maat_state *state, enum maat_list_ty
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return maat_compile_state_get_direct_hit_groups(state->compile_state, type,
|
return compile_state_get_direct_hit_groups(state->compile_state, type,
|
||||||
group_array, array_size);
|
group_array, array_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2012,7 +2027,7 @@ int maat_state_get_indirect_hit_groups(struct maat_state *state,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return maat_compile_state_get_indirect_hit_groups(state->compile_state,
|
return compile_state_get_indirect_hit_groups(state->compile_state,
|
||||||
group_array, array_size);
|
group_array, array_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,14 +79,14 @@ struct group2compile_item {
|
|||||||
int clause_index;
|
int clause_index;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct maat_literal_id {
|
struct literal_id {
|
||||||
long long group_id;
|
long long group_id;
|
||||||
int vtable_id;
|
int vtable_id;
|
||||||
int not_flag;
|
int not_flag;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct literal_clause {
|
struct literal_clause {
|
||||||
struct maat_literal_id key;
|
struct literal_id key;
|
||||||
UT_array *clause_ids;
|
UT_array *clause_ids;
|
||||||
UT_hash_handle hh;
|
UT_hash_handle hh;
|
||||||
};
|
};
|
||||||
@@ -145,7 +145,7 @@ struct maat_compile {
|
|||||||
struct maat_clause clauses[MAX_ITEMS_PER_BOOL_EXPR];
|
struct maat_clause clauses[MAX_ITEMS_PER_BOOL_EXPR];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct maat_internal_hit_path {
|
struct internal_hit_path {
|
||||||
long long item_id;
|
long long item_id;
|
||||||
long long group_id;
|
long long group_id;
|
||||||
int Nth_scan;
|
int Nth_scan;
|
||||||
@@ -153,7 +153,7 @@ struct maat_internal_hit_path {
|
|||||||
int NOT_flag; // 1 means NOT clause
|
int NOT_flag; // 1 means NOT clause
|
||||||
};
|
};
|
||||||
|
|
||||||
struct maat_compile_state {
|
struct compile_state {
|
||||||
int Nth_scan;
|
int Nth_scan;
|
||||||
time_t compile_rt_version;
|
time_t compile_rt_version;
|
||||||
|
|
||||||
@@ -164,10 +164,10 @@ struct maat_compile_state {
|
|||||||
UT_array *indirect_hit_groups;
|
UT_array *indirect_hit_groups;
|
||||||
};
|
};
|
||||||
|
|
||||||
UT_icd ut_literal_id_icd = {sizeof(struct maat_literal_id), NULL, NULL, NULL};
|
UT_icd ut_literal_id_icd = {sizeof(struct literal_id), NULL, NULL, NULL};
|
||||||
UT_icd ut_clause_id_icd = {sizeof(long long), NULL, NULL, NULL};
|
UT_icd ut_clause_id_icd = {sizeof(long long), NULL, NULL, NULL};
|
||||||
UT_icd ut_maat_hit_group_icd = {sizeof(struct maat_hit_group), NULL, NULL, NULL};
|
UT_icd ut_maat_hit_group_icd = {sizeof(struct maat_hit_group), NULL, NULL, NULL};
|
||||||
UT_icd ut_hit_path_icd = {sizeof(struct maat_internal_hit_path), NULL, NULL, NULL};
|
UT_icd ut_hit_path_icd = {sizeof(struct internal_hit_path), NULL, NULL, NULL};
|
||||||
|
|
||||||
static struct maat_compile *maat_compile_new(long long compile_id)
|
static struct maat_compile *maat_compile_new(long long compile_id)
|
||||||
{
|
{
|
||||||
@@ -869,8 +869,8 @@ static void group2compile_item_free(struct group2compile_item *g2c_item)
|
|||||||
|
|
||||||
static int compare_literal_id(const void *pa, const void *pb)
|
static int compare_literal_id(const void *pa, const void *pb)
|
||||||
{
|
{
|
||||||
struct maat_literal_id *la = (struct maat_literal_id *)pa;
|
struct literal_id *la = (struct literal_id *)pa;
|
||||||
struct maat_literal_id *lb = (struct maat_literal_id *)pb;
|
struct literal_id *lb = (struct literal_id *)pb;
|
||||||
|
|
||||||
long long ret = la->vtable_id - lb->vtable_id;
|
long long ret = la->vtable_id - lb->vtable_id;
|
||||||
if (0 == ret) {
|
if (0 == ret) {
|
||||||
@@ -884,7 +884,7 @@ static int compare_literal_id(const void *pa, const void *pb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int maat_compile_clause_add_literal(struct maat_compile *compile,
|
static int maat_compile_clause_add_literal(struct maat_compile *compile,
|
||||||
struct maat_literal_id *literal_id,
|
struct literal_id *literal_id,
|
||||||
int clause_index, int clause_not_flag)
|
int clause_index, int clause_not_flag)
|
||||||
{
|
{
|
||||||
struct maat_clause *clause = compile->clauses + clause_index;
|
struct maat_clause *clause = compile->clauses + clause_index;
|
||||||
@@ -895,8 +895,8 @@ static int maat_compile_clause_add_literal(struct maat_compile *compile,
|
|||||||
compile->actual_clause_num++;
|
compile->actual_clause_num++;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct maat_literal_id *tmp = NULL;
|
struct literal_id *tmp = NULL;
|
||||||
tmp = (struct maat_literal_id *)utarray_find(clause->ut_literal_ids,
|
tmp = (struct literal_id *)utarray_find(clause->ut_literal_ids,
|
||||||
literal_id, compare_literal_id);
|
literal_id, compare_literal_id);
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
assert(tmp->group_id == literal_id->group_id);
|
assert(tmp->group_id == literal_id->group_id);
|
||||||
@@ -912,12 +912,12 @@ static int maat_compile_clause_add_literal(struct maat_compile *compile,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int maat_compile_clause_remove_literal(struct maat_compile *compile,
|
static int maat_compile_clause_remove_literal(struct maat_compile *compile,
|
||||||
struct maat_literal_id *literal_id,
|
struct literal_id *literal_id,
|
||||||
int clause_index)
|
int clause_index)
|
||||||
{
|
{
|
||||||
struct maat_clause *clause = compile->clauses + clause_index;
|
struct maat_clause *clause = compile->clauses + clause_index;
|
||||||
struct maat_literal_id *tmp = NULL;
|
struct literal_id *tmp = NULL;
|
||||||
tmp = (struct maat_literal_id *)utarray_find(clause->ut_literal_ids,
|
tmp = (struct literal_id *)utarray_find(clause->ut_literal_ids,
|
||||||
literal_id, compare_literal_id);
|
literal_id, compare_literal_id);
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
assert(*(unsigned long long*)tmp == *(unsigned long long*)(literal_id));
|
assert(*(unsigned long long*)tmp == *(unsigned long long*)(literal_id));
|
||||||
@@ -979,9 +979,9 @@ maat_compile_bool_matcher_new(struct compile_runtime *compile_rt, size_t *compil
|
|||||||
if (iter_compile->clauses[i].in_use) {
|
if (iter_compile->clauses[i].in_use) {
|
||||||
// TODO:mytest need to delete
|
// TODO:mytest need to delete
|
||||||
#if 0
|
#if 0
|
||||||
struct maat_literal_id *p = NULL;
|
struct literal_id *p = NULL;
|
||||||
for(p = (struct maat_literal_id *)utarray_front(iter_compile->clauses[i].ut_literal_ids); p!=NULL;
|
for(p = (struct literal_id *)utarray_front(iter_compile->clauses[i].ut_literal_ids); p!=NULL;
|
||||||
p = (struct maat_literal_id *)utarray_next(iter_compile->clauses[i].ut_literal_ids, p)) {
|
p = (struct literal_id *)utarray_next(iter_compile->clauses[i].ut_literal_ids, p)) {
|
||||||
printf("<before bool_matcher_new> compile_rt:%p compile_id:%lld, clause_id:%llu, literal{%lld: %d, %d}\n",
|
printf("<before bool_matcher_new> compile_rt:%p compile_id:%lld, clause_id:%llu, literal{%lld: %d, %d}\n",
|
||||||
compile_rt, iter_compile->compile_id, iter_compile->clauses[i].clause_id, p->group_id, p->vtable_id, p->not_flag);
|
compile_rt, iter_compile->compile_id, iter_compile->clauses[i].clause_id, p->group_id, p->vtable_id, p->not_flag);
|
||||||
}
|
}
|
||||||
@@ -1058,7 +1058,7 @@ maat_compile_build_literal2clause_hash(struct compile_runtime *compile_rt, int n
|
|||||||
}
|
}
|
||||||
|
|
||||||
void **data_array = NULL;
|
void **data_array = NULL;
|
||||||
struct maat_literal_id *tmp_literal_id = NULL;
|
struct literal_id *tmp_literal_id = NULL;
|
||||||
struct literal_clause *l2c_value = NULL;
|
struct literal_clause *l2c_value = NULL;
|
||||||
struct literal_clause *literal2clause_hash = NULL;
|
struct literal_clause *literal2clause_hash = NULL;
|
||||||
size_t compile_cnt = rcu_updating_hash_list(compile_rt->cfg_hash, &data_array);
|
size_t compile_cnt = rcu_updating_hash_list(compile_rt->cfg_hash, &data_array);
|
||||||
@@ -1082,8 +1082,8 @@ maat_compile_build_literal2clause_hash(struct compile_runtime *compile_rt, int n
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (size_t j = 0; j < utarray_len(clause->ut_literal_ids); j++) {
|
for (size_t j = 0; j < utarray_len(clause->ut_literal_ids); j++) {
|
||||||
tmp_literal_id = (struct maat_literal_id *)utarray_eltptr(clause->ut_literal_ids, j);
|
tmp_literal_id = (struct literal_id *)utarray_eltptr(clause->ut_literal_ids, j);
|
||||||
HASH_FIND(hh, literal2clause_hash, tmp_literal_id, sizeof(struct maat_literal_id), l2c_value);
|
HASH_FIND(hh, literal2clause_hash, tmp_literal_id, sizeof(struct literal_id), l2c_value);
|
||||||
if (NULL == l2c_value) {
|
if (NULL == l2c_value) {
|
||||||
l2c_value = ALLOC(struct literal_clause, 1);
|
l2c_value = ALLOC(struct literal_clause, 1);
|
||||||
l2c_value->key = *tmp_literal_id;
|
l2c_value->key = *tmp_literal_id;
|
||||||
@@ -1122,7 +1122,7 @@ static int maat_compile_has_clause(struct maat_compile *compile, long long claus
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t compile_state_if_new_hit_compile(struct maat_compile_state *compile_state,
|
static size_t compile_state_if_new_hit_compile(struct compile_state *compile_state,
|
||||||
struct maat_compile *compile)
|
struct maat_compile *compile)
|
||||||
{
|
{
|
||||||
size_t r_in_c_cnt = 0;
|
size_t r_in_c_cnt = 0;
|
||||||
@@ -1141,7 +1141,7 @@ static size_t compile_state_if_new_hit_compile(struct maat_compile_state *compil
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t maat_compile_bool_matcher_match(struct compile_runtime *compile_rt,
|
size_t maat_compile_bool_matcher_match(struct compile_runtime *compile_rt,
|
||||||
struct maat_compile_state *compile_state,
|
struct compile_state *compile_state,
|
||||||
int thread_id, void **user_data_array,
|
int thread_id, void **user_data_array,
|
||||||
size_t ud_array_size)
|
size_t ud_array_size)
|
||||||
{
|
{
|
||||||
@@ -1227,19 +1227,19 @@ maat_compile_clone(struct maat_compile *compile, int deep_copy)
|
|||||||
new_compile->user_data = compile_item_clone((struct compile_item *)compile->user_data);
|
new_compile->user_data = compile_item_clone((struct compile_item *)compile->user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct maat_literal_id *literal_id = NULL;
|
struct literal_id *literal_id = NULL;
|
||||||
for (int i = 0; i < MAX_ITEMS_PER_BOOL_EXPR; i++) {
|
for (int i = 0; i < MAX_ITEMS_PER_BOOL_EXPR; i++) {
|
||||||
new_compile->clauses[i].clause_id = compile->clauses[i].clause_id;
|
new_compile->clauses[i].clause_id = compile->clauses[i].clause_id;
|
||||||
new_compile->clauses[i].in_use = compile->clauses[i].in_use;
|
new_compile->clauses[i].in_use = compile->clauses[i].in_use;
|
||||||
new_compile->clauses[i].not_flag = compile->clauses[i].not_flag;
|
new_compile->clauses[i].not_flag = compile->clauses[i].not_flag;
|
||||||
utarray_new(new_compile->clauses[i].ut_literal_ids, &ut_literal_id_icd);
|
utarray_new(new_compile->clauses[i].ut_literal_ids, &ut_literal_id_icd);
|
||||||
for (int j = 0; j < utarray_len(compile->clauses[i].ut_literal_ids); j++) {
|
for (int j = 0; j < utarray_len(compile->clauses[i].ut_literal_ids); j++) {
|
||||||
literal_id = (struct maat_literal_id *)utarray_eltptr(compile->clauses[i].ut_literal_ids, j);
|
literal_id = (struct literal_id *)utarray_eltptr(compile->clauses[i].ut_literal_ids, j);
|
||||||
utarray_push_back(new_compile->clauses[i].ut_literal_ids, literal_id);
|
utarray_push_back(new_compile->clauses[i].ut_literal_ids, literal_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int k = 0; k < utarray_len(new_compile->clauses[i].ut_literal_ids); k++) {
|
for (int k = 0; k < utarray_len(new_compile->clauses[i].ut_literal_ids); k++) {
|
||||||
literal_id = (struct maat_literal_id *)utarray_eltptr(new_compile->clauses[i].ut_literal_ids, k);
|
literal_id = (struct literal_id *)utarray_eltptr(new_compile->clauses[i].ut_literal_ids, k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1253,7 +1253,7 @@ static int maat_add_group_to_compile(struct rcu_hash_table *hash_tbl,
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
long long compile_id = g2c_item->compile_id;
|
long long compile_id = g2c_item->compile_id;
|
||||||
struct maat_compile *compile = NULL;
|
struct maat_compile *compile = NULL;
|
||||||
struct maat_literal_id literal_id = {g2c_item->group_id, g2c_item->vtable_id,
|
struct literal_id literal_id = {g2c_item->group_id, g2c_item->vtable_id,
|
||||||
g2c_item->not_flag};
|
g2c_item->not_flag};
|
||||||
|
|
||||||
int updating_flag = rcu_hash_is_updating(hash_tbl);
|
int updating_flag = rcu_hash_is_updating(hash_tbl);
|
||||||
@@ -1336,7 +1336,7 @@ static int maat_remove_group_from_compile(struct rcu_hash_table *hash_tbl,
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
long long compile_id = g2c_item->compile_id;
|
long long compile_id = g2c_item->compile_id;
|
||||||
struct maat_compile *compile = NULL;
|
struct maat_compile *compile = NULL;
|
||||||
struct maat_literal_id literal_id = {g2c_item->group_id, g2c_item->vtable_id,
|
struct literal_id literal_id = {g2c_item->group_id, g2c_item->vtable_id,
|
||||||
g2c_item->not_flag};
|
g2c_item->not_flag};
|
||||||
|
|
||||||
int updating_flag = rcu_hash_is_updating(hash_tbl);
|
int updating_flag = rcu_hash_is_updating(hash_tbl);
|
||||||
@@ -1411,9 +1411,9 @@ static int maat_remove_group_from_compile(struct rcu_hash_table *hash_tbl,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct maat_compile_state *maat_compile_state_new(void)
|
struct compile_state *compile_state_new(void)
|
||||||
{
|
{
|
||||||
struct maat_compile_state *compile_state = ALLOC(struct maat_compile_state, 1);
|
struct compile_state *compile_state = ALLOC(struct compile_state, 1);
|
||||||
|
|
||||||
utarray_new(compile_state->internal_hit_paths, &ut_hit_path_icd);
|
utarray_new(compile_state->internal_hit_paths, &ut_hit_path_icd);
|
||||||
utarray_new(compile_state->all_hit_clauses, &ut_clause_id_icd);
|
utarray_new(compile_state->all_hit_clauses, &ut_clause_id_icd);
|
||||||
@@ -1424,7 +1424,7 @@ struct maat_compile_state *maat_compile_state_new(void)
|
|||||||
return compile_state;
|
return compile_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void maat_compile_state_reset(struct maat_compile_state *compile_state)
|
void compile_state_reset(struct compile_state *compile_state)
|
||||||
{
|
{
|
||||||
if (NULL == compile_state) {
|
if (NULL == compile_state) {
|
||||||
return;
|
return;
|
||||||
@@ -1440,7 +1440,7 @@ void maat_compile_state_reset(struct maat_compile_state *compile_state)
|
|||||||
utarray_clear(compile_state->indirect_hit_groups);
|
utarray_clear(compile_state->indirect_hit_groups);
|
||||||
}
|
}
|
||||||
|
|
||||||
void maat_compile_state_free(struct maat_compile_state *compile_state,
|
void compile_state_free(struct compile_state *compile_state,
|
||||||
struct maat *maat_inst, int thread_id)
|
struct maat *maat_inst, int thread_id)
|
||||||
{
|
{
|
||||||
if (NULL == compile_state) {
|
if (NULL == compile_state) {
|
||||||
@@ -1450,7 +1450,7 @@ void maat_compile_state_free(struct maat_compile_state *compile_state,
|
|||||||
long long free_bytes = 0;
|
long long free_bytes = 0;
|
||||||
if (compile_state->internal_hit_paths != NULL) {
|
if (compile_state->internal_hit_paths != NULL) {
|
||||||
free_bytes += utarray_size(compile_state->internal_hit_paths) *
|
free_bytes += utarray_size(compile_state->internal_hit_paths) *
|
||||||
sizeof(struct maat_internal_hit_path);
|
sizeof(struct internal_hit_path);
|
||||||
utarray_free(compile_state->internal_hit_paths);
|
utarray_free(compile_state->internal_hit_paths);
|
||||||
compile_state->internal_hit_paths = NULL;
|
compile_state->internal_hit_paths = NULL;
|
||||||
}
|
}
|
||||||
@@ -1481,7 +1481,7 @@ void maat_compile_state_free(struct maat_compile_state *compile_state,
|
|||||||
|
|
||||||
FREE(compile_state);
|
FREE(compile_state);
|
||||||
|
|
||||||
free_bytes += sizeof(struct maat_compile_state);
|
free_bytes += sizeof(struct compile_state);
|
||||||
alignment_int64_array_add(maat_inst->stat->maat_state_free_bytes,
|
alignment_int64_array_add(maat_inst->stat->maat_state_free_bytes,
|
||||||
thread_id, free_bytes);
|
thread_id, free_bytes);
|
||||||
}
|
}
|
||||||
@@ -1494,7 +1494,7 @@ static void maat_compile_hit_path_add(UT_array *hit_paths, long long item_id,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct maat_internal_hit_path new_path;
|
struct internal_hit_path new_path;
|
||||||
new_path.item_id = item_id;
|
new_path.item_id = item_id;
|
||||||
new_path.Nth_scan = Nth_scan;
|
new_path.Nth_scan = Nth_scan;
|
||||||
new_path.group_id = group_id;
|
new_path.group_id = group_id;
|
||||||
@@ -1505,10 +1505,10 @@ static void maat_compile_hit_path_add(UT_array *hit_paths, long long item_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int maat_compile_has_literal(struct maat_compile *compile,
|
static int maat_compile_has_literal(struct maat_compile *compile,
|
||||||
struct maat_literal_id *literal_id)
|
struct literal_id *literal_id)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
struct maat_literal_id *tmp = NULL;
|
struct literal_id *tmp = NULL;
|
||||||
|
|
||||||
for (i = 0; i < MAX_ITEMS_PER_BOOL_EXPR; i++) {
|
for (i = 0; i < MAX_ITEMS_PER_BOOL_EXPR; i++) {
|
||||||
struct maat_clause *clause = compile->clauses+i;
|
struct maat_clause *clause = compile->clauses+i;
|
||||||
@@ -1516,7 +1516,7 @@ static int maat_compile_has_literal(struct maat_compile *compile,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = (struct maat_literal_id*)utarray_find(clause->ut_literal_ids,
|
tmp = (struct literal_id*)utarray_find(clause->ut_literal_ids,
|
||||||
literal_id, compare_literal_id);
|
literal_id, compare_literal_id);
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
assert(tmp->group_id == literal_id->group_id &&
|
assert(tmp->group_id == literal_id->group_id &&
|
||||||
@@ -1541,14 +1541,14 @@ static int maat_compile_is_hit_path_existed(const struct maat_hit_path *hit_path
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t compile_runtime_get_hit_paths(struct compile_runtime *compile_rt, int thread_id,
|
size_t compile_runtime_get_hit_paths(struct compile_runtime *compile_rt, int thread_id,
|
||||||
struct maat_compile_state *compile_state,
|
struct compile_state *compile_state,
|
||||||
struct maat_hit_path *hit_path_array,
|
struct maat_hit_path *hit_path_array,
|
||||||
size_t array_size, size_t n_hit_path)
|
size_t array_size, size_t n_hit_path)
|
||||||
{
|
{
|
||||||
/* assign hit_path_array[].compile_id */
|
/* assign hit_path_array[].compile_id */
|
||||||
size_t new_hit_path_cnt = 0;
|
size_t new_hit_path_cnt = 0;
|
||||||
struct maat_compile *compile = NULL;
|
struct maat_compile *compile = NULL;
|
||||||
struct maat_literal_id literal_id = {0, 0};
|
struct literal_id literal_id = {0, 0};
|
||||||
struct bool_expr_match *expr_match = compile_rt->expr_match_buff +
|
struct bool_expr_match *expr_match = compile_rt->expr_match_buff +
|
||||||
(thread_id * MAX_SCANNER_HIT_COMPILE_NUM);
|
(thread_id * MAX_SCANNER_HIT_COMPILE_NUM);
|
||||||
assert(thread_id >= 0);
|
assert(thread_id >= 0);
|
||||||
@@ -1601,7 +1601,7 @@ size_t compile_runtime_get_hit_paths(struct compile_runtime *compile_rt, int thr
|
|||||||
return (n_hit_path + new_hit_path_cnt);
|
return (n_hit_path + new_hit_path_cnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void maat_compile_state_update_direct_hit_groups(UT_array *hit_group_array,
|
static void compile_state_update_direct_hit_groups(UT_array *hit_group_array,
|
||||||
struct maat_item *hit_items,
|
struct maat_item *hit_items,
|
||||||
size_t n_hit_items, int vtable_id)
|
size_t n_hit_items, int vtable_id)
|
||||||
{
|
{
|
||||||
@@ -1618,7 +1618,7 @@ static void maat_compile_state_update_direct_hit_groups(UT_array *hit_group_arra
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void maat_compile_state_update_indirect_hit_groups(UT_array *hit_group_array,
|
static void compile_state_update_indirect_hit_groups(UT_array *hit_group_array,
|
||||||
long long *group_ids,
|
long long *group_ids,
|
||||||
size_t n_group_ids, int vtable_id)
|
size_t n_group_ids, int vtable_id)
|
||||||
{
|
{
|
||||||
@@ -1635,7 +1635,7 @@ static void maat_compile_state_update_indirect_hit_groups(UT_array *hit_group_ar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void exec_update_hit_clauses(struct maat_compile_state *compile_state,
|
static void exec_update_hit_clauses(struct compile_state *compile_state,
|
||||||
UT_array *clause_id_array)
|
UT_array *clause_id_array)
|
||||||
{
|
{
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
@@ -1662,7 +1662,7 @@ static void exec_update_hit_clauses(struct maat_compile_state *compile_state,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void maat_compile_state_update_hit_clause(struct maat_compile_state *compile_state,
|
static void compile_state_update_hit_clause(struct compile_state *compile_state,
|
||||||
struct compile_runtime *compile_rt,
|
struct compile_runtime *compile_rt,
|
||||||
long long group_id, int vtable_id)
|
long long group_id, int vtable_id)
|
||||||
{
|
{
|
||||||
@@ -1671,7 +1671,7 @@ static void maat_compile_state_update_hit_clause(struct maat_compile_state *comp
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct maat_literal_id literal_id = {group_id, vtable_id, 0};
|
struct literal_id literal_id = {group_id, vtable_id, 0};
|
||||||
struct literal_clause *l2c_val = NULL;
|
struct literal_clause *l2c_val = NULL;
|
||||||
|
|
||||||
HASH_FIND(hh, compile_rt->literal2clause_hash, &literal_id, sizeof(literal_id), l2c_val);
|
HASH_FIND(hh, compile_rt->literal2clause_hash, &literal_id, sizeof(literal_id), l2c_val);
|
||||||
@@ -1695,7 +1695,7 @@ static inline int compare_group_id(const void *a, const void *b)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t maat_compile_state_update_hit_not_clauses(struct maat_compile_state *compile_state,
|
static size_t compile_state_update_hit_not_clauses(struct compile_state *compile_state,
|
||||||
struct compile_runtime *compile_rt,
|
struct compile_runtime *compile_rt,
|
||||||
long long *group_ids, size_t n_group_ids,
|
long long *group_ids, size_t n_group_ids,
|
||||||
int vtable_id, long long *NOT_group_ids_array,
|
int vtable_id, long long *NOT_group_ids_array,
|
||||||
@@ -2223,7 +2223,7 @@ static int compare_compile_item(const void *a, const void *b)
|
|||||||
int compile_runtime_match(struct compile_runtime *compile_rt, long long *compile_ids,
|
int compile_runtime_match(struct compile_runtime *compile_rt, long long *compile_ids,
|
||||||
size_t compile_ids_size, struct maat_state *state)
|
size_t compile_ids_size, struct maat_state *state)
|
||||||
{
|
{
|
||||||
struct maat_compile_state *compile_state = state->compile_state;
|
struct compile_state *compile_state = state->compile_state;
|
||||||
struct compile_item *compile_items[compile_ids_size];
|
struct compile_item *compile_items[compile_ids_size];
|
||||||
|
|
||||||
// all hit clause_id -> compile_id
|
// all hit clause_id -> compile_id
|
||||||
@@ -2243,7 +2243,7 @@ int compile_runtime_match(struct compile_runtime *compile_rt, long long *compile
|
|||||||
return MIN(bool_match_ret, compile_ids_size);
|
return MIN(bool_match_ret, compile_ids_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
int maat_compile_state_update(int vtable_id, struct maat_item *hit_items,
|
int compile_state_update(int vtable_id, struct maat_item *hit_items,
|
||||||
size_t n_hit_item, struct maat_state *state)
|
size_t n_hit_item, struct maat_state *state)
|
||||||
{
|
{
|
||||||
size_t i = 0, j = 0;
|
size_t i = 0, j = 0;
|
||||||
@@ -2252,12 +2252,12 @@ int maat_compile_state_update(int vtable_id, struct maat_item *hit_items,
|
|||||||
|
|
||||||
struct maat *maat_inst = state->maat_inst;
|
struct maat *maat_inst = state->maat_inst;
|
||||||
if (NULL == state->compile_state) {
|
if (NULL == state->compile_state) {
|
||||||
state->compile_state = maat_compile_state_new();
|
state->compile_state = compile_state_new();
|
||||||
alignment_int64_array_add(maat_inst->stat->maat_compile_state_cnt,
|
alignment_int64_array_add(maat_inst->stat->compile_state_cnt,
|
||||||
state->thread_id, 1);
|
state->thread_id, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct maat_compile_state *compile_state = state->compile_state;
|
struct compile_state *compile_state = state->compile_state;
|
||||||
utarray_clear(compile_state->this_scan_hit_clauses);
|
utarray_clear(compile_state->this_scan_hit_clauses);
|
||||||
compile_state->Nth_scan = state->scan_cnt;
|
compile_state->Nth_scan = state->scan_cnt;
|
||||||
|
|
||||||
@@ -2280,9 +2280,9 @@ int maat_compile_state_update(int vtable_id, struct maat_item *hit_items,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (1 == maat_inst->opts.hit_group_on) {
|
if (1 == maat_inst->opts.hit_group_on) {
|
||||||
maat_compile_state_update_direct_hit_groups(compile_state->direct_hit_groups,
|
compile_state_update_direct_hit_groups(compile_state->direct_hit_groups,
|
||||||
hit_items, hit_cnt, vtable_id);
|
hit_items, hit_cnt, vtable_id);
|
||||||
maat_compile_state_update_indirect_hit_groups(compile_state->indirect_hit_groups,
|
compile_state_update_indirect_hit_groups(compile_state->indirect_hit_groups,
|
||||||
super_group_ids, super_group_cnt, vtable_id);
|
super_group_ids, super_group_cnt, vtable_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2303,12 +2303,12 @@ int maat_compile_state_update(int vtable_id, struct maat_item *hit_items,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < hit_cnt; i++) {
|
for (i = 0; i < hit_cnt; i++) {
|
||||||
maat_compile_state_update_hit_clause(state->compile_state, compile_rt,
|
compile_state_update_hit_clause(state->compile_state, compile_rt,
|
||||||
hit_group_ids[i], vtable_id);
|
hit_group_ids[i], vtable_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
long long hit_NOT_group_ids[VTABLE_MAX_NOT_GROUP_NUM];
|
long long hit_NOT_group_ids[VTABLE_MAX_NOT_GROUP_NUM];
|
||||||
size_t hit_not_cnt = maat_compile_state_update_hit_not_clauses(state->compile_state, compile_rt,
|
size_t hit_not_cnt = compile_state_update_hit_not_clauses(state->compile_state, compile_rt,
|
||||||
hit_group_ids, hit_cnt, vtable_id,
|
hit_group_ids, hit_cnt, vtable_id,
|
||||||
hit_NOT_group_ids, VTABLE_MAX_NOT_GROUP_NUM);
|
hit_NOT_group_ids, VTABLE_MAX_NOT_GROUP_NUM);
|
||||||
|
|
||||||
@@ -2322,8 +2322,9 @@ int maat_compile_state_update(int vtable_id, struct maat_item *hit_items,
|
|||||||
return (hit_cnt + hit_not_cnt);
|
return (hit_cnt + hit_not_cnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t maat_compile_state_get_indirect_hit_groups(struct maat_compile_state *compile_state,
|
size_t compile_state_get_indirect_hit_groups(struct compile_state *compile_state,
|
||||||
struct maat_hit_group *group_array, size_t array_size)
|
struct maat_hit_group *group_array,
|
||||||
|
size_t array_size)
|
||||||
{
|
{
|
||||||
if (NULL == compile_state) {
|
if (NULL == compile_state) {
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2343,7 +2344,7 @@ size_t maat_compile_state_get_indirect_hit_groups(struct maat_compile_state *com
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t maat_compile_state_get_direct_hit_groups(struct maat_compile_state *compile_state,
|
size_t compile_state_get_direct_hit_groups(struct compile_state *compile_state,
|
||||||
enum maat_list_type type,
|
enum maat_list_type type,
|
||||||
struct maat_hit_group *group_array,
|
struct maat_hit_group *group_array,
|
||||||
size_t array_size)
|
size_t array_size)
|
||||||
@@ -2369,17 +2370,17 @@ size_t maat_compile_state_get_direct_hit_groups(struct maat_compile_state *compi
|
|||||||
}
|
}
|
||||||
|
|
||||||
UT_icd ut_compile_group_id_icd = {sizeof(long long), NULL, NULL, NULL};
|
UT_icd ut_compile_group_id_icd = {sizeof(long long), NULL, NULL, NULL};
|
||||||
size_t maat_compile_state_get_internal_hit_paths(struct maat_compile_state *compile_state,
|
size_t compile_state_get_internal_hit_paths(struct compile_state *compile_state,
|
||||||
struct compile_runtime *compile_rt,
|
struct compile_runtime *compile_rt,
|
||||||
struct group2group_runtime *g2g_rt,
|
struct group2group_runtime *g2g_rt,
|
||||||
struct maat_hit_path *hit_path_array,
|
struct maat_hit_path *hit_path_array,
|
||||||
size_t array_size)
|
size_t array_size)
|
||||||
{
|
{
|
||||||
size_t hit_path_cnt = 0;
|
size_t hit_path_cnt = 0;
|
||||||
struct maat_internal_hit_path *internal_path = NULL;
|
struct internal_hit_path *internal_path = NULL;
|
||||||
|
|
||||||
for (int i = 0; i < utarray_len(compile_state->internal_hit_paths); i++) {
|
for (int i = 0; i < utarray_len(compile_state->internal_hit_paths); i++) {
|
||||||
internal_path = (struct maat_internal_hit_path *)utarray_eltptr(compile_state->internal_hit_paths, i);
|
internal_path = (struct internal_hit_path *)utarray_eltptr(compile_state->internal_hit_paths, i);
|
||||||
/*
|
/*
|
||||||
NOTE: maybe one item has been deleted, but it's item_id still exist in internal_hit_paths
|
NOTE: maybe one item has been deleted, but it's item_id still exist in internal_hit_paths
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1002,7 +1002,7 @@ int expr_runtime_scan(struct expr_runtime *expr_rt, int thread_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
next:
|
next:
|
||||||
return maat_compile_state_update(vtable_id, hit_maat_items, real_hit_item_cnt, state);
|
return compile_state_update(vtable_id, hit_maat_items, real_hit_item_cnt, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct expr_matcher_stream *
|
struct expr_matcher_stream *
|
||||||
@@ -1064,7 +1064,7 @@ int expr_runtime_stream_scan(struct expr_runtime *expr_rt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
next:
|
next:
|
||||||
return maat_compile_state_update(vtable_id, hit_maat_items, real_hit_item_cnt, state);
|
return compile_state_update(vtable_id, hit_maat_items, real_hit_item_cnt, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void expr_runtime_stream_close(struct expr_runtime *expr_rt, int thread_id,
|
void expr_runtime_stream_close(struct expr_runtime *expr_rt, int thread_id,
|
||||||
|
|||||||
@@ -588,7 +588,7 @@ int flag_runtime_scan(struct flag_runtime *flag_rt, int thread_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
next:
|
next:
|
||||||
return maat_compile_state_update(vtable_id, hit_maat_items, real_hit_item_cnt, state);
|
return compile_state_update(vtable_id, hit_maat_items, real_hit_item_cnt, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void flag_runtime_hit_inc(struct flag_runtime *flag_rt, int thread_id)
|
void flag_runtime_hit_inc(struct flag_runtime *flag_rt, int thread_id)
|
||||||
|
|||||||
@@ -589,7 +589,7 @@ int interval_runtime_scan(struct interval_runtime *interval_rt, int thread_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
next:
|
next:
|
||||||
return maat_compile_state_update(vtable_id, hit_maat_items, real_hit_item_cnt, state);
|
return compile_state_update(vtable_id, hit_maat_items, real_hit_item_cnt, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void interval_runtime_hit_inc(struct interval_runtime *interval_rt, int thread_id)
|
void interval_runtime_hit_inc(struct interval_runtime *interval_rt, int thread_id)
|
||||||
|
|||||||
@@ -761,7 +761,7 @@ int ip_runtime_scan(struct ip_runtime *ip_rt, int thread_id, int ip_type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
next:
|
next:
|
||||||
return maat_compile_state_update(vtable_id, hit_maat_items, real_hit_item_cnt, state);
|
return compile_state_update(vtable_id, hit_maat_items, real_hit_item_cnt, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ip_runtime_hit_inc(struct ip_runtime *ip_rt, int thread_id)
|
void ip_runtime_hit_inc(struct ip_runtime *ip_rt, int thread_id)
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ struct maat_stat *maat_stat_new(const char *stat_file, size_t max_thread_num,
|
|||||||
stat->thread_call_cnt = alignment_int64_array_alloc(max_thread_num);
|
stat->thread_call_cnt = alignment_int64_array_alloc(max_thread_num);
|
||||||
stat->hit_cnt = alignment_int64_array_alloc(max_thread_num);
|
stat->hit_cnt = alignment_int64_array_alloc(max_thread_num);
|
||||||
stat->maat_state_cnt = alignment_int64_array_alloc(max_thread_num);
|
stat->maat_state_cnt = alignment_int64_array_alloc(max_thread_num);
|
||||||
stat->maat_compile_state_cnt = alignment_int64_array_alloc(max_thread_num);
|
stat->compile_state_cnt = alignment_int64_array_alloc(max_thread_num);
|
||||||
stat->maat_state_free_cnt = alignment_int64_array_alloc(max_thread_num);
|
stat->maat_state_free_cnt = alignment_int64_array_alloc(max_thread_num);
|
||||||
stat->maat_state_free_bytes = alignment_int64_array_alloc(max_thread_num);
|
stat->maat_state_free_bytes = alignment_int64_array_alloc(max_thread_num);
|
||||||
|
|
||||||
@@ -242,9 +242,9 @@ void maat_stat_free(struct maat_stat *stat)
|
|||||||
stat->maat_state_cnt = NULL;
|
stat->maat_state_cnt = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stat->maat_compile_state_cnt != NULL) {
|
if (stat->compile_state_cnt != NULL) {
|
||||||
alignment_int64_array_free(stat->maat_compile_state_cnt);
|
alignment_int64_array_free(stat->compile_state_cnt);
|
||||||
stat->maat_compile_state_cnt = NULL;
|
stat->compile_state_cnt = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stat->maat_state_free_cnt != NULL) {
|
if (stat->maat_state_free_cnt != NULL) {
|
||||||
@@ -454,7 +454,7 @@ void maat_stat_output(struct maat_stat *stat, long long maat_version, int perf_o
|
|||||||
stat->nr_worker_thread);
|
stat->nr_worker_thread);
|
||||||
long long maat_state_free_bytes = alignment_int64_array_sum(stat->maat_state_free_bytes,
|
long long maat_state_free_bytes = alignment_int64_array_sum(stat->maat_state_free_bytes,
|
||||||
stat->nr_worker_thread);
|
stat->nr_worker_thread);
|
||||||
long long maat_compile_state_cnt = alignment_int64_array_sum(stat->maat_compile_state_cnt,
|
long long compile_state_cnt = alignment_int64_array_sum(stat->compile_state_cnt,
|
||||||
stat->nr_worker_thread);
|
stat->nr_worker_thread);
|
||||||
size_t table_cnt = table_manager_table_count(stat->ref_tbl_mgr);
|
size_t table_cnt = table_manager_table_count(stat->ref_tbl_mgr);
|
||||||
size_t garbage_q_len = maat_garbage_bin_get_size(stat->ref_garbage_bin);
|
size_t garbage_q_len = maat_garbage_bin_get_size(stat->ref_garbage_bin);
|
||||||
@@ -475,7 +475,7 @@ void maat_stat_output(struct maat_stat *stat, long long maat_version, int perf_o
|
|||||||
fieldstat_value_set(stat->fs_handle, stat->fs_status_id[STATUS_MAAT_PER_STATE_MEM],
|
fieldstat_value_set(stat->fs_handle, stat->fs_status_id[STATUS_MAAT_PER_STATE_MEM],
|
||||||
per_state_mem);
|
per_state_mem);
|
||||||
fieldstat_value_set(stat->fs_handle, stat->fs_status_id[STATUS_COMPILE_STATE_NUM],
|
fieldstat_value_set(stat->fs_handle, stat->fs_status_id[STATUS_COMPILE_STATE_NUM],
|
||||||
maat_compile_state_cnt);
|
compile_state_cnt);
|
||||||
fieldstat_value_set(stat->fs_handle, stat->fs_status_id[STATUS_CMD_LINE_NUM],
|
fieldstat_value_set(stat->fs_handle, stat->fs_status_id[STATUS_CMD_LINE_NUM],
|
||||||
stat->line_cmd_acc_num);
|
stat->line_cmd_acc_num);
|
||||||
fieldstat_value_set(stat->fs_handle, stat->fs_status_id[STATUS_GARBAGE_QSIZE],
|
fieldstat_value_set(stat->fs_handle, stat->fs_status_id[STATUS_GARBAGE_QSIZE],
|
||||||
|
|||||||
Reference in New Issue
Block a user