]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: stats: make use of stats_dump_info_fields() for "show info"
authorWilly Tarreau <w@1wt.eu>
Mon, 11 Jan 2016 17:29:04 +0000 (18:29 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 11 Mar 2016 16:08:04 +0000 (17:08 +0100)
Now we can get rid of the huge chunk_printf() and use this new function
instead.

src/dumpstats.c

index 05facda7df456c52e1287b8e09cdc1e5696f81df..650e773266e26ab8fd74cf036079237e377177b3 100644 (file)
@@ -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);