From 40d30840f5fa381a48eb531bb57b991a303fa433 Mon Sep 17 00:00:00 2001 From: wrowe Date: Wed, 7 May 2008 19:45:48 +0000 Subject: * The idle thread timeout statistic was being incremented each time an idle thread (whether a timeout was set or not) was reaped. Updated the check to only increment when a timeout was set. * The test to determine if a thread should go into probation was >= when it should have been just > since the idle_cnt has been incremented by the time this test is made. PR: 43876 Submitted by: Joe Mudd Reviewed by: Henry Jen git-svn-id: http://svn.apache.org/repos/asf/apr/apr-util/trunk@654234 13f79535-47bb-0310-9956-ffa450edef68 --- include/apr_thread_pool.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'include') diff --git a/include/apr_thread_pool.h b/include/apr_thread_pool.h index 1a9195b5..cbf382b3 100644 --- a/include/apr_thread_pool.h +++ b/include/apr_thread_pool.h @@ -186,6 +186,38 @@ APU_DECLARE(apr_size_t) apr_thread_pool_idle_count(apr_thread_pool_t *me); APU_DECLARE(apr_size_t) apr_thread_pool_idle_max_set(apr_thread_pool_t *me, apr_size_t cnt); +/** + * Get number of tasks that have run + * @param me The thread pool + * @return Number of tasks that have run + */ +APU_DECLARE(apr_size_t) + apr_thread_pool_tasks_run_count(apr_thread_pool_t * me); + +/** + * Get high water mark of the number of tasks waiting to run + * @param me The thread pool + * @return High water mark of tasks waiting to run + */ +APU_DECLARE(apr_size_t) + apr_thread_pool_tasks_high_count(apr_thread_pool_t * me); + +/** + * Get high water mark of the number of threads + * @param me The thread pool + * @return High water mark of threads in thread pool + */ +APU_DECLARE(apr_size_t) + apr_thread_pool_threads_high_count(apr_thread_pool_t * me); + +/** + * Get the number of idle threads that were destroyed after timing out + * @param me The thread pool + * @return Number of idle threads that timed out + */ +APU_DECLARE(apr_size_t) + apr_thread_pool_threads_idle_timeout_count(apr_thread_pool_t * me); + /** * Access function for the maximum number of idle threads * @param me The thread pool @@ -202,6 +234,29 @@ APU_DECLARE(apr_size_t) apr_thread_pool_idle_max_get(apr_thread_pool_t *me); APU_DECLARE(apr_size_t) apr_thread_pool_thread_max_set(apr_thread_pool_t *me, apr_size_t cnt); +/** + * Access function for the maximum wait time (in microseconds) of an + * idling thread that exceeds the maximum number of idling threads. + * A non-zero value allows for the reaping of idling threads to shrink + * over time. Which helps reduce thrashing. + * @param me The thread pool + * @param timeout The number of microseconds an idle thread should wait + * till it reaps itself + * @return The original maximum wait time + */ +APU_DECLARE(apr_interval_time_t) + apr_thread_pool_idle_wait_set(apr_thread_pool_t * me, + apr_interval_time_t timeout); + +/** + * Access function for the maximum wait time (in microseconds) of an + * idling thread that exceeds the maximum number of idling threads + * @param me The thread pool + * @return The current maximum wait time + */ +APU_DECLARE(apr_interval_time_t) + apr_thread_pool_idle_wait_get(apr_thread_pool_t * me); + /** * Access function for the maximum number of threads * @param me The thread pool -- cgit v1.2.1