NCBI C++ ToolKit
|
#include "task_server_pch.hpp"
#include <corelib/ncbireg.hpp>
#include "scheduler.hpp"
#include "threads_man.hpp"
#include "timers.hpp"
#include "srv_stat.hpp"
Go to the source code of this file.
Go to the SVN repository for this file.
Classes | |
struct | SPrtyExecQueue |
struct | SPrtyExecCompare |
struct | SSchedInfo |
Typedefs | |
typedef intr::set_base_hook< intr::tag< SPrtyExecMap_tag >, intr::optimize_size< true > > | TPrtyExecMapHook |
typedef intr::set< SPrtyExecQueue, intr::base_hook< TPrtyExecMapHook >, intr::constant_time_size< false >, intr::compare< SPrtyExecCompare > > | TPrtyExecMap |
Variables | |
static Uint4 | s_MaxTasksCoef = 1 |
static Uint4 | s_MaxTaskLatency = 500 |
static int | s_IdleStopTimeout = 300 |
static Uint4 | s_TaskPriorityDefault = 1 |
SSrvThread ** | s_Threads |
Uint8 | s_CurJiffies |
CSrvTime | s_JiffyTime |
typedef intr::set<SPrtyExecQueue, intr::base_hook<TPrtyExecMapHook>, intr::constant_time_size<false>, intr::compare<SPrtyExecCompare> > TPrtyExecMap |
Definition at line 77 of file scheduler.cpp.
typedef intr::set_base_hook<intr::tag<SPrtyExecMap_tag>, intr::optimize_size<true> > TPrtyExecMapHook |
Definition at line 44 of file scheduler.cpp.
void AssignThreadSched | ( | SSrvThread * | thr | ) |
Definition at line 593 of file scheduler.cpp.
References SSchedInfo::cnt_signal, SSchedInfo::max_tasks, CFutex::SetValueNonAtomic(), and thr.
Referenced by s_AllocThread().
void ConfigureScheduler | ( | const CNcbiRegistry * | reg, |
CTempString | section | ||
) |
Definition at line 566 of file scheduler.cpp.
References IRegistry::GetInt(), s_IdleStopTimeout, s_MaxTaskLatency, and s_TaskPriorityDefault.
Referenced by s_ReadConfiguration().
Uint4 GetDefaultTaskPriority | ( | void | ) |
Definition at line 587 of file scheduler.cpp.
References s_TaskPriorityDefault.
Referenced by CNCDistributionConf::GetSyncPriority(), CNCActiveHandler::SetReservedForBG(), and CNCMessageHandler::x_CleanCmdResources().
Definition at line 466 of file scheduler.cpp.
References ACCESS_ONCE, AtomicCAS(), fTaskNeedTermination, fTaskQueued, fTaskRunning, fTaskTerminated, CSrvTask::m_TaskFlags, and s_DoTermination().
Referenced by CleanSocketList(), CSrvSocketTask::Terminate(), and CSrvTask::Terminate().
bool ReConfig_Scheduler | ( | const CTempString & | section, |
const CNcbiRegistry & | reg, | ||
string & | err_message | ||
) |
Definition at line 573 of file scheduler.cpp.
References IRegistry::GetInt(), and s_TaskPriorityDefault.
Referenced by CTaskServer::ReConfig().
void ReleaseThreadSched | ( | SSrvThread * | thr | ) |
Definition at line 602 of file scheduler.cpp.
References GetCurThread(), SSchedInfo::jfy_start_time, s_BalanceTasks(), CSrvTime::Sec(), and thr.
Referenced by s_StopCurMgrThread().
|
static |
Definition at line 131 of file scheduler.cpp.
References SSchedInfo::cnt_signal, GetCurThread(), CSrvTask::GetPriority(), CFutex::GetValue(), IsThreadRunning(), CMiniMutex::Lock(), s_GetExecQueue(), s_Threads, CFutex::SetValueNonAtomic(), SPrtyExecQueue::tasks, SSchedInfo::tasks_lock, SSchedInfo::tasks_map, thr, CMiniMutex::Unlock(), and CFutex::WakeUpWaiters().
Referenced by s_BalanceTasks(), s_MarkTaskExecuted(), and CSrvTask::SetRunnable().
|
static |
Definition at line 310 of file scheduler.cpp.
References SSchedInfo::cnt_signal, CMiniMutex::Lock(), NON_CONST_ITERATE, s_AddTaskToQueue(), s_FindQueueThread(), CFutex::SetValueNonAtomic(), SPrtyExecQueue::tasks, SSchedInfo::tasks_lock, SSchedInfo::tasks_map, SSrvThread::thread_num, and CMiniMutex::Unlock().
Referenced by ReleaseThreadSched(), s_FindRebalanceTasks(), SchedCheckOverloads(), and SchedStartJiffy().
Definition at line 459 of file scheduler.cpp.
References CSrvRCUUser::CallRCU(), CTaskServer::IsInShutdown(), and CSrvTask::m_Terminator.
Referenced by MarkTaskTerminated(), and s_MarkTaskExecuted().
|
static |
Definition at line 221 of file scheduler.cpp.
References ACCESS_ONCE, AtomicCAS(), IsThreadRunning(), max(), NULL, SSchedInfo::prefer_thr_num, RequestThreadStart(), s_IsThreadOverloaded(), s_MaxRunningThreads, s_MaxTasksCoef, s_Threads, SSrvThread::sched, and SSrvThread::thread_num.
Referenced by s_BalanceTasks(), s_MarkTaskExecuted(), and CSrvTask::SetRunnable().
|
static |
Definition at line 337 of file scheduler.cpp.
References SSchedInfo::cnt_signal, CFutex::GetValue(), i, s_BalanceTasks(), s_MaxRunningThreads, s_Threads, SSrvThread::sched, and SSrvThread::thread_num.
Referenced by SchedStartJiffy().
|
static |
Definition at line 118 of file scheduler.cpp.
References SPrtyExecQueue::priority.
Referenced by s_AddTaskToQueue().
|
inlinestatic |
Definition at line 214 of file scheduler.cpp.
References s_CurJiffies, and thr.
Referenced by s_FindQueueThread(), SchedCheckOverloads(), and SchedStartJiffy().
|
static |
Definition at line 497 of file scheduler.cpp.
References ACCESS_ONCE, AtomicCAS(), fTaskNeedTermination, fTaskQueued, fTaskRunnable, fTaskRunning, fTaskTerminated, CSrvTask::m_TaskFlags, s_AddTaskToQueue(), s_DoTermination(), s_FindQueueThread(), SRV_FATAL, and thr.
Referenced by SchedExecuteTask().
Definition at line 484 of file scheduler.cpp.
References ACCESS_ONCE, AtomicCAS(), fTaskQueued, fTaskRunning, CSrvTask::m_TaskFlags, and SRV_FATAL.
Referenced by SchedExecuteTask().
|
static |
Definition at line 363 of file scheduler.cpp.
References CMiniMutex::Lock(), NON_CONST_ITERATE, SSchedInfo::tasks_lock, SSchedInfo::tasks_map, and CMiniMutex::Unlock().
Referenced by SchedStartJiffy().
|
static |
Definition at line 374 of file scheduler.cpp.
References SSchedInfo::done_tasks, SSchedInfo::done_time, SSchedInfo::max_slice, SSchedInfo::max_tasks, s_MaxTaskLatency, and SSchedInfo::wait_time.
Referenced by SchedStartJiffy().
|
static |
Definition at line 167 of file scheduler.cpp.
References SSchedInfo::cnt_signal, SPrtyExecQueue::exec_time, CFutex::GetValue(), CMiniMutex::Lock(), NULL, SPrtyExecQueue::priority, CFutex::SetValueNonAtomic(), SPrtyExecQueue::tasks, SSchedInfo::tasks_lock, SSchedInfo::tasks_map, and CMiniMutex::Unlock().
Referenced by SchedExecuteTask().
void SchedCheckOverloads | ( | void | ) |
Definition at line 351 of file scheduler.cpp.
References GetCurThread(), i, IsThreadRunning(), s_BalanceTasks(), s_IsThreadOverloaded(), s_MaxRunningThreads, s_MaxTasksCoef, s_Threads, and thr.
Referenced by s_PerJiffyTasks_Service().
void SchedExecuteTask | ( | SSrvThread * | thr | ) |
Definition at line 521 of file scheduler.cpp.
References CSrvTime::AsUSec(), SSchedInfo::cnt_signal, CSrvTime::Current(), SSchedInfo::done_tasks, SSchedInfo::done_time, CFutex::GetValue(), CSrvTask::InternalRunSlice(), IsThreadRunning(), SSchedInfo::last_exec_time, CSrvTask::m_LastThread, SSchedInfo::max_slice, NULL, RequestThreadRevive(), s_JiffyTime, s_MarkTaskExecuted(), s_MarkTaskRunning(), s_UnqueueTask(), start_time, thr, SSchedInfo::wait_time, and CFutex::WaitValueChange().
Referenced by s_WorkerThreadMain().
bool SchedIsAllIdle | ( | void | ) |
Definition at line 437 of file scheduler.cpp.
References SSchedInfo::cnt_signal, CSrvTime::Current(), CFutex::GetValue(), i, SSchedInfo::last_exec_time, CMiniMutex::Lock(), s_JiffyTime, s_MaxRunningThreads, s_Threads, SSchedInfo::tasks_lock, thr, and CMiniMutex::Unlock().
Referenced by TrackShuttingDown().
void SchedStartJiffy | ( | SSrvThread * | thr | ) |
Definition at line 389 of file scheduler.cpp.
References CSrvTime::AsUSec(), SSchedInfo::cnt_signal, CSrvTime::Current(), SSchedInfo::done_tasks, SSchedInfo::done_time, CFutex::GetValue(), IsThreadRunning(), SSchedInfo::jfy_start_time, SSchedInfo::last_exec_time, SSchedInfo::max_slice, RequestThreadStop(), s_BalanceTasks(), s_FindRebalanceTasks(), s_IdleStopTimeout, s_IsThreadOverloaded(), s_MaxTasksCoef, s_ResetExecTime(), s_ResetMaxTasks(), s_Threads, CSrvTime::Sec(), thr, and SSchedInfo::wait_time.
Referenced by s_PerJiffyTasks_Worker().
void WriteSetup_Scheduler | ( | CSrvSocketTask & | task | ) |
Definition at line 579 of file scheduler.cpp.
References s_IdleStopTimeout, s_MaxTaskLatency, s_TaskPriorityDefault, CSrvSocketTask::WriteNumber(), and CSrvSocketTask::WriteText().
Referenced by CTaskServer::WriteSetup().
|
extern |
Definition at line 53 of file time_man.cpp.
Referenced by s_IsThreadOverloaded().
|
static |
Definition at line 107 of file scheduler.cpp.
Referenced by ConfigureScheduler(), SchedStartJiffy(), and WriteSetup_Scheduler().
|
extern |
Definition at line 54 of file time_man.cpp.
Referenced by SchedExecuteTask(), and SchedIsAllIdle().
|
static |
Definition at line 106 of file scheduler.cpp.
Referenced by ConfigureScheduler(), s_ResetMaxTasks(), and WriteSetup_Scheduler().
|
static |
Definition at line 105 of file scheduler.cpp.
Referenced by s_FindQueueThread(), SchedCheckOverloads(), and SchedStartJiffy().
|
static |
Definition at line 108 of file scheduler.cpp.
Referenced by ConfigureScheduler(), GetDefaultTaskPriority(), ReConfig_Scheduler(), and WriteSetup_Scheduler().
|
extern |
Definition at line 59 of file threads_man.cpp.
Referenced by s_AddTaskToQueue(), s_FindQueueThread(), s_FindRebalanceTasks(), SchedCheckOverloads(), SchedIsAllIdle(), and SchedStartJiffy().