Index: kern/subr_taskqueue.c =================================================================== RCS file: /home/ncvs/src/sys/kern/subr_taskqueue.c,v retrieving revision 1.21 diff -u -r1.21 subr_taskqueue.c --- kern/subr_taskqueue.c 17 Dec 2003 21:13:04 -0000 1.21 +++ kern/subr_taskqueue.c 15 Jan 2004 20:10:29 -0000 @@ -36,9 +36,16 @@ #include #include #include +#include #include +#include #include +int tq_in; +SYSCTL_INT(_kern, OID_AUTO, tq_in, CTLFLAG_RD, &tq_in, 0, ""); +int tq_out; +SYSCTL_INT(_kern, OID_AUTO, tq_out, CTLFLAG_RD, &tq_out, 0, ""); + static MALLOC_DEFINE(M_TASKQUEUE, "taskqueue", "Task Queues"); static void *taskqueue_giant_ih; static void *taskqueue_ih; @@ -157,6 +164,9 @@ return 0; } + getnanotime(&task->ta_queuetime); + tq_in++; + /* * Optimise the case when all tasks have the same priority. */ @@ -189,6 +199,7 @@ taskqueue_run(struct taskqueue *queue) { struct task *task; + struct timespec tv; int pending; mtx_lock(&queue->tq_mutex); @@ -201,8 +212,16 @@ STAILQ_REMOVE_HEAD(&queue->tq_queue, ta_link); pending = task->ta_pending; task->ta_pending = 0; + tq_out++; mtx_unlock(&queue->tq_mutex); + getnanotime(&tv); + timespecsub(&tv, &task->ta_queuetime); + if (tv.tv_sec >= 1) { + printf("taskqueue_run: warning, queue time of %d.%09ld " + "for context %p\n", tv.tv_sec, tv.tv_nsec, + task->ta_func); + } task->ta_func(task->ta_context, pending); mtx_lock(&queue->tq_mutex); Index: sys/_task.h =================================================================== RCS file: /home/ncvs/src/sys/sys/_task.h,v retrieving revision 1.1 diff -u -r1.1 _task.h --- sys/_task.h 23 Jan 2004 20:44:26 -0000 1.1 +++ sys/_task.h 25 Jan 2004 02:42:01 -0000 @@ -34,6 +34,7 @@ #endif #include +#include /* * Each task includes a function which is called from @@ -49,6 +50,7 @@ int ta_priority; /* priority of task in queue */ task_fn_t *ta_func; /* task handler */ void *ta_context; /* argument for handler */ + struct timespec ta_queuetime; /* time enqueued */ }; #endif /* !_SYS__TASK_H_ */