[BUGFIX]fix maat_stat stream error
This commit is contained in:
@@ -80,8 +80,6 @@ long long expr_runtime_update_err_count(void *expr_runtime);
|
||||
|
||||
long long expr_runtime_scan_bytes(struct expr_runtime *expr_rt);
|
||||
|
||||
long long expr_runtime_stream_num(struct expr_runtime *expr_rt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -60,7 +60,6 @@ struct maat_item {
|
||||
struct maat_runtime {
|
||||
/* maat_runtime can be created and destroy dynamic, so need version info */
|
||||
long long version;
|
||||
|
||||
time_t last_update_time;
|
||||
|
||||
long long *ref_cnt;
|
||||
@@ -151,6 +150,7 @@ struct maat_stat {
|
||||
|
||||
|
||||
long long *thread_call_cnt;
|
||||
long long *stream_num;
|
||||
long long *hit_cnt;
|
||||
long long *not_grp_hit_cnt;
|
||||
long long *maat_state_cnt;
|
||||
|
||||
@@ -428,8 +428,7 @@ int maat_get_table_id(struct maat *maat_inst, const char *table_name)
|
||||
return table_id;
|
||||
}
|
||||
|
||||
static inline void maat_runtime_ref_inc(struct maat_runtime *maat_rt,
|
||||
int thread_id)
|
||||
static inline void maat_runtime_ref_inc(struct maat_runtime *maat_rt, int thread_id)
|
||||
{
|
||||
if (NULL == maat_rt) {
|
||||
return;
|
||||
@@ -438,8 +437,7 @@ static inline void maat_runtime_ref_inc(struct maat_runtime *maat_rt,
|
||||
alignment_int64_array_add(maat_rt->ref_cnt, thread_id, 1);
|
||||
}
|
||||
|
||||
static inline void maat_runtime_ref_dec(struct maat_runtime *maat_rt,
|
||||
int thread_id)
|
||||
static inline void maat_runtime_ref_dec(struct maat_runtime *maat_rt, int thread_id)
|
||||
{
|
||||
if (NULL == maat_rt) {
|
||||
return;
|
||||
@@ -1144,7 +1142,8 @@ int maat_scan_flag(struct maat *maat_inst, int table_id,
|
||||
|
||||
state->scan_cnt++;
|
||||
|
||||
if (NULL == maat_inst->maat_rt) {
|
||||
struct maat_runtime *maat_rt = maat_inst->maat_rt;
|
||||
if (NULL == maat_rt) {
|
||||
return MAAT_SCAN_OK;
|
||||
}
|
||||
|
||||
@@ -1169,7 +1168,7 @@ int maat_scan_flag(struct maat *maat_inst, int table_id,
|
||||
return MAAT_SCAN_ERR;
|
||||
}
|
||||
|
||||
maat_runtime_ref_inc(maat_inst->maat_rt, state->thread_id);
|
||||
maat_runtime_ref_inc(maat_rt, state->thread_id);
|
||||
alignment_int64_array_add(maat_inst->stat->thread_call_cnt, state->thread_id, 1);
|
||||
|
||||
int hit_group_cnt = flag_scan(maat_inst->tbl_mgr, state->thread_id, flag,
|
||||
@@ -1204,7 +1203,7 @@ int maat_scan_flag(struct maat *maat_inst, int table_id,
|
||||
flag_runtime_perf_stat(flag_rt, NULL, NULL, state->thread_id);
|
||||
}
|
||||
|
||||
maat_runtime_ref_dec(maat_inst->maat_rt, state->thread_id);
|
||||
maat_runtime_ref_dec(maat_rt, state->thread_id);
|
||||
|
||||
if (sum_hit_compile_cnt > 0) {
|
||||
return MAAT_SCAN_HIT;
|
||||
@@ -1232,7 +1231,8 @@ int maat_scan_integer(struct maat *maat_inst, int table_id,
|
||||
|
||||
state->scan_cnt++;
|
||||
|
||||
if (NULL == maat_inst->maat_rt) {
|
||||
struct maat_runtime *maat_rt = maat_inst->maat_rt;
|
||||
if (NULL == maat_rt) {
|
||||
return MAAT_SCAN_OK;
|
||||
}
|
||||
|
||||
@@ -1257,7 +1257,7 @@ int maat_scan_integer(struct maat *maat_inst, int table_id,
|
||||
return MAAT_SCAN_ERR;
|
||||
}
|
||||
|
||||
maat_runtime_ref_inc(maat_inst->maat_rt, state->thread_id);
|
||||
maat_runtime_ref_inc(maat_rt, state->thread_id);
|
||||
alignment_int64_array_add(maat_inst->stat->thread_call_cnt, state->thread_id, 1);
|
||||
|
||||
int hit_group_cnt = interval_scan(maat_inst->tbl_mgr, state->thread_id, integer,
|
||||
@@ -1292,7 +1292,7 @@ int maat_scan_integer(struct maat *maat_inst, int table_id,
|
||||
interval_runtime_perf_stat(interval_rt, NULL, NULL, state->thread_id);
|
||||
}
|
||||
|
||||
maat_runtime_ref_dec(maat_inst->maat_rt, state->thread_id);
|
||||
maat_runtime_ref_dec(maat_rt, state->thread_id);
|
||||
|
||||
if (sum_hit_compile_cnt > 0) {
|
||||
return MAAT_SCAN_HIT;
|
||||
@@ -1320,7 +1320,8 @@ int maat_scan_ipv4(struct maat *maat_inst, int table_id, uint32_t ip_addr,
|
||||
|
||||
state->scan_cnt++;
|
||||
|
||||
if (NULL == maat_inst->maat_rt) {
|
||||
struct maat_runtime *maat_rt = maat_inst->maat_rt;
|
||||
if (NULL == maat_rt) {
|
||||
return MAAT_SCAN_OK;
|
||||
}
|
||||
|
||||
@@ -1345,7 +1346,7 @@ int maat_scan_ipv4(struct maat *maat_inst, int table_id, uint32_t ip_addr,
|
||||
return MAAT_SCAN_ERR;
|
||||
}
|
||||
|
||||
maat_runtime_ref_inc(maat_inst->maat_rt, state->thread_id);
|
||||
maat_runtime_ref_inc(maat_rt, state->thread_id);
|
||||
alignment_int64_array_add(maat_inst->stat->thread_call_cnt, state->thread_id, 1);
|
||||
|
||||
int hit_group_cnt = ipv4_scan(maat_inst->tbl_mgr, state->thread_id, ip_addr,
|
||||
@@ -1380,7 +1381,7 @@ int maat_scan_ipv4(struct maat *maat_inst, int table_id, uint32_t ip_addr,
|
||||
ip_runtime_perf_stat(ip_rt, NULL, NULL, state->thread_id);
|
||||
}
|
||||
|
||||
maat_runtime_ref_dec(maat_inst->maat_rt, state->thread_id);
|
||||
maat_runtime_ref_dec(maat_rt, state->thread_id);
|
||||
|
||||
if (sum_hit_compile_cnt > 0) {
|
||||
return MAAT_SCAN_HIT;
|
||||
@@ -1409,7 +1410,8 @@ int maat_scan_ipv6(struct maat *maat_inst, int table_id,
|
||||
|
||||
state->scan_cnt++;
|
||||
|
||||
if (NULL == maat_inst->maat_rt) {
|
||||
struct maat_runtime *maat_rt = maat_inst->maat_rt;
|
||||
if (NULL == maat_rt) {
|
||||
return MAAT_SCAN_OK;
|
||||
}
|
||||
|
||||
@@ -1434,7 +1436,7 @@ int maat_scan_ipv6(struct maat *maat_inst, int table_id,
|
||||
return MAAT_SCAN_ERR;
|
||||
}
|
||||
|
||||
maat_runtime_ref_inc(maat_inst->maat_rt, state->thread_id);
|
||||
maat_runtime_ref_inc(maat_rt, state->thread_id);
|
||||
alignment_int64_array_add(maat_inst->stat->thread_call_cnt, state->thread_id, 1);
|
||||
|
||||
int hit_group_cnt = ipv6_scan(maat_inst->tbl_mgr, state->thread_id, ip_addr,
|
||||
@@ -1469,7 +1471,7 @@ int maat_scan_ipv6(struct maat *maat_inst, int table_id,
|
||||
ip_runtime_perf_stat(ip_rt, NULL, NULL, state->thread_id);
|
||||
}
|
||||
|
||||
maat_runtime_ref_dec(maat_inst->maat_rt, state->thread_id);
|
||||
maat_runtime_ref_dec(maat_rt, state->thread_id);
|
||||
|
||||
if (sum_hit_compile_cnt > 0) {
|
||||
return MAAT_SCAN_HIT;
|
||||
@@ -1497,7 +1499,8 @@ int maat_scan_string(struct maat *maat_inst, int table_id, const char *data,
|
||||
|
||||
state->scan_cnt++;
|
||||
|
||||
if (NULL == maat_inst->maat_rt) {
|
||||
struct maat_runtime *maat_rt = maat_inst->maat_rt;
|
||||
if (NULL == maat_rt) {
|
||||
return MAAT_SCAN_OK;
|
||||
}
|
||||
|
||||
@@ -1522,7 +1525,7 @@ int maat_scan_string(struct maat *maat_inst, int table_id, const char *data,
|
||||
return MAAT_SCAN_ERR;
|
||||
}
|
||||
|
||||
maat_runtime_ref_inc(maat_inst->maat_rt, state->thread_id);
|
||||
maat_runtime_ref_inc(maat_rt, state->thread_id);
|
||||
alignment_int64_array_add(maat_inst->stat->thread_call_cnt, state->thread_id, 1);
|
||||
|
||||
int hit_group_cnt = string_scan(maat_inst->tbl_mgr, state->thread_id, data,
|
||||
@@ -1557,7 +1560,7 @@ int maat_scan_string(struct maat *maat_inst, int table_id, const char *data,
|
||||
expr_runtime_perf_stat(expr_rt, data_len, NULL, NULL, state->thread_id);
|
||||
}
|
||||
|
||||
maat_runtime_ref_dec(maat_inst->maat_rt, state->thread_id);
|
||||
maat_runtime_ref_dec(maat_rt, state->thread_id);
|
||||
|
||||
if (sum_hit_compile_cnt > 0) {
|
||||
return MAAT_SCAN_HIT;
|
||||
@@ -1611,6 +1614,7 @@ struct maat_stream *maat_stream_new(struct maat *maat_inst, int table_id,
|
||||
if (NULL == handle) {
|
||||
goto error;
|
||||
}
|
||||
alignment_int64_array_add(maat_inst->stat->stream_num, stream->thread_id, 1);
|
||||
stream->handle = handle;
|
||||
|
||||
return stream;
|
||||
@@ -1692,7 +1696,7 @@ int maat_stream_scan(struct maat_stream *maat_stream, const char *data, int data
|
||||
|
||||
void maat_stream_free(struct maat_stream *maat_stream)
|
||||
{
|
||||
if (NULL == maat_stream) {
|
||||
if (NULL == maat_stream || NULL == maat_stream->handle) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1705,10 +1709,11 @@ void maat_stream_free(struct maat_stream *maat_stream)
|
||||
if ((maat_stream->last_full_version == maat_inst->last_full_version) &&
|
||||
(maat_stream->expr_rt_version == cur_expr_rt_version)) {
|
||||
maat_runtime_ref_dec(maat_inst->maat_rt, maat_stream->thread_id);
|
||||
} else {
|
||||
} else if (maat_stream->last_full_version != maat_inst->last_full_version) {
|
||||
maat_inst->stat->zombie_rs_stream--;
|
||||
}
|
||||
|
||||
alignment_int64_array_add(maat_inst->stat->stream_num, maat_stream->thread_id, -1);
|
||||
expr_runtime_stream_close(expr_rt, maat_stream->thread_id, maat_stream->handle);
|
||||
FREE(maat_stream);
|
||||
}
|
||||
|
||||
@@ -87,7 +87,6 @@ struct expr_runtime {
|
||||
long long *scan_cpu_time;
|
||||
long long *hit_cnt;
|
||||
long long update_err_cnt;
|
||||
long long *stream_num;
|
||||
long long *scan_bytes;
|
||||
};
|
||||
|
||||
@@ -485,7 +484,6 @@ void *expr_runtime_new(void *expr_schema, size_t max_thread_num,
|
||||
expr_rt->scan_cnt = alignment_int64_array_alloc(max_thread_num);
|
||||
expr_rt->scan_bytes = alignment_int64_array_alloc(max_thread_num);
|
||||
expr_rt->scan_cpu_time = alignment_int64_array_alloc(max_thread_num);
|
||||
expr_rt->stream_num = alignment_int64_array_alloc(max_thread_num);
|
||||
|
||||
return expr_rt;
|
||||
}
|
||||
@@ -529,11 +527,6 @@ void expr_runtime_free(void *expr_runtime)
|
||||
expr_rt->hit_cnt = NULL;
|
||||
}
|
||||
|
||||
if (expr_rt->stream_num != NULL) {
|
||||
alignment_int64_array_free(expr_rt->stream_num);
|
||||
expr_rt->stream_num = NULL;
|
||||
}
|
||||
|
||||
if (expr_rt->scan_bytes != NULL) {
|
||||
alignment_int64_array_free(expr_rt->scan_bytes);
|
||||
expr_rt->scan_bytes = NULL;
|
||||
@@ -1014,9 +1007,12 @@ expr_runtime_stream_open(struct expr_runtime *expr_rt, int thread_id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
alignment_int64_array_add(expr_rt->stream_num, thread_id, 1);
|
||||
struct adapter_hs_stream *stream = adapter_hs_stream_open(expr_rt->hs, thread_id);
|
||||
if (NULL == stream) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return adapter_hs_stream_open(expr_rt->hs, thread_id);
|
||||
return stream;
|
||||
}
|
||||
|
||||
int expr_runtime_stream_scan(struct expr_runtime *expr_rt,
|
||||
@@ -1073,7 +1069,10 @@ int expr_runtime_stream_scan(struct expr_runtime *expr_rt,
|
||||
void expr_runtime_stream_close(struct expr_runtime *expr_rt, int thread_id,
|
||||
struct adapter_hs_stream *s_handle)
|
||||
{
|
||||
alignment_int64_array_add(expr_rt->stream_num, thread_id, -1);
|
||||
if (NULL == expr_rt || thread_id < 0 || NULL == s_handle) {
|
||||
return;
|
||||
}
|
||||
|
||||
adapter_hs_stream_close(s_handle);
|
||||
}
|
||||
|
||||
@@ -1168,16 +1167,3 @@ long long expr_runtime_scan_bytes(struct expr_runtime *expr_rt)
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
long long expr_runtime_stream_num(struct expr_runtime *expr_rt)
|
||||
{
|
||||
if (NULL == expr_rt) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
long long sum = alignment_int64_array_sum(expr_rt->stream_num,
|
||||
expr_rt->n_worker_thread);
|
||||
alignment_int64_array_reset(expr_rt->stream_num, expr_rt->n_worker_thread);
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
@@ -28,21 +28,17 @@ enum MAAT_FS_STATUS {
|
||||
STATUS_TABLE_NUM,
|
||||
STATUS_PLUGIN_CACHE_NUM,
|
||||
STATUS_PLUGIN_ACC_NUM,
|
||||
STATUS_GROUP_REF_NUM,
|
||||
STATUS_GROUP_REF_NOT_NUM,
|
||||
STATUS_GROUP_REF_EXCL_NUM, //group reference exclude group num
|
||||
STATUS_COMPILE_RULE_NUM,
|
||||
STATUS_MAAT_STATE_NUM,
|
||||
STATUS_MAAT_STATE_FREE_NUM,
|
||||
STATUS_MAAT_STATE_FREE_BYTES,
|
||||
STATUS_COMPILE_STATE_NUM,
|
||||
STATUS_GARBAGE_QSIZE,
|
||||
STATUS_TOTAL_SCAN_BYTES,
|
||||
STATUS_TOTAL_SCAN_CNT,
|
||||
STATUS_UPDATE_ERR_CNT,
|
||||
STATUS_ICONV_ERR_CNT,
|
||||
STATUS_SCAN_ERR_CNT,
|
||||
STATUS_ZOMBIE_RS_STREAM,
|
||||
STATUS_STREAM_NUM,
|
||||
STATUS_ZOMBIE_STREAM_NUM,
|
||||
STATUS_NOT_GROUP_HIT,
|
||||
STATUS_CMD_LINE_NUM
|
||||
};
|
||||
@@ -50,7 +46,6 @@ enum MAAT_FS_STATUS {
|
||||
enum MAAT_FS_COLUMN {
|
||||
COLUMN_RULE_NUM = 0,
|
||||
COLUMN_REGEX_NUM,
|
||||
COLUMN_STREAM_NUM,
|
||||
COLUMN_SCAN_CNT,
|
||||
COLUMN_SCAN_BYTES,
|
||||
COLUMN_CPU_TIME, //microseconds
|
||||
@@ -60,8 +55,8 @@ enum MAAT_FS_COLUMN {
|
||||
COLUMN_HIT_RATE //scan hit rate(hit_cnt/scan_cnt)
|
||||
};
|
||||
|
||||
const char *common_column_name[] = {"rule", "reg/v6", "stream", "scan_cnt", "scan_bytes",
|
||||
"scan_cpu_time", "hit_cnt", "IN_Bps", "IN_Tps", "hit_rate"};
|
||||
const char *common_column_name[] = {"rule", "reg/v6", "scan_cnt", "scan_bytes", "scan_cpu_time",
|
||||
"hit_cnt", "IN_Bps", "IN_Tps", "hit_rate"};
|
||||
|
||||
enum field_type common_column_type[] = {
|
||||
FIELD_TYPE_GAUGE,
|
||||
@@ -89,14 +84,12 @@ static void maat_fieldstat_register(struct maat_stat *stat)
|
||||
"plug_cached", NULL, 0);
|
||||
stat->fs_status_id[STATUS_PLUGIN_ACC_NUM] = fieldstat_register(stat->fs_handle, FIELD_TYPE_GAUGE,
|
||||
"plug_acc", NULL, 0);
|
||||
stat->fs_status_id[STATUS_GROUP_REF_NUM] = fieldstat_register(stat->fs_handle, FIELD_TYPE_GAUGE,
|
||||
"group", NULL, 0);
|
||||
stat->fs_status_id[STATUS_GROUP_REF_NOT_NUM] = fieldstat_register(stat->fs_handle, FIELD_TYPE_GAUGE,
|
||||
"not_grp", NULL, 0);
|
||||
stat->fs_status_id[STATUS_NOT_GROUP_HIT] = fieldstat_register(stat->fs_handle, FIELD_TYPE_GAUGE,
|
||||
"not_grp_hit", NULL, 0);
|
||||
stat->fs_status_id[STATUS_GROUP_REF_EXCL_NUM] = fieldstat_register(stat->fs_handle, FIELD_TYPE_GAUGE,
|
||||
"excl_grp", NULL, 0);
|
||||
stat->fs_status_id[STATUS_COMPILE_RULE_NUM] = fieldstat_register(stat->fs_handle, FIELD_TYPE_GAUGE,
|
||||
"compile", NULL, 0);
|
||||
stat->fs_status_id[STATUS_GARBAGE_QSIZE] = fieldstat_register(stat->fs_handle, FIELD_TYPE_GAUGE,
|
||||
"garbage_num", NULL, 0);
|
||||
stat->fs_status_id[STATUS_MAAT_STATE_NUM] = fieldstat_register(stat->fs_handle, FIELD_TYPE_GAUGE,
|
||||
@@ -107,14 +100,10 @@ static void maat_fieldstat_register(struct maat_stat *stat)
|
||||
"maat_state_free_bytes", NULL, 0);
|
||||
stat->fs_status_id[STATUS_COMPILE_STATE_NUM] = fieldstat_register(stat->fs_handle, FIELD_TYPE_GAUGE,
|
||||
"maat_compile_state", NULL, 0);
|
||||
stat->fs_status_id[STATUS_ZOMBIE_RS_STREAM] = fieldstat_register(stat->fs_handle, FIELD_TYPE_GAUGE,
|
||||
"z_stream", NULL, 0);
|
||||
stat->fs_status_id[STATUS_NOT_GROUP_HIT] = fieldstat_register(stat->fs_handle, FIELD_TYPE_GAUGE,
|
||||
"nt_grp_hit", NULL, 0);
|
||||
stat->fs_status_id[STATUS_TOTAL_SCAN_BYTES] = fieldstat_register(stat->fs_handle, FIELD_TYPE_GAUGE,
|
||||
"scan_bytes", NULL, 0);
|
||||
stat->fs_status_id[STATUS_TOTAL_SCAN_CNT] = fieldstat_register(stat->fs_handle, FIELD_TYPE_GAUGE,
|
||||
"scan_times", NULL, 0);
|
||||
stat->fs_status_id[STATUS_STREAM_NUM] = fieldstat_register(stat->fs_handle, FIELD_TYPE_GAUGE,
|
||||
"stream_num", NULL, 0);
|
||||
stat->fs_status_id[STATUS_ZOMBIE_STREAM_NUM] = fieldstat_register(stat->fs_handle, FIELD_TYPE_GAUGE,
|
||||
"z_stream_num", NULL, 0);
|
||||
stat->fs_status_id[STATUS_UPDATE_ERR_CNT] = fieldstat_register(stat->fs_handle, FIELD_TYPE_GAUGE,
|
||||
"update_error", NULL, 0);
|
||||
stat->fs_status_id[STATUS_SCAN_ERR_CNT] = fieldstat_register(stat->fs_handle, FIELD_TYPE_GAUGE,
|
||||
@@ -222,6 +211,7 @@ struct maat_stat *maat_stat_new(const char *stat_file, size_t max_thread_num,
|
||||
|
||||
stat->nr_worker_thread = max_thread_num;
|
||||
stat->logger = logger;
|
||||
stat->stream_num = 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->not_grp_hit_cnt = alignment_int64_array_alloc(max_thread_num);
|
||||
@@ -239,6 +229,11 @@ void maat_stat_free(struct maat_stat *stat)
|
||||
return;
|
||||
}
|
||||
|
||||
if (stat->stream_num != NULL) {
|
||||
alignment_int64_array_free(stat->stream_num);
|
||||
stat->stream_num = NULL;
|
||||
}
|
||||
|
||||
if (stat->thread_call_cnt != NULL) {
|
||||
alignment_int64_array_free(stat->thread_call_cnt);
|
||||
stat->thread_call_cnt = NULL;
|
||||
@@ -334,12 +329,11 @@ int maat_stat_init(struct maat_stat *stat, struct table_manager *tbl_mgr,
|
||||
|
||||
static void maat_fieldstat_table_row_output(struct maat_stat *stat, int perf_on)
|
||||
{
|
||||
long long plugin_cache_num = 0, plugin_rule_num = 0, g2c_not_group_num = 0;
|
||||
long long compile_rule_num = 0, g2c_rule_num = 0, g2g_rule_num = 0;
|
||||
long long total_rule_num = 0, total_stream_num = 0, total_input_bytes = 0;
|
||||
long long plugin_cache_num = 0, plugin_rule_num = 0;
|
||||
long long total_rule_num = 0, total_input_bytes = 0;
|
||||
long long total_scan_cnt = 0, total_scan_cpu_time = 0, total_regex_num = 0;
|
||||
long long total_ipv6_num = 0, total_hit_cnt = 0, total_update_err = 0;
|
||||
long long g2g_excl_rule_num = 0;
|
||||
long long g2c_not_group_num = 0, g2g_excl_rule_num = 0;
|
||||
size_t max_table_count = table_manager_table_size(stat->ref_tbl_mgr);
|
||||
|
||||
for (size_t i = 0; i < max_table_count; i++) {
|
||||
@@ -360,15 +354,10 @@ static void maat_fieldstat_table_row_output(struct maat_stat *stat, int perf_on)
|
||||
plugin_cache_num += plugin_runtime_cached_row_count(runtime);
|
||||
plugin_rule_num += plugin_runtime_rule_count(runtime);
|
||||
break;
|
||||
case TABLE_TYPE_COMPILE:
|
||||
compile_rule_num += compile_runtime_rule_count(runtime);
|
||||
break;
|
||||
case TABLE_TYPE_GROUP2COMPILE:
|
||||
g2c_rule_num += group2compile_runtime_rule_count(runtime);
|
||||
g2c_not_group_num += group2compile_runtime_not_group_count(runtime);
|
||||
break;
|
||||
case TABLE_TYPE_GROUP2GROUP:
|
||||
g2g_rule_num += group2group_runtime_rule_count(runtime);
|
||||
g2g_excl_rule_num += group2group_runtime_exclude_rule_count(runtime);
|
||||
break;
|
||||
case TABLE_TYPE_EXPR:
|
||||
@@ -401,11 +390,6 @@ static void maat_fieldstat_table_row_output(struct maat_stat *stat, int perf_on)
|
||||
if (table_type == TABLE_TYPE_EXPR || table_type == TABLE_TYPE_EXPR_PLUS) {
|
||||
fieldstat_value_set(stat->fs_handle, stat->fs_column_id[i][COLUMN_REGEX_NUM],
|
||||
regex_rule_num);
|
||||
long long stream_num = expr_runtime_stream_num(runtime);
|
||||
fieldstat_value_set(stat->fs_handle, stat->fs_column_id[i][COLUMN_STREAM_NUM],
|
||||
stream_num);
|
||||
total_stream_num += stream_num;
|
||||
|
||||
long long input_bytes = expr_runtime_scan_bytes(runtime);
|
||||
fieldstat_value_set(stat->fs_handle, stat->fs_column_id[i][COLUMN_SCAN_BYTES],
|
||||
input_bytes);
|
||||
@@ -439,10 +423,10 @@ static void maat_fieldstat_table_row_output(struct maat_stat *stat, int perf_on)
|
||||
total_rule_num);
|
||||
fieldstat_value_set(stat->fs_handle, stat->total_stat_id[COLUMN_REGEX_NUM],
|
||||
total_regex_num);
|
||||
fieldstat_value_set(stat->fs_handle, stat->total_stat_id[COLUMN_STREAM_NUM],
|
||||
total_stream_num);
|
||||
fieldstat_value_set(stat->fs_handle, stat->total_stat_id[COLUMN_SCAN_CNT],
|
||||
total_scan_cnt);
|
||||
fieldstat_value_set(stat->fs_handle, stat->total_stat_id[COLUMN_HIT_CNT],
|
||||
total_hit_cnt);
|
||||
fieldstat_value_set(stat->fs_handle, stat->total_stat_id[COLUMN_SCAN_BYTES],
|
||||
total_input_bytes);
|
||||
|
||||
@@ -451,28 +435,18 @@ static void maat_fieldstat_table_row_output(struct maat_stat *stat, int perf_on)
|
||||
total_scan_cpu_time);
|
||||
}
|
||||
|
||||
fieldstat_value_set(stat->fs_handle, stat->fs_status_id[STATUS_TOTAL_SCAN_BYTES],
|
||||
total_input_bytes);
|
||||
fieldstat_value_set(stat->fs_handle, stat->fs_status_id[STATUS_TOTAL_SCAN_CNT],
|
||||
total_scan_cnt);
|
||||
fieldstat_value_set(stat->fs_handle, stat->fs_status_id[STATUS_UPDATE_ERR_CNT],
|
||||
total_update_err);
|
||||
fieldstat_value_set(stat->fs_handle, stat->fs_status_id[STATUS_SCAN_ERR_CNT],
|
||||
stat->scan_err_cnt);
|
||||
fieldstat_value_set(stat->fs_handle, stat->fs_status_id[STATUS_ZOMBIE_RS_STREAM],
|
||||
stat->zombie_rs_stream);
|
||||
fieldstat_value_set(stat->fs_handle, stat->fs_status_id[STATUS_PLUGIN_CACHE_NUM],
|
||||
plugin_cache_num);
|
||||
fieldstat_value_set(stat->fs_handle, stat->fs_status_id[STATUS_PLUGIN_ACC_NUM],
|
||||
plugin_rule_num);
|
||||
fieldstat_value_set(stat->fs_handle, stat->fs_status_id[STATUS_GROUP_REF_NUM],
|
||||
g2c_rule_num);
|
||||
fieldstat_value_set(stat->fs_handle, stat->fs_status_id[STATUS_GROUP_REF_NOT_NUM],
|
||||
g2c_not_group_num);
|
||||
fieldstat_value_set(stat->fs_handle, stat->fs_status_id[STATUS_GROUP_REF_EXCL_NUM],
|
||||
g2g_excl_rule_num);
|
||||
fieldstat_value_set(stat->fs_handle, stat->fs_status_id[STATUS_COMPILE_RULE_NUM],
|
||||
compile_rule_num);
|
||||
}
|
||||
|
||||
void maat_stat_output(struct maat_stat *stat, long long maat_version, int perf_on)
|
||||
@@ -483,6 +457,8 @@ void maat_stat_output(struct maat_stat *stat, long long maat_version, int perf_o
|
||||
|
||||
long long active_thread_num = alignment_int64_array_cnt(stat->thread_call_cnt,
|
||||
stat->nr_worker_thread);
|
||||
long long stream_num = alignment_int64_array_sum(stat->stream_num,
|
||||
stat->nr_worker_thread);
|
||||
long long maat_state_cnt = alignment_int64_array_sum(stat->maat_state_cnt,
|
||||
stat->nr_worker_thread);
|
||||
long long maat_state_free_cnt = alignment_int64_array_sum(stat->maat_state_free_cnt,
|
||||
@@ -516,7 +492,10 @@ void maat_stat_output(struct maat_stat *stat, long long maat_version, int perf_o
|
||||
stat->line_cmd_acc_num);
|
||||
fieldstat_value_set(stat->fs_handle, stat->fs_status_id[STATUS_GARBAGE_QSIZE],
|
||||
garbage_q_len);
|
||||
|
||||
fieldstat_value_set(stat->fs_handle, stat->fs_status_id[STATUS_STREAM_NUM],
|
||||
stream_num);
|
||||
fieldstat_value_set(stat->fs_handle, stat->fs_status_id[STATUS_ZOMBIE_STREAM_NUM],
|
||||
stat->zombie_rs_stream);
|
||||
maat_fieldstat_table_row_output(stat, perf_on);
|
||||
|
||||
fieldstat_passive_output(stat->fs_handle);
|
||||
|
||||
@@ -1759,6 +1759,7 @@ protected:
|
||||
|
||||
struct maat_options *opts = maat_options_new();
|
||||
maat_options_set_redis(opts, redis_ip, redis_port, redis_db);
|
||||
maat_options_set_stat_file(opts, "./stat.log");
|
||||
maat_options_set_logger(opts, "./maat_framework_gtest.log", LOG_LEVEL_INFO);
|
||||
maat_options_set_accept_tags(opts, accept_tags);
|
||||
|
||||
@@ -1852,6 +1853,7 @@ protected:
|
||||
|
||||
struct maat_options *opts = maat_options_new();
|
||||
maat_options_set_redis(opts, redis_ip, redis_port, redis_db);
|
||||
maat_options_set_stat_file(opts, "./stat.log");
|
||||
maat_options_set_logger(opts, "./maat_framework_gtest.log", LOG_LEVEL_INFO);
|
||||
maat_options_set_accept_tags(opts, accept_tags);
|
||||
|
||||
@@ -2110,6 +2112,7 @@ protected:
|
||||
|
||||
struct maat_options *opts = maat_options_new();
|
||||
maat_options_set_redis(opts, redis_ip, redis_port, redis_db);
|
||||
maat_options_set_stat_file(opts, "./stat.log");
|
||||
maat_options_set_logger(opts, "./maat_framework_gtest.log", LOG_LEVEL_INFO);
|
||||
maat_options_set_accept_tags(opts, accept_tags);
|
||||
|
||||
@@ -2449,6 +2452,7 @@ protected:
|
||||
|
||||
struct maat_options *opts = maat_options_new();
|
||||
maat_options_set_redis(opts, redis_ip, redis_port, redis_db);
|
||||
maat_options_set_stat_file(opts, "./stat.log");
|
||||
maat_options_set_logger(opts, "./maat_framework_gtest.log", LOG_LEVEL_INFO);
|
||||
maat_options_set_accept_tags(opts, accept_tags);
|
||||
|
||||
@@ -2705,6 +2709,7 @@ protected:
|
||||
|
||||
struct maat_options *opts = maat_options_new();
|
||||
maat_options_set_redis(opts, redis_ip, redis_port, redis_db);
|
||||
maat_options_set_stat_file(opts, "./stat.log");
|
||||
maat_options_set_logger(opts, "./maat_framework_gtest.log", LOG_LEVEL_INFO);
|
||||
maat_options_set_accept_tags(opts, accept_tags);
|
||||
|
||||
@@ -2842,6 +2847,7 @@ protected:
|
||||
|
||||
struct maat_options *opts = maat_options_new();
|
||||
maat_options_set_redis(opts, redis_ip, redis_port, redis_db);
|
||||
maat_options_set_stat_file(opts, "./stat.log");
|
||||
maat_options_set_logger(opts, "./maat_framework_gtest.log", LOG_LEVEL_INFO);
|
||||
maat_options_set_accept_tags(opts, accept_tags);
|
||||
|
||||
@@ -3007,6 +3013,7 @@ protected:
|
||||
|
||||
struct maat_options *opts = maat_options_new();
|
||||
maat_options_set_redis(opts, redis_ip, redis_port, redis_db);
|
||||
maat_options_set_stat_file(opts, "./stat.log");
|
||||
maat_options_set_logger(opts, "./maat_framework_gtest.log", LOG_LEVEL_INFO);
|
||||
maat_options_set_accept_tags(opts, accept_tags);
|
||||
|
||||
@@ -3091,6 +3098,7 @@ protected:
|
||||
|
||||
struct maat_options *opts = maat_options_new();
|
||||
maat_options_set_redis(opts, redis_ip, redis_port, redis_db);
|
||||
maat_options_set_stat_file(opts, "./stat.log");
|
||||
maat_options_set_logger(opts, "./maat_framework_gtest.log", LOG_LEVEL_INFO);
|
||||
maat_options_set_accept_tags(opts, accept_tags);
|
||||
|
||||
@@ -3153,6 +3161,7 @@ protected:
|
||||
|
||||
struct maat_options *opts = maat_options_new();
|
||||
maat_options_set_redis(opts, redis_ip, redis_port, redis_db);
|
||||
maat_options_set_stat_file(opts, "./stat.log");
|
||||
maat_options_set_logger(opts, "./maat_framework_gtest.log", LOG_LEVEL_INFO);
|
||||
maat_options_set_accept_tags(opts, accept_tags);
|
||||
|
||||
@@ -3321,6 +3330,7 @@ protected:
|
||||
|
||||
struct maat_options *opts = maat_options_new();
|
||||
maat_options_set_redis(opts, redis_ip, redis_port, redis_db);
|
||||
maat_options_set_stat_file(opts, "./stat.log");
|
||||
maat_options_set_logger(opts, "./maat_framework_gtest.log", LOG_LEVEL_INFO);
|
||||
maat_options_set_accept_tags(opts, accept_tags);
|
||||
|
||||
@@ -3569,6 +3579,7 @@ protected:
|
||||
}
|
||||
|
||||
struct maat_options *opts = maat_options_new();
|
||||
maat_options_set_stat_file(opts, "./stat.log");
|
||||
maat_options_set_redis(opts, redis_ip, redis_port, redis_db);
|
||||
maat_options_set_logger(opts, "./maat_framework_gtest.log", LOG_LEVEL_INFO);
|
||||
maat_options_set_accept_tags(opts, accept_tags);
|
||||
@@ -3632,6 +3643,7 @@ protected:
|
||||
struct maat_options *opts = maat_options_new();
|
||||
maat_options_set_caller_thread_number(opts, g_thread_num);
|
||||
maat_options_set_instance_name(opts, "files");
|
||||
maat_options_set_stat_file(opts, "./stat.log");
|
||||
maat_options_set_iris(opts, rule_folder, rule_folder);
|
||||
maat_options_set_rule_update_checking_interval_ms(opts, scan_interval_ms);
|
||||
maat_options_set_rule_effect_interval_ms(opts, effective_interval_ms);
|
||||
@@ -3735,6 +3747,7 @@ protected:
|
||||
|
||||
struct maat_options *opts = maat_options_new();
|
||||
maat_options_set_redis(opts, redis_ip, redis_port, redis_db);
|
||||
maat_options_set_stat_file(opts, "./stat.log");
|
||||
maat_options_set_logger(opts, "./maat_framework_gtest.log", LOG_LEVEL_INFO);
|
||||
maat_options_set_accept_tags(opts, accept_tags);
|
||||
|
||||
@@ -3961,6 +3974,7 @@ protected:
|
||||
|
||||
struct maat_options *opts = maat_options_new();
|
||||
maat_options_set_redis(opts, redis_ip, redis_port, redis_db);
|
||||
maat_options_set_stat_file(opts, "./stat.log");
|
||||
maat_options_set_logger(opts, "./maat_framework_gtest.log", LOG_LEVEL_INFO);
|
||||
|
||||
_shared_maat_inst = maat_new(opts, table_info_path);
|
||||
|
||||
Reference in New Issue
Block a user