[MINOR] stats: report number of tasks (active and running)

It may be useful for statistics purposes to report the number of
tasks.
This commit is contained in:
Willy Tarreau 2009-03-21 18:33:52 +01:00
parent a461318f97
commit c7bdf09f9f
3 changed files with 13 additions and 2 deletions

View File

@ -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 */

View File

@ -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)
"<b>system limits :</b> memmax = %s%s ; ulimit-n = %d<br>\n"
"<b>maxsock = </b> %d ; <b>maxconn = </b> %d ; <b>maxpipes = </b> %d<br>\n"
"current conns = %d ; current pipes = %d/%d<br>\n"
"Running tasks : %d/%d<br>\n"
"</td><td align=\"center\" nowrap>\n"
"<table class=\"lgd\"><tr>\n"
"<td class=\"active3\">&nbsp;</td><td class=\"noborder\">active UP </td>"
@ -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)

View File

@ -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;