增加future性能监控的可读性。
This commit is contained in:
@@ -21,6 +21,7 @@ struct future_promise_instance
|
||||
MESA_htable_handle name_table;
|
||||
char statsd_server_ip[256];
|
||||
int statsd_server_port;
|
||||
enum field_calc_algo favorite;
|
||||
char histogram_bins[256];
|
||||
screen_stat_handle_t fs_handle;
|
||||
};
|
||||
@@ -63,6 +64,7 @@ void future_promise_library_init(const char* profile)
|
||||
|
||||
int value=0;
|
||||
memset(&g_FP_instance,0,sizeof(g_FP_instance));
|
||||
g_FP_instance.favorite=FS_CALC_SPEED;
|
||||
strcpy(g_FP_instance.histogram_bins, FP_HISTOGRAM_BINS);
|
||||
if(profile!=NULL)
|
||||
{
|
||||
@@ -72,8 +74,12 @@ void future_promise_library_init(const char* profile)
|
||||
MESA_load_profile_int_def(profile, "STAT", "statsd_port", &(g_FP_instance.statsd_server_port), 0);
|
||||
MESA_load_profile_string_def(profile, "STAT", "histogram_bins",
|
||||
g_FP_instance.histogram_bins, sizeof(g_FP_instance.histogram_bins), FP_HISTOGRAM_BINS);
|
||||
|
||||
|
||||
MESA_load_profile_int_def(profile, "STAT", "print_diff",
|
||||
&value, 1);
|
||||
if(value==0)
|
||||
{
|
||||
g_FP_instance.favorite=FS_CALC_CURRENT;
|
||||
}
|
||||
}
|
||||
if(g_FP_instance.no_stats)
|
||||
{
|
||||
@@ -114,7 +120,7 @@ void future_promise_library_init(const char* profile)
|
||||
FS_set_para(fs, STATS_SERVER_PORT, &(g_FP_instance.statsd_server_port), sizeof(g_FP_instance.statsd_server_port));
|
||||
}
|
||||
FS_set_para(fs, HISTOGRAM_GLOBAL_BINS, g_FP_instance.histogram_bins, strlen(g_FP_instance.histogram_bins)+1);
|
||||
g_FP_instance.fsid_f_num=FS_register(fs, FS_STYLE_FIELD, FS_CALC_CURRENT, "futures");
|
||||
g_FP_instance.fsid_f_num=FS_register(fs, FS_STYLE_FIELD, g_FP_instance.favorite, "futures");
|
||||
FS_start(fs);
|
||||
g_FP_instance.fs_handle=fs;
|
||||
g_is_FP_init=1;
|
||||
@@ -165,11 +171,11 @@ static long field_get_set_cb(void * data, const uchar * key, uint size, void * u
|
||||
{
|
||||
field_id=(int*)malloc(sizeof(int)*2);
|
||||
snprintf(buff,sizeof(buff),"%s(ms)",(char*)key);
|
||||
field_id[0]=FS_register_histogram(args->fs_handle, FS_CALC_SPEED, buff,
|
||||
field_id[0]=FS_register_histogram(args->fs_handle, g_FP_instance.favorite, buff,
|
||||
1, 30*1000,3);
|
||||
args->fsid_latency=field_id[0];
|
||||
snprintf(buff,sizeof(buff),"%s%s",(char*)key,fail_str);
|
||||
field_id[1]=FS_register(args->fs_handle, FS_STYLE_FIELD, FS_CALC_SPEED,buff);
|
||||
field_id[1]=FS_register(args->fs_handle, FS_STYLE_FIELD, g_FP_instance.favorite, buff);
|
||||
args->fsid_failed=field_id[1];
|
||||
ret = MESA_htable_add(args->htable, key, size, (void*)field_id);
|
||||
assert(ret>=0);
|
||||
|
||||
Reference in New Issue
Block a user