diff --git a/src/entry/Maat_rule.cpp b/src/entry/Maat_rule.cpp index 92a5e4c..6c8fcb0 100644 --- a/src/entry/Maat_rule.cpp +++ b/src/entry/Maat_rule.cpp @@ -2384,9 +2384,11 @@ void *thread_rule_monitor(void *arg) const char* inc_cfg_dir=(const char*)feather->inc_dir; struct _Maat_scanner_t* old_scanner=NULL; long expr_wait_q_cnt=0; + int scan_dir_cnt=0; while(feather->still_working) { usleep(feather->scan_interval_ms*1000); + scan_dir_cnt++; config_monitor_traverse(feather->maat_version, inc_cfg_dir, maat_start_cb, @@ -2424,7 +2426,7 @@ void *thread_rule_monitor(void *arg) } } garbage_bury(feather->garbage_q,feather->logger); - if(feather->stat_on==1) + if(feather->stat_on==1&&scan_dir_cnt%2==0)//output every 2 seconds { maat_stat_output(feather); } diff --git a/src/entry/Maat_stat.cpp b/src/entry/Maat_stat.cpp index 2b05e77..828c9ae 100644 --- a/src/entry/Maat_stat.cpp +++ b/src/entry/Maat_stat.cpp @@ -1,5 +1,5 @@ #include "Maat_rule_internal.h" -#include "field_stat.h" +#include enum MAAT_FS_STATUS{ STATUS_VERSION=0, STATUS_TABLE_NUM, @@ -40,7 +40,7 @@ void maat_stat_init(struct _Maat_feather_t* feather) 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_CNT]=FS_register(feather->stat_handle, FS_STYLE_COLUMN, FS_CALC_SPEED,"scan_cps"); + feather->fs_column_id[COLUMN_TABLE_SCAN_CNT]=FS_register(feather->stat_handle, FS_STYLE_COLUMN, FS_CALC_SPEED,"IN_Tps"); 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) { @@ -50,9 +50,17 @@ void maat_stat_init(struct _Maat_feather_t* feather) FS_register_ratio(feather->stat_handle, feather->fs_column_id[COLUMN_TABLE_SCAN_BYTES], feather->fs_column_id[COLUMN_TABLE_CPU_TIME], + 1000000, //microsecond to second FS_STYLE_COLUMN, FS_CALC_SPEED, "PROC_Bps"); + 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"); } 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]; @@ -60,6 +68,7 @@ void maat_stat_init(struct _Maat_feather_t* feather) FS_register_ratio(feather->stat_handle, feather->fs_column_id[COLUMN_TABLE_HIT_CNT], feather->fs_column_id[COLUMN_TABLE_SCAN_CNT], + 1, FS_STYLE_COLUMN, FS_CALC_SPEED, "hit_rate"); diff --git a/src/inc_internal/field_stat.h b/src/inc_internal/field_stat.h index 07e8a5f..6bdf657 100644 --- a/src/inc_internal/field_stat.h +++ b/src/inc_internal/field_stat.h @@ -49,7 +49,8 @@ void FS_stop(screen_stat_handle_t* handle); int FS_register(screen_stat_handle_t handle,enum field_dsp_style_t style,enum field_calc_algo calc_type,const char* name); //numerator_id and denominator_id must be column/field/status style. -int FS_register_ratio(screen_stat_handle_t handle,int numerator_id,int denominator_id,enum field_dsp_style_t style,enum field_calc_algo calc_type,const char* name); +//scaling: negative value: zoom in; positive value: zoom out; +int FS_register_ratio(screen_stat_handle_t handle,int numerator_id,int denominator_id,int scaling,enum field_dsp_style_t style,enum field_calc_algo calc_type,const char* name); //id: when id's type is FIELD , column_id is ignore. int FS_operate(screen_stat_handle_t handle,int id,int column_id,enum field_op op,long long value);