From 36c0a0fd2e30feef52346ca02d7bccd98b1d9ffc Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 27 Jan 2009 03:48:05 +0000 Subject: [PATCH] better scheduling parameters --- panda/src/pipeline/threadSimpleManager.cxx | 11 ++++++++--- panda/src/pipeline/threadSimpleManager.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/panda/src/pipeline/threadSimpleManager.cxx b/panda/src/pipeline/threadSimpleManager.cxx index 304f6a3a53..4406fc1218 100644 --- a/panda/src/pipeline/threadSimpleManager.cxx +++ b/panda/src/pipeline/threadSimpleManager.cxx @@ -36,17 +36,22 @@ ThreadSimpleManager *ThreadSimpleManager::_global_ptr; ThreadSimpleManager:: ThreadSimpleManager() : _simple_thread_epoch_timeslice - ("simple-thread-epoch-timeslice", 0.01, + ("simple-thread-epoch-timeslice", 0.05, PRC_DESC("When SIMPLE_THREADS is defined, this defines the amount of time, " "in seconds, that should be considered the " "typical timeslice for one epoch (to run all threads once).")), + _simple_thread_volunteer_delay + ("simple-thread-volunteer-delay", 0.0001, + PRC_DESC("When SIMPLE_THREADS is defined, this defines the amount of time, " + "in seconds, for which a task that voluntarily yields should " + "be delayed.")), _simple_thread_window ("simple-thread-window", 1.0, PRC_DESC("When SIMPLE_THREADS is defined, this defines the amount of time, " "in seconds, over which to average all the threads' runtimes, " "for the purpose of scheduling threads.")), _simple_thread_low_weight - ("simple-thread-low-weight", 0.1, + ("simple-thread-low-weight", 0.2, PRC_DESC("When SIMPLE_THREADS is defined, this determines the relative " "amount of time that is given to threads with priority TP_low.")), _simple_thread_normal_weight @@ -106,7 +111,7 @@ enqueue_ready(ThreadSimpleImpl *thread, bool volunteer) { // sleep for the duration of the timeslice, so it won't interfere // with timeslice accounting for the remaining ready threads. double now = get_current_time(); - thread->_wake_time = now + _simple_thread_epoch_timeslice; + thread->_wake_time = now + _simple_thread_volunteer_delay; _volunteers.push_back(thread); push_heap(_volunteers.begin(), _volunteers.end(), CompareStartTime()); } diff --git a/panda/src/pipeline/threadSimpleManager.h b/panda/src/pipeline/threadSimpleManager.h index 873bb4ad08..2159608775 100644 --- a/panda/src/pipeline/threadSimpleManager.h +++ b/panda/src/pipeline/threadSimpleManager.h @@ -106,6 +106,7 @@ private: public: // Defined within the class to avoid static-init ordering problems. ConfigVariableDouble _simple_thread_epoch_timeslice; + ConfigVariableDouble _simple_thread_volunteer_delay; ConfigVariableDouble _simple_thread_window; ConfigVariableDouble _simple_thread_low_weight; ConfigVariableDouble _simple_thread_normal_weight;