Maat_stat中输出cmd计数。
This commit is contained in:
@@ -482,7 +482,7 @@ int Maat_append_command(Maat_feather_t feather,struct Maat_command_t* cmd,enum M
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if(_feather->cmd_num==0)
|
||||
if(_feather->cmd_q_cnt==0)
|
||||
{
|
||||
assert(_feather->cmd_qtail==_feather->cmd_qhead==NULL);
|
||||
_feather->cmd_qhead=_feather->cmd_qtail=_cmd;
|
||||
@@ -492,7 +492,7 @@ int Maat_append_command(Maat_feather_t feather,struct Maat_command_t* cmd,enum M
|
||||
_feather->cmd_qtail->next=_cmd;
|
||||
_feather->cmd_qtail=_cmd;
|
||||
}
|
||||
_feather->cmd_num++;
|
||||
_feather->cmd_q_cnt++;
|
||||
return;
|
||||
}
|
||||
//TODO: support plugin rule command.
|
||||
@@ -898,17 +898,17 @@ int Maat_commit_command(Maat_feather_t feather)
|
||||
freeReplyObject(data_reply);
|
||||
}
|
||||
}
|
||||
|
||||
_feather->cmd_commit_num+=_feather->cmd_q_cnt;
|
||||
error_out:
|
||||
p=_feather->cmd_qhead;
|
||||
for(i=0;i<_feather->cmd_num;i++)
|
||||
for(i=0;i<_feather->cmd_q_cnt;i++)
|
||||
{
|
||||
n=p->next;
|
||||
Maat_free_command((struct Maat_command_t* )p);
|
||||
p=n;
|
||||
}
|
||||
_feather->cmd_qhead=_feather->cmd_qtail=NULL;
|
||||
_feather->cmd_num=0;
|
||||
_feather->cmd_q_cnt=0;
|
||||
|
||||
for(i=0;i<serial_rule_num;i++)
|
||||
{
|
||||
|
||||
@@ -375,7 +375,7 @@ struct _Maat_feather_t
|
||||
redisContext *redis_read_ctx;
|
||||
redisContext *redis_write_ctx; // not thread safe.
|
||||
int on_redis_writing;
|
||||
int cmd_num;
|
||||
int cmd_q_cnt;
|
||||
struct _Maat_cmd_t* cmd_qhead, *cmd_qtail;
|
||||
pthread_mutex_t redis_write_lock; //protect redis_write_ctx
|
||||
long long base_rgn_seq,base_grp_seq;
|
||||
@@ -398,6 +398,7 @@ struct _Maat_feather_t
|
||||
long long zombie_rs_stream;
|
||||
long long postpone_q_size;
|
||||
long long compile_rule_num;
|
||||
long long cmd_acc_num;
|
||||
};
|
||||
struct _maat_garbage_t
|
||||
{
|
||||
|
||||
@@ -21,7 +21,9 @@ enum MAAT_FS_STATUS{
|
||||
STATUS_SCAN_ERR_CNT,
|
||||
STATUS_ZOMBIE_RS_STREAM,
|
||||
STATUS_ORPHAN_GROUP_SAVING,
|
||||
STATUS_LAST_REGION_SAVING
|
||||
STATUS_LAST_REGION_SAVING,
|
||||
STATUS_CMD_NUM,
|
||||
STATUS_CMD_Q_SIZE
|
||||
};
|
||||
|
||||
enum MAAT_FS_COLUMN
|
||||
@@ -73,6 +75,8 @@ void maat_stat_init(struct _Maat_feather_t* feather)
|
||||
feather->fs_status_id[STATUS_ICONV_ERR_CNT]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"iconv_error");
|
||||
feather->fs_status_id[STATUS_SCAN_ERR_CNT]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"scan_error");
|
||||
feather->fs_status_id[STATUS_ZOMBIE_RS_STREAM]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"zombie_stream");
|
||||
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");
|
||||
|
||||
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");
|
||||
@@ -177,6 +181,8 @@ void maat_stat_output(struct _Maat_feather_t* feather)
|
||||
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_INNER_MID_NUM], 0,FS_OP_SET,inner_mid_cnt);
|
||||
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);
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user