From: Willy Tarreau Date: Sat, 21 Mar 2009 17:33:52 +0000 (+0100) Subject: [MINOR] stats: report number of tasks (active and running) X-Git-Tag: v1.3.16~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c7bdf09f9fd8374f23e8ab0fc61daf02c4ddcb9d;p=thirdparty%2Fhaproxy.git [MINOR] stats: report number of tasks (active and running) It may be useful for statistics purposes to report the number of tasks. --- diff --git a/include/proto/task.h b/include/proto/task.h index 54418b64ed..19aab61679 100644 --- a/include/proto/task.h +++ b/include/proto/task.h @@ -80,6 +80,8 @@ /* a few exported variables */ extern unsigned int nb_tasks; /* total number of tasks */ extern unsigned int run_queue; /* run queue size */ +extern unsigned int run_queue_cur; +extern unsigned int nb_tasks_cur; extern unsigned int niced_tasks; /* number of niced tasks in the run queue */ extern struct pool_head *pool2_task; extern struct eb32_node *last_timer; /* optimization: last queued timer */ diff --git a/src/dumpstats.c b/src/dumpstats.c index 990e51f894..fd38f95ddf 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -235,6 +235,8 @@ int stats_dump_raw(struct session *s, struct buffer *rep, struct uri_auth *uri) "CurrConns: %d\n" "PipesUsed: %d\n" "PipesFree: %d\n" + "Tasks: %d\n" + "Run_queue: %d\n" "", global.nbproc, relative_pid, @@ -244,7 +246,8 @@ int stats_dump_raw(struct session *s, struct buffer *rep, struct uri_auth *uri) global.rlimit_memmax, global.rlimit_nofile, global.maxsock, global.maxconn, global.maxpipes, - actconn, pipes_used, pipes_free + actconn, pipes_used, pipes_free, + nb_tasks_cur, run_queue_cur ); if (buffer_write_chunk(rep, &msg) >= 0) return 0; @@ -468,6 +471,7 @@ int stats_dump_http(struct session *s, struct buffer *rep, struct uri_auth *uri) "system limits : memmax = %s%s ; ulimit-n = %d
\n" "maxsock = %d ; maxconn = %d ; maxpipes = %d
\n" "current conns = %d ; current pipes = %d/%d
\n" + "Running tasks : %d/%d
\n" "\n" "\n" "" @@ -496,7 +500,8 @@ int stats_dump_http(struct session *s, struct buffer *rep, struct uri_auth *uri) global.rlimit_memmax ? " MB" : "", global.rlimit_nofile, global.maxsock, global.maxconn, global.maxpipes, - actconn, pipes_used, pipes_used+pipes_free + actconn, pipes_used, pipes_used+pipes_free, + run_queue_cur, nb_tasks_cur ); if (s->data_ctx.stats.flags & STAT_HIDE_DOWN) diff --git a/src/task.c b/src/task.c index 8374c12749..95a00faed2 100644 --- a/src/task.c +++ b/src/task.c @@ -27,6 +27,8 @@ struct pool_head *pool2_task; unsigned int nb_tasks = 0; unsigned int run_queue = 0; +unsigned int run_queue_cur = 0; /* copy of the run queue size */ +unsigned int nb_tasks_cur = 0; /* copy of the tasks count */ unsigned int niced_tasks = 0; /* number of niced tasks in the run queue */ struct eb32_node *last_timer = NULL; /* optimization: last queued timer */ @@ -181,6 +183,8 @@ void process_runnable_tasks(int *next) unsigned int max_processed; int expire; + run_queue_cur = run_queue; /* keep a copy for reporting */ + nb_tasks_cur = nb_tasks; max_processed = run_queue; if (max_processed > 200) max_processed = 200;
 active UP