2016-02-10 10:01:18 +08:00
|
|
|
#include "Maat_rule_internal.h"
|
2018-11-27 12:55:52 +08:00
|
|
|
#include "alignment_int64.h"
|
2016-02-18 14:53:06 +08:00
|
|
|
#include <time.h>
|
2016-02-18 09:58:01 +08:00
|
|
|
#include <MESA/field_stat.h>
|
2016-02-10 10:01:18 +08:00
|
|
|
enum MAAT_FS_STATUS{
|
|
|
|
|
STATUS_VERSION=0,
|
2016-02-18 14:53:06 +08:00
|
|
|
STATUS_THRED_NUM,
|
2016-02-10 10:01:18 +08:00
|
|
|
STATUS_TABLE_NUM,
|
2016-12-15 12:05:48 +08:00
|
|
|
STATUS_PLUGIN_CACHE_NUM,
|
|
|
|
|
STATUS_PLUGIN_ACC_NUM,
|
|
|
|
|
STATUS_GROUP_RULE_NUM,
|
|
|
|
|
STATUS_COMPILE_RULE_NUM,
|
|
|
|
|
STATUS_POSTPONE_QSIZE,
|
2016-02-11 13:57:39 +08:00
|
|
|
STATUS_OUTER_MID_NUM,
|
|
|
|
|
STATUS_INNER_MID_NUM,
|
2016-02-10 10:01:18 +08:00
|
|
|
STATUS_GARBAGE_QSIZE,
|
2016-05-11 10:23:40 +08:00
|
|
|
STATUS_TOTAL_SCAN_LEN,
|
|
|
|
|
STATUS_TOTAL_SCAN_CNT,
|
2016-10-08 11:40:57 +08:00
|
|
|
STATUS_UPDATE_ERR_CNT,
|
|
|
|
|
STATUS_ICONV_ERR_CNT,
|
2016-10-21 16:42:04 +08:00
|
|
|
STATUS_SCAN_ERR_CNT,
|
2017-06-24 21:38:11 +08:00
|
|
|
STATUS_ZOMBIE_RS_STREAM,
|
|
|
|
|
STATUS_ORPHAN_GROUP_SAVING,
|
2017-07-04 10:02:18 +08:00
|
|
|
STATUS_LAST_REGION_SAVING,
|
|
|
|
|
STATUS_CMD_NUM,
|
2018-05-24 15:45:46 +08:00
|
|
|
STATUS_CMD_Q_SIZE,
|
|
|
|
|
STATUS_CMD_LINE_NUM
|
2016-02-10 10:01:18 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum MAAT_FS_COLUMN
|
|
|
|
|
{
|
|
|
|
|
COLUMN_TABLE_RULE_NUM=0,
|
|
|
|
|
COLUMN_TABLE_REGEX_NUM,
|
|
|
|
|
COLUMN_TABLE_STREAM_NUM,
|
|
|
|
|
COLUMN_TABLE_SCAN_CNT,
|
|
|
|
|
COLUMN_TABLE_SCAN_BYTES,
|
|
|
|
|
COLUMN_TABLE_CPU_TIME,//microseconds
|
2016-05-11 10:23:40 +08:00
|
|
|
COLUMN_TABLE_HIT_CNT,
|
2016-02-10 10:01:18 +08:00
|
|
|
};
|
2016-09-03 16:39:37 +08:00
|
|
|
#define MAX_CONJ_NAME_LEN 22
|
2016-02-10 10:01:18 +08:00
|
|
|
void maat_stat_init(struct _Maat_feather_t* feather)
|
|
|
|
|
{
|
|
|
|
|
int value=0;
|
2016-08-30 10:40:05 +08:00
|
|
|
int i=0,j=0,offset=0;
|
2016-02-10 10:01:18 +08:00
|
|
|
struct _Maat_table_info_t* p_table=NULL;
|
2016-08-30 11:08:32 +08:00
|
|
|
char conj_table_name[(MAX_TABLE_NAME_LEN+1)*MAX_CONJUNCTION_TABLE_NUM]={0};
|
2016-02-10 10:01:18 +08:00
|
|
|
|
|
|
|
|
feather->stat_handle=FS_create_handle();
|
|
|
|
|
FS_set_para(feather->stat_handle, OUTPUT_DEVICE, feather->stat_file, strlen(feather->stat_file)+1);
|
|
|
|
|
value=1;
|
|
|
|
|
FS_set_para(feather->stat_handle, PRINT_MODE, &value, sizeof(value));
|
|
|
|
|
value=0;
|
|
|
|
|
FS_set_para(feather->stat_handle, CREATE_THREAD, &value, sizeof(value));
|
|
|
|
|
|
|
|
|
|
feather->fs_status_id[STATUS_VERSION]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"version");
|
2017-07-08 16:42:51 +08:00
|
|
|
feather->fs_status_id[STATUS_THRED_NUM]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"thread");
|
2016-02-10 10:01:18 +08:00
|
|
|
feather->fs_status_id[STATUS_TABLE_NUM]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"table_num");
|
2016-12-15 12:05:48 +08:00
|
|
|
|
|
|
|
|
feather->fs_status_id[STATUS_PLUGIN_CACHE_NUM]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"plug_cache");
|
|
|
|
|
feather->fs_status_id[STATUS_PLUGIN_ACC_NUM]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"plug_acc");
|
|
|
|
|
|
2017-06-24 21:38:11 +08:00
|
|
|
feather->fs_status_id[STATUS_GROUP_RULE_NUM]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"grp_num");
|
2016-12-15 12:05:48 +08:00
|
|
|
feather->fs_status_id[STATUS_COMPILE_RULE_NUM]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"compile_num");
|
|
|
|
|
|
2017-07-08 16:42:51 +08:00
|
|
|
feather->fs_status_id[STATUS_POSTPONE_QSIZE]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"postponed");
|
2016-12-15 12:05:48 +08:00
|
|
|
feather->fs_status_id[STATUS_GARBAGE_QSIZE]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"garbage_num");
|
|
|
|
|
|
2016-02-11 13:57:39 +08:00
|
|
|
feather->fs_status_id[STATUS_OUTER_MID_NUM]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"outer_mid");
|
|
|
|
|
feather->fs_status_id[STATUS_INNER_MID_NUM]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"inner_mid");
|
2017-07-08 16:42:51 +08:00
|
|
|
feather->fs_status_id[STATUS_ZOMBIE_RS_STREAM]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"z_stream");
|
|
|
|
|
|
|
|
|
|
feather->fs_status_id[STATUS_ORPHAN_GROUP_SAVING]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"only_grp_sv");
|
2017-06-24 21:38:11 +08:00
|
|
|
feather->fs_status_id[STATUS_LAST_REGION_SAVING]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"last_rgn_sv");
|
2016-12-15 12:05:48 +08:00
|
|
|
|
2016-05-11 10:23:40 +08:00
|
|
|
feather->fs_status_id[STATUS_TOTAL_SCAN_LEN]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"scan_bytes");
|
|
|
|
|
feather->fs_status_id[STATUS_TOTAL_SCAN_CNT]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"scan_times");
|
2017-07-08 16:42:51 +08:00
|
|
|
feather->fs_status_id[STATUS_UPDATE_ERR_CNT]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"update_err");
|
|
|
|
|
feather->fs_status_id[STATUS_ICONV_ERR_CNT]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"iconv_err");
|
2016-10-08 11:40:57 +08:00
|
|
|
feather->fs_status_id[STATUS_SCAN_ERR_CNT]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"scan_error");
|
2017-07-04 10:02:18 +08:00
|
|
|
feather->fs_status_id[STATUS_CMD_NUM]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"cmd_commit");
|
|
|
|
|
feather->fs_status_id[STATUS_CMD_Q_SIZE]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"cmd_in_q");
|
2018-05-24 15:45:46 +08:00
|
|
|
feather->fs_status_id[STATUS_CMD_LINE_NUM]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_SPEED,"line_cmd/s");
|
2016-10-21 16:42:04 +08:00
|
|
|
|
2016-02-10 10:01:18 +08:00
|
|
|
feather->fs_column_id[COLUMN_TABLE_RULE_NUM]=FS_register(feather->stat_handle, FS_STYLE_COLUMN, FS_CALC_CURRENT,"rule");
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_REGEX_NUM]=FS_register(feather->stat_handle, FS_STYLE_COLUMN, FS_CALC_CURRENT,"regex");
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_STREAM_NUM]=FS_register(feather->stat_handle, FS_STYLE_COLUMN, FS_CALC_CURRENT,"stream");
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_SCAN_BYTES]=FS_register(feather->stat_handle, FS_STYLE_COLUMN, FS_CALC_SPEED,"IN_Bps");
|
|
|
|
|
if(feather->perf_on==1)
|
|
|
|
|
{
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_CPU_TIME]=FS_register(feather->stat_handle, FS_STYLE_COLUMN, FS_CALC_SPEED,"cpu_us");
|
|
|
|
|
value=feather->fs_column_id[COLUMN_TABLE_CPU_TIME];
|
|
|
|
|
FS_set_para(feather->stat_handle, ID_INVISBLE, &value, sizeof(value));
|
|
|
|
|
FS_register_ratio(feather->stat_handle,
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_SCAN_BYTES],
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_CPU_TIME],
|
2016-02-18 09:58:01 +08:00
|
|
|
1000000, //microsecond to second
|
2016-02-10 10:01:18 +08:00
|
|
|
FS_STYLE_COLUMN,
|
|
|
|
|
FS_CALC_SPEED,
|
|
|
|
|
"PROC_Bps");
|
2016-02-18 14:53:06 +08:00
|
|
|
}
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_SCAN_CNT]=FS_register(feather->stat_handle, FS_STYLE_COLUMN, FS_CALC_SPEED,"IN_Tps");
|
|
|
|
|
if(feather->perf_on==1)
|
|
|
|
|
{
|
2016-02-18 09:58:01 +08:00
|
|
|
FS_register_ratio(feather->stat_handle,
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_SCAN_CNT],
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_CPU_TIME],
|
|
|
|
|
1000000, //microsecond to second
|
|
|
|
|
FS_STYLE_COLUMN,
|
|
|
|
|
FS_CALC_SPEED,
|
|
|
|
|
"PROC_Tps");
|
2016-02-10 10:01:18 +08:00
|
|
|
}
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_HIT_CNT]=FS_register(feather->stat_handle, FS_STYLE_COLUMN, FS_CALC_SPEED,"hit_cnt");
|
|
|
|
|
value=feather->fs_column_id[COLUMN_TABLE_HIT_CNT];
|
|
|
|
|
FS_set_para(feather->stat_handle, ID_INVISBLE, &value, sizeof(value));
|
|
|
|
|
FS_register_ratio(feather->stat_handle,
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_HIT_CNT],
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_SCAN_CNT],
|
2016-02-18 09:58:01 +08:00
|
|
|
1,
|
2016-02-10 10:01:18 +08:00
|
|
|
FS_STYLE_COLUMN,
|
|
|
|
|
FS_CALC_SPEED,
|
|
|
|
|
"hit_rate");
|
|
|
|
|
feather->total_stat_id=FS_register(feather->stat_handle, FS_STYLE_LINE, FS_CALC_CURRENT,"Sum");
|
|
|
|
|
for(i=0;i<MAX_TABLE_NUM;i++)
|
|
|
|
|
{
|
|
|
|
|
p_table=feather->p_table_info[i];
|
|
|
|
|
if(p_table==NULL||p_table->table_type==TABLE_TYPE_PLUGIN
|
|
|
|
|
||p_table->table_type==TABLE_TYPE_GROUP
|
|
|
|
|
||p_table->table_type==TABLE_TYPE_COMPILE)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2016-08-30 10:40:05 +08:00
|
|
|
offset=0;
|
|
|
|
|
for(j=0;j<p_table->conj_cnt;j++)
|
|
|
|
|
{
|
|
|
|
|
offset+=snprintf(conj_table_name+offset,sizeof(conj_table_name)-offset
|
|
|
|
|
,"%s/",p_table->table_name[j]);
|
|
|
|
|
}
|
2016-09-03 16:39:37 +08:00
|
|
|
conj_table_name[offset-1]='\0';//delete the last slash
|
|
|
|
|
if(strlen(conj_table_name)>MAX_CONJ_NAME_LEN)
|
|
|
|
|
{
|
2017-09-15 20:00:46 +08:00
|
|
|
conj_table_name[MAX_CONJ_NAME_LEN]='\0';
|
2016-09-03 16:39:37 +08:00
|
|
|
}
|
2016-08-30 10:40:05 +08:00
|
|
|
p_table->stat_line_id=FS_register(feather->stat_handle
|
|
|
|
|
, FS_STYLE_LINE, FS_CALC_CURRENT
|
|
|
|
|
,conj_table_name);
|
2016-02-10 10:01:18 +08:00
|
|
|
}
|
|
|
|
|
FS_start(feather->stat_handle);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2016-05-09 22:02:27 +08:00
|
|
|
void maat_stat_table(struct _Maat_table_info_t* p_table,int scan_len,struct timespec* start, struct timespec* end,int thread_num)
|
2016-02-10 10:01:18 +08:00
|
|
|
{
|
2018-11-27 12:55:52 +08:00
|
|
|
alignment_int64_array_add(p_table->scan_cnt,thread_num,1);
|
|
|
|
|
alignment_int64_array_add(p_table->input_bytes,thread_num,scan_len);
|
2016-02-18 14:53:06 +08:00
|
|
|
if(start!=NULL&&end!=NULL)
|
|
|
|
|
{
|
2018-11-27 12:55:52 +08:00
|
|
|
alignment_int64_array_add(p_table->scan_cpu_time,thread_num,(end->tv_sec-start->tv_sec)*1000000000+end->tv_nsec-start->tv_nsec);
|
2016-02-18 14:53:06 +08:00
|
|
|
}
|
2016-02-10 10:01:18 +08:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
void maat_stat_output(struct _Maat_feather_t* feather)
|
|
|
|
|
{
|
|
|
|
|
long value=0;
|
2016-05-09 22:02:27 +08:00
|
|
|
long long total_cfg_num=0, total_input_bytes=0, total_regex_num=0,total_hit_cnt=0;
|
2016-02-18 14:53:06 +08:00
|
|
|
long long total_scan_cnt=0, total_cpu_time=0,total_stream_cnt=0,active_thread_num=0;
|
2016-05-09 22:02:27 +08:00
|
|
|
long long table_stream_num=0,table_scan_cnt=0,table_input_bytes=0,table_scan_cpu_time=0,table_hit_cnt=0;
|
|
|
|
|
long long outer_mid_cnt=0,inner_mid_cnt=0;
|
2017-06-24 21:38:11 +08:00
|
|
|
long long orphan_group_saving=0, last_region_saving=0;
|
2016-10-08 11:40:57 +08:00
|
|
|
long long total_update_error=0,total_iconv_error=0;
|
2016-12-15 12:05:48 +08:00
|
|
|
long long compile_rule_num=0,group_rule_num=0,plugin_cache_num=0,plugin_acc_num=0;
|
2016-02-10 10:01:18 +08:00
|
|
|
int i=0;
|
2016-02-18 14:53:06 +08:00
|
|
|
time_t now;
|
2016-02-10 10:01:18 +08:00
|
|
|
struct _Maat_table_info_t* p_table=NULL;
|
2016-02-18 14:53:06 +08:00
|
|
|
time(&now);
|
2018-11-27 12:55:52 +08:00
|
|
|
active_thread_num=alignment_int64_array_cnt(feather->thread_call_cnt, feather->scan_thread_num);
|
|
|
|
|
outer_mid_cnt=alignment_int64_array_sum(feather->outer_mid_cnt,feather->scan_thread_num);
|
|
|
|
|
inner_mid_cnt=alignment_int64_array_sum(feather->inner_mid_cnt,feather->scan_thread_num);
|
|
|
|
|
orphan_group_saving=alignment_int64_array_sum(feather->orphan_group_saving,feather->scan_thread_num);
|
|
|
|
|
last_region_saving=alignment_int64_array_sum(feather->last_region_saving,feather->scan_thread_num);
|
2017-06-24 21:38:11 +08:00
|
|
|
|
2016-02-10 10:01:18 +08:00
|
|
|
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_VERSION], 0,FS_OP_SET,feather->maat_version);
|
2016-02-18 14:53:06 +08:00
|
|
|
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_THRED_NUM], 0,FS_OP_SET,active_thread_num);
|
2016-02-10 10:01:18 +08:00
|
|
|
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_TABLE_NUM], 0,FS_OP_SET,feather->table_cnt);
|
2016-05-09 22:02:27 +08:00
|
|
|
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_OUTER_MID_NUM], 0,FS_OP_SET,outer_mid_cnt);
|
|
|
|
|
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_INNER_MID_NUM], 0,FS_OP_SET,inner_mid_cnt);
|
2017-06-24 21:38:11 +08:00
|
|
|
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_ORPHAN_GROUP_SAVING], 0,FS_OP_SET,orphan_group_saving);
|
|
|
|
|
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_LAST_REGION_SAVING], 0,FS_OP_SET,last_region_saving);
|
2017-07-04 10:02:18 +08:00
|
|
|
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_CMD_NUM], 0,FS_OP_SET,feather->cmd_acc_num);
|
|
|
|
|
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_CMD_Q_SIZE], 0,FS_OP_SET,feather->cmd_q_cnt);
|
2018-05-24 15:45:46 +08:00
|
|
|
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_CMD_LINE_NUM], 0,FS_OP_SET,feather->line_cmd_acc_num);
|
2016-02-10 10:01:18 +08:00
|
|
|
|
|
|
|
|
value=MESA_lqueue_get_count(feather->garbage_q);
|
|
|
|
|
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_GARBAGE_QSIZE], 0,FS_OP_SET,value);
|
2016-10-08 11:40:57 +08:00
|
|
|
feather->update_err_cnt=0;
|
|
|
|
|
feather->iconv_err_cnt=0;
|
2016-02-10 10:01:18 +08:00
|
|
|
for(i=0;i<MAX_TABLE_NUM;i++)
|
|
|
|
|
{
|
2016-05-09 22:02:27 +08:00
|
|
|
table_stream_num=0;
|
|
|
|
|
table_scan_cnt=0;
|
|
|
|
|
table_input_bytes=0;
|
|
|
|
|
table_scan_cpu_time=0;
|
|
|
|
|
table_hit_cnt=0;
|
2016-02-10 10:01:18 +08:00
|
|
|
p_table=feather->p_table_info[i];
|
2016-12-15 12:05:48 +08:00
|
|
|
if(p_table==NULL)
|
2016-02-10 10:01:18 +08:00
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2016-12-15 12:05:48 +08:00
|
|
|
switch(p_table->table_type)
|
|
|
|
|
{
|
|
|
|
|
case TABLE_TYPE_PLUGIN:
|
|
|
|
|
plugin_cache_num+=p_table->cb_info->cache_line_num;
|
|
|
|
|
plugin_acc_num+=p_table->cb_info->acc_line_num;
|
|
|
|
|
break;
|
|
|
|
|
case TABLE_TYPE_GROUP:
|
|
|
|
|
group_rule_num+=p_table->cfg_num;
|
|
|
|
|
break;
|
|
|
|
|
case TABLE_TYPE_COMPILE:
|
|
|
|
|
compile_rule_num+=p_table->cfg_num;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
FS_operate(feather->stat_handle,
|
|
|
|
|
p_table->stat_line_id,
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_RULE_NUM],
|
|
|
|
|
FS_OP_SET,
|
|
|
|
|
p_table->cfg_num);
|
|
|
|
|
total_cfg_num+=p_table->cfg_num;
|
|
|
|
|
|
|
|
|
|
FS_operate(feather->stat_handle,
|
|
|
|
|
p_table->stat_line_id,
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_REGEX_NUM],
|
|
|
|
|
FS_OP_SET,
|
|
|
|
|
p_table->regex_rule_cnt);
|
|
|
|
|
total_regex_num+= p_table->regex_rule_cnt;
|
2016-02-10 10:01:18 +08:00
|
|
|
|
2018-11-27 12:55:52 +08:00
|
|
|
table_stream_num=alignment_int64_array_sum(p_table->stream_num,feather->scan_thread_num);
|
2016-12-15 12:05:48 +08:00
|
|
|
FS_operate(feather->stat_handle,
|
|
|
|
|
p_table->stat_line_id,
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_STREAM_NUM],
|
|
|
|
|
FS_OP_SET,
|
|
|
|
|
table_stream_num);
|
|
|
|
|
total_stream_cnt+= table_stream_num;
|
2016-05-09 22:02:27 +08:00
|
|
|
|
2018-11-27 12:55:52 +08:00
|
|
|
table_scan_cnt=alignment_int64_array_sum(p_table->scan_cnt,feather->scan_thread_num);
|
2016-12-15 12:05:48 +08:00
|
|
|
FS_operate(feather->stat_handle,
|
|
|
|
|
p_table->stat_line_id,
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_SCAN_CNT],
|
|
|
|
|
FS_OP_SET,
|
|
|
|
|
table_scan_cnt);
|
|
|
|
|
total_scan_cnt+=table_scan_cnt;
|
2016-05-09 22:02:27 +08:00
|
|
|
|
2018-11-27 12:55:52 +08:00
|
|
|
table_input_bytes=alignment_int64_array_sum(p_table->input_bytes,feather->scan_thread_num);
|
2016-12-15 12:05:48 +08:00
|
|
|
FS_operate(feather->stat_handle,
|
|
|
|
|
p_table->stat_line_id,
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_SCAN_BYTES],
|
|
|
|
|
FS_OP_SET,
|
|
|
|
|
table_input_bytes);
|
|
|
|
|
total_input_bytes+=table_input_bytes;
|
|
|
|
|
if(feather->perf_on==1)
|
|
|
|
|
{
|
2018-11-27 12:55:52 +08:00
|
|
|
table_scan_cpu_time=alignment_int64_array_sum(p_table->scan_cpu_time,feather->scan_thread_num);
|
2016-12-15 12:05:48 +08:00
|
|
|
table_scan_cpu_time/=1000;
|
|
|
|
|
FS_operate(feather->stat_handle,
|
|
|
|
|
p_table->stat_line_id,
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_CPU_TIME],
|
|
|
|
|
FS_OP_SET,
|
|
|
|
|
table_scan_cpu_time);
|
|
|
|
|
total_cpu_time+=table_scan_cpu_time;
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-27 12:55:52 +08:00
|
|
|
table_hit_cnt=alignment_int64_array_sum(p_table->hit_cnt,feather->scan_thread_num);
|
2016-12-15 12:05:48 +08:00
|
|
|
FS_operate(feather->stat_handle,
|
|
|
|
|
p_table->stat_line_id,
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_HIT_CNT],
|
|
|
|
|
FS_OP_SET,
|
|
|
|
|
table_hit_cnt);
|
|
|
|
|
total_update_error+=p_table->udpate_err_cnt;
|
|
|
|
|
total_iconv_error+=p_table->iconv_err_cnt;
|
|
|
|
|
//total hit count stat in region_compile
|
|
|
|
|
break;
|
2016-02-10 10:01:18 +08:00
|
|
|
}
|
|
|
|
|
}
|
2016-10-08 11:40:57 +08:00
|
|
|
|
2016-02-10 10:01:18 +08:00
|
|
|
FS_operate(feather->stat_handle,
|
|
|
|
|
feather->total_stat_id,
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_RULE_NUM],
|
|
|
|
|
FS_OP_SET,
|
|
|
|
|
total_cfg_num);
|
|
|
|
|
FS_operate(feather->stat_handle,
|
|
|
|
|
feather->total_stat_id,
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_REGEX_NUM],
|
|
|
|
|
FS_OP_SET,
|
|
|
|
|
total_regex_num);
|
|
|
|
|
FS_operate(feather->stat_handle,
|
|
|
|
|
feather->total_stat_id,
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_STREAM_NUM],
|
|
|
|
|
FS_OP_SET,
|
|
|
|
|
total_stream_cnt);
|
|
|
|
|
FS_operate(feather->stat_handle,
|
|
|
|
|
feather->total_stat_id,
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_SCAN_CNT],
|
2016-05-09 22:02:27 +08:00
|
|
|
FS_OP_SET,
|
2016-02-10 10:01:18 +08:00
|
|
|
total_scan_cnt);
|
|
|
|
|
FS_operate(feather->stat_handle,
|
|
|
|
|
feather->total_stat_id,
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_SCAN_BYTES],
|
2016-05-09 22:02:27 +08:00
|
|
|
FS_OP_SET,
|
2016-02-10 10:01:18 +08:00
|
|
|
total_input_bytes);
|
|
|
|
|
if(feather->perf_on==1)
|
|
|
|
|
{
|
|
|
|
|
FS_operate(feather->stat_handle,
|
|
|
|
|
feather->total_stat_id,
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_CPU_TIME],
|
2016-05-09 22:02:27 +08:00
|
|
|
FS_OP_SET,
|
|
|
|
|
total_cpu_time);
|
2016-02-10 10:01:18 +08:00
|
|
|
}
|
2018-11-27 12:55:52 +08:00
|
|
|
total_hit_cnt=alignment_int64_array_sum(feather->hit_cnt,feather->scan_thread_num);
|
2016-02-10 10:01:18 +08:00
|
|
|
FS_operate(feather->stat_handle,
|
|
|
|
|
feather->total_stat_id,
|
|
|
|
|
feather->fs_column_id[COLUMN_TABLE_HIT_CNT],
|
2016-05-09 22:02:27 +08:00
|
|
|
FS_OP_SET,
|
|
|
|
|
total_hit_cnt);
|
2016-05-11 09:53:00 +08:00
|
|
|
feather->total_scan_bytes=total_input_bytes;
|
|
|
|
|
feather->total_scan_cnt=total_scan_cnt;
|
2016-05-11 10:23:40 +08:00
|
|
|
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_TOTAL_SCAN_LEN], 0,FS_OP_SET,feather->total_scan_bytes);
|
|
|
|
|
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_TOTAL_SCAN_CNT], 0,FS_OP_SET,feather->total_scan_cnt);
|
2016-10-08 11:40:57 +08:00
|
|
|
feather->update_err_cnt=total_update_error;
|
|
|
|
|
feather->iconv_err_cnt=total_iconv_error;
|
|
|
|
|
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_UPDATE_ERR_CNT], 0,FS_OP_SET,feather->update_err_cnt);
|
|
|
|
|
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_ICONV_ERR_CNT], 0,FS_OP_SET,feather->iconv_err_cnt);
|
|
|
|
|
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_SCAN_ERR_CNT], 0,FS_OP_SET,feather->scan_err_cnt);
|
2016-10-21 16:42:04 +08:00
|
|
|
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_ZOMBIE_RS_STREAM], 0,FS_OP_SET,feather->zombie_rs_stream);
|
2016-10-08 11:40:57 +08:00
|
|
|
|
2016-12-15 12:05:48 +08:00
|
|
|
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_PLUGIN_CACHE_NUM], 0,FS_OP_SET,plugin_cache_num);
|
|
|
|
|
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_PLUGIN_ACC_NUM], 0,FS_OP_SET,plugin_acc_num);
|
|
|
|
|
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_GROUP_RULE_NUM], 0,FS_OP_SET,group_rule_num);
|
|
|
|
|
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_COMPILE_RULE_NUM], 0,FS_OP_SET,compile_rule_num);
|
|
|
|
|
|
|
|
|
|
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_POSTPONE_QSIZE], 0,FS_OP_SET,feather->postpone_q_size);
|
|
|
|
|
|
2016-02-10 10:01:18 +08:00
|
|
|
FS_passive_output(feather->stat_handle);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|