From 1b4ba1e905c7314b85d4fb4a7cf126e3c0a451c2 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 11 Jan 2016 18:29:04 +0100 Subject: [PATCH] MEDIUM: stats: make use of stats_dump_info_fields() for "show info" Now we can get rid of the huge chunk_printf() and use this new function instead. --- src/dumpstats.c | 94 ++----------------------------------------------- 1 file changed, 2 insertions(+), 92 deletions(-) diff --git a/src/dumpstats.c b/src/dumpstats.c index 05facda7d..650e77326 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -2930,98 +2930,8 @@ static int stats_dump_info_to_buffer(struct stream_interface *si) if (global.desc) info[INF_DESCRIPTION] = mkf_str(FO_CONFIG|FN_OUTPUT|FS_SERVICE, global.desc); - chunk_printf(&trash, - "Name: " PRODUCT_NAME "\n" - "Version: " HAPROXY_VERSION "\n" - "Release_date: " HAPROXY_DATE "\n" - "Nbproc: %d\n" - "Process_num: %d\n" - "Pid: %d\n" - "Uptime: %dd %dh%02dm%02ds\n" - "Uptime_sec: %d\n" - "Memmax_MB: %d\n" - "PoolAlloc_MB: %d\n" - "PoolUsed_MB: %d\n" - "PoolFailed: %d\n" - "Ulimit-n: %d\n" - "Maxsock: %d\n" - "Maxconn: %d\n" - "Hard_maxconn: %d\n" - "CurrConns: %d\n" - "CumConns: %d\n" - "CumReq: %u\n" -#ifdef USE_OPENSSL - "MaxSslConns: %d\n" - "CurrSslConns: %d\n" - "CumSslConns: %d\n" -#endif - "Maxpipes: %d\n" - "PipesUsed: %d\n" - "PipesFree: %d\n" - "ConnRate: %d\n" - "ConnRateLimit: %d\n" - "MaxConnRate: %d\n" - "SessRate: %d\n" - "SessRateLimit: %d\n" - "MaxSessRate: %d\n" -#ifdef USE_OPENSSL - "SslRate: %d\n" - "SslRateLimit: %d\n" - "MaxSslRate: %d\n" - "SslFrontendKeyRate: %d\n" - "SslFrontendMaxKeyRate: %d\n" - "SslFrontendSessionReuse_pct: %d\n" - "SslBackendKeyRate: %d\n" - "SslBackendMaxKeyRate: %d\n" - "SslCacheLookups: %u\n" - "SslCacheMisses: %u\n" -#endif - "CompressBpsIn: %u\n" - "CompressBpsOut: %u\n" - "CompressBpsRateLim: %u\n" -#ifdef USE_ZLIB - "ZlibMemUsage: %ld\n" - "MaxZlibMemUsage: %ld\n" -#endif - "Tasks: %d\n" - "Run_queue: %d\n" - "Idle_pct: %d\n" - "node: %s\n" - "description: %s\n" - "", - global.nbproc, - relative_pid, - pid, - up / 86400, (up % 86400) / 3600, (up % 3600) / 60, (up % 60), - up, - global.rlimit_memmax, - (int)(pool_total_allocated() / 1048576L), - (int)(pool_total_used() / 1048576L), - pool_total_failures(), - global.rlimit_nofile, - global.maxsock, global.maxconn, global.hardmaxconn, - actconn, totalconn, global.req_count, -#ifdef USE_OPENSSL - global.maxsslconn, sslconns, totalsslconns, -#endif - global.maxpipes, pipes_used, pipes_free, - read_freq_ctr(&global.conn_per_sec), global.cps_lim, global.cps_max, - read_freq_ctr(&global.sess_per_sec), global.sps_lim, global.sps_max, -#ifdef USE_OPENSSL - ssl_sess_rate, global.ssl_lim, global.ssl_max, - ssl_key_rate, global.ssl_fe_keys_max, - ssl_reuse, - read_freq_ctr(&global.ssl_be_keys_per_sec), global.ssl_be_keys_max, - global.shctx_lookups, global.shctx_misses, -#endif - read_freq_ctr(&global.comp_bps_in), read_freq_ctr(&global.comp_bps_out), - global.comp_rate_lim, -#ifdef USE_ZLIB - zlib_used_memory, global.maxzlibmem, -#endif - nb_tasks_cur, run_queue_cur, idle_pct, - global.node, global.desc ? global.desc : "" - ); + chunk_reset(&trash); + stats_dump_info_fields(&trash, info); if (bi_putchk(si_ic(si), &trash) == -1) { si_applet_cant_put(si);