perf: 删除无效代码;修改变量命名;减少内存分配
This commit is contained in:
@@ -220,13 +220,13 @@ static void global_metrics_parse_config(const char *profile, struct metrics_conf
|
||||
config->statsd_format = 1;
|
||||
}
|
||||
|
||||
LOG_DEBUG("%s: STAT->output_file : %s", LOG_TAG_METRICS, config->output_file);
|
||||
LOG_DEBUG("%s: STAT->statsd_server : %s", LOG_TAG_METRICS, config->statsd_server);
|
||||
LOG_DEBUG("%s: STAT->statsd_port : %d", LOG_TAG_METRICS, config->statsd_port);
|
||||
LOG_DEBUG("%s: STAT->statsd_format : %d", LOG_TAG_METRICS, config->statsd_format);
|
||||
LOG_DEBUG("%s: STAT->statsd_cycle : %d", LOG_TAG_METRICS, config->statsd_cycle);
|
||||
LOG_DEBUG("%s: STAT->prometheus_listen_port : %d", LOG_TAG_METRICS, config->prometheus_listen_port);
|
||||
LOG_DEBUG("%s: STAT->prometheus_listen_url : %s", LOG_TAG_METRICS, config->prometheus_listen_url);
|
||||
LOG_DEBUG("STAT->output_file : %s", config->output_file);
|
||||
LOG_DEBUG("STAT->statsd_server : %s", config->statsd_server);
|
||||
LOG_DEBUG("STAT->statsd_port : %d", config->statsd_port);
|
||||
LOG_DEBUG("STAT->statsd_format : %d", config->statsd_format);
|
||||
LOG_DEBUG("STAT->statsd_cycle : %d", config->statsd_cycle);
|
||||
LOG_DEBUG("STAT->prometheus_listen_port : %d", config->prometheus_listen_port);
|
||||
LOG_DEBUG("STAT->prometheus_listen_url : %s", config->prometheus_listen_url);
|
||||
}
|
||||
|
||||
struct global_metrics *global_metrics_create(const char *profile, int thread_num)
|
||||
@@ -264,7 +264,7 @@ struct global_metrics *global_metrics_create(const char *profile, int thread_num
|
||||
|
||||
if (STAT_MAX >= (sizeof(global_metrics->fs_id) / sizeof(global_metrics->fs_id[0])))
|
||||
{
|
||||
LOG_ERROR("%s: field stat has insufficient space to store fs_id, and supports a maximum of %lu fsids, but %d is needed ", LOG_TAG_METRICS, (sizeof(global_metrics->fs_id) / sizeof(global_metrics->fs_id[0])), STAT_MAX);
|
||||
LOG_ERROR("field stat has insufficient space to store fs_id, and supports a maximum of %lu fsids, but %d is needed ", (sizeof(global_metrics->fs_id) / sizeof(global_metrics->fs_id[0])), STAT_MAX);
|
||||
global_metrics_destory(global_metrics);
|
||||
return NULL;
|
||||
}
|
||||
@@ -283,6 +283,18 @@ void global_metrics_destory(struct global_metrics *global_metrics)
|
||||
{
|
||||
if (global_metrics)
|
||||
{
|
||||
if (global_metrics->thread_metrics_flag)
|
||||
{
|
||||
free(global_metrics->thread_metrics_flag);
|
||||
global_metrics->thread_metrics_flag = NULL;
|
||||
}
|
||||
|
||||
if (global_metrics->thread_metrics_cache)
|
||||
{
|
||||
free(global_metrics->thread_metrics_cache);
|
||||
global_metrics->thread_metrics_cache = NULL;
|
||||
}
|
||||
|
||||
FS_library_destroy();
|
||||
free(global_metrics);
|
||||
global_metrics = NULL;
|
||||
|
||||
Reference in New Issue
Block a user