add maat_stat instance_name
This commit is contained in:
@@ -24,7 +24,7 @@ struct maat_stat *maat_stat_new(const char *stat_file, size_t max_thread_num,
|
|||||||
void maat_stat_free(struct maat_stat *stat);
|
void maat_stat_free(struct maat_stat *stat);
|
||||||
|
|
||||||
int maat_stat_init(struct maat_stat *stat, struct table_manager *tbl_mgr,
|
int maat_stat_init(struct maat_stat *stat, struct table_manager *tbl_mgr,
|
||||||
struct maat_garbage_bin *garbage_bin, const char *stat_inst_name);
|
struct maat_garbage_bin *garbage_bin);
|
||||||
|
|
||||||
void maat_stat_output(struct maat_stat *stat, long long maat_version, int perf_on);
|
void maat_stat_output(struct maat_stat *stat, long long maat_version, int perf_on);
|
||||||
|
|
||||||
|
|||||||
@@ -433,8 +433,7 @@ struct maat *maat_new(struct maat_options *opts, const char *table_info_path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (1 == maat_instance->stat_on) {
|
if (1 == maat_instance->stat_on) {
|
||||||
int ret = maat_stat_init(maat_instance->stat, maat_instance->tbl_mgr, maat_instance->garbage_bin,
|
int ret = maat_stat_init(maat_instance->stat, maat_instance->tbl_mgr, maat_instance->garbage_bin);
|
||||||
maat_instance->instance_name);
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
log_error(maat_instance->logger, MODULE_MAAT_API,
|
log_error(maat_instance->logger, MODULE_MAAT_API,
|
||||||
"[%s:%d] maat_stat_init failed.", __FUNCTION__, __LINE__);
|
"[%s:%d] maat_stat_init failed.", __FUNCTION__, __LINE__);
|
||||||
|
|||||||
@@ -189,14 +189,14 @@ void maat_stat_free(struct maat_stat *stat)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int maat_stat_init(struct maat_stat *stat, struct table_manager *tbl_mgr,
|
int maat_stat_init(struct maat_stat *stat, struct table_manager *tbl_mgr,
|
||||||
struct maat_garbage_bin *garbage_bin, const char *stat_inst_name)
|
struct maat_garbage_bin *garbage_bin)
|
||||||
{
|
{
|
||||||
if (NULL == stat || NULL == tbl_mgr || NULL == garbage_bin ||
|
if (NULL == stat || NULL == tbl_mgr || NULL == garbage_bin) {
|
||||||
NULL == stat_inst_name) {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
stat->fs_handle = fieldstat_instance_new(stat_inst_name);
|
const char *instance_name = "maat_stat";
|
||||||
|
stat->fs_handle = fieldstat_instance_new(instance_name);
|
||||||
if (NULL == stat->fs_handle) {
|
if (NULL == stat->fs_handle) {
|
||||||
log_error(stat->logger, MODULE_MAAT_STAT, "fieldstat_instance_new failed.");
|
log_error(stat->logger, MODULE_MAAT_STAT, "fieldstat_instance_new failed.");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -219,7 +219,7 @@ int maat_stat_init(struct maat_stat *stat, struct table_manager *tbl_mgr,
|
|||||||
stat->ref_tbl_mgr = tbl_mgr;
|
stat->ref_tbl_mgr = tbl_mgr;
|
||||||
stat->ref_garbage_bin = garbage_bin;
|
stat->ref_garbage_bin = garbage_bin;
|
||||||
size_t n_column = sizeof(common_column_name) / sizeof(common_column_name[0]);
|
size_t n_column = sizeof(common_column_name) / sizeof(common_column_name[0]);
|
||||||
int fs_table_id = fieldstat_register_table(stat->fs_handle, stat_inst_name,
|
int fs_table_id = fieldstat_register_table(stat->fs_handle, instance_name,
|
||||||
common_column_name, common_column_type,
|
common_column_name, common_column_type,
|
||||||
n_column);
|
n_column);
|
||||||
if (fs_table_id < 0) {
|
if (fs_table_id < 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user