NCBI C++ ToolKit
Classes | Typedefs | Functions | Variables
scheduler.cpp File Reference
#include "task_server_pch.hpp"
#include <corelib/ncbireg.hpp>
#include "scheduler.hpp"
#include "threads_man.hpp"
#include "timers.hpp"
#include "srv_stat.hpp"
+ Include dependency graph for scheduler.cpp:

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
 

Functions

static SPrtyExecQueues_GetExecQueue (TPrtyExecMap &prty_map, Uint4 priority)
 
static void s_AddTaskToQueue (SSrvThread *thr, CSrvTask *task, bool boost=false)
 
static CSrvTasks_UnqueueTask (SSchedInfo *sched)
 
static bool s_IsThreadOverloaded (SSrvThread *thr, Uint4 max_coef)
 
static SSrvThreads_FindQueueThread (TSrvThreadNum prefer_num, SSrvThread *cur_thr)
 
static void s_BalanceTasks (SSchedInfo *sched, SSrvThread *cur_thr)
 
static void s_FindRebalanceTasks (SSrvThread *cur_thr)
 
void SchedCheckOverloads (void)
 
static void s_ResetExecTime (SSchedInfo *sched)
 
static void s_ResetMaxTasks (SSchedInfo *sched)
 
void SchedStartJiffy (SSrvThread *thr)
 
bool SchedIsAllIdle (void)
 
static void s_DoTermination (CSrvTask *task)
 
void MarkTaskTerminated (CSrvTask *task, bool immediate)
 
static void s_MarkTaskRunning (CSrvTask *task)
 
static void s_MarkTaskExecuted (CSrvTask *task, SSrvThread *thr)
 
void SchedExecuteTask (SSrvThread *thr)
 
void ConfigureScheduler (const CNcbiRegistry *reg, CTempString section)
 
bool ReConfig_Scheduler (const CTempString &section, const CNcbiRegistry &reg, string &)
 
void WriteSetup_Scheduler (CSrvSocketTask &task)
 
Uint4 GetDefaultTaskPriority (void)
 
void AssignThreadSched (SSrvThread *thr)
 
void ReleaseThreadSched (SSrvThread *thr)
 

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 Documentation

◆ TPrtyExecMap

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.

◆ TPrtyExecMapHook

typedef intr::set_base_hook<intr::tag<SPrtyExecMap_tag>, intr::optimize_size<true> > TPrtyExecMapHook

Definition at line 44 of file scheduler.cpp.

Function Documentation

◆ AssignThreadSched()

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().

◆ ConfigureScheduler()

void ConfigureScheduler ( const CNcbiRegistry reg,
CTempString  section 
)

◆ GetDefaultTaskPriority()

Uint4 GetDefaultTaskPriority ( void  )

◆ MarkTaskTerminated()

void MarkTaskTerminated ( CSrvTask task,
bool  immediate 
)

◆ ReConfig_Scheduler()

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().

◆ ReleaseThreadSched()

void ReleaseThreadSched ( SSrvThread thr)

◆ s_AddTaskToQueue()

static void s_AddTaskToQueue ( SSrvThread thr,
CSrvTask task,
bool  boost = false 
)
static

◆ s_BalanceTasks()

static void s_BalanceTasks ( SSchedInfo sched,
SSrvThread cur_thr 
)
static

◆ s_DoTermination()

static void s_DoTermination ( CSrvTask task)
inlinestatic

◆ s_FindQueueThread()

static SSrvThread* s_FindQueueThread ( TSrvThreadNum  prefer_num,
SSrvThread cur_thr 
)
static

◆ s_FindRebalanceTasks()

static void s_FindRebalanceTasks ( SSrvThread cur_thr)
static

◆ s_GetExecQueue()

static SPrtyExecQueue* s_GetExecQueue ( TPrtyExecMap prty_map,
Uint4  priority 
)
static

Definition at line 118 of file scheduler.cpp.

References SPrtyExecQueue::priority.

Referenced by s_AddTaskToQueue().

◆ s_IsThreadOverloaded()

static bool s_IsThreadOverloaded ( SSrvThread thr,
Uint4  max_coef 
)
inlinestatic

Definition at line 214 of file scheduler.cpp.

References s_CurJiffies, and thr.

Referenced by s_FindQueueThread(), SchedCheckOverloads(), and SchedStartJiffy().

◆ s_MarkTaskExecuted()

static void s_MarkTaskExecuted ( CSrvTask task,
SSrvThread thr 
)
static

◆ s_MarkTaskRunning()

static void s_MarkTaskRunning ( CSrvTask task)
inlinestatic

Definition at line 484 of file scheduler.cpp.

References ACCESS_ONCE, AtomicCAS(), fTaskQueued, fTaskRunning, CSrvTask::m_TaskFlags, and SRV_FATAL.

Referenced by SchedExecuteTask().

◆ s_ResetExecTime()

static void s_ResetExecTime ( SSchedInfo sched)
static

◆ s_ResetMaxTasks()

static void s_ResetMaxTasks ( SSchedInfo sched)
static

◆ s_UnqueueTask()

static CSrvTask* s_UnqueueTask ( SSchedInfo sched)
static

◆ SchedCheckOverloads()

void SchedCheckOverloads ( void  )

◆ SchedExecuteTask()

void SchedExecuteTask ( SSrvThread thr)

◆ SchedIsAllIdle()

bool SchedIsAllIdle ( void  )

◆ SchedStartJiffy()

void SchedStartJiffy ( SSrvThread thr)

◆ WriteSetup_Scheduler()

void WriteSetup_Scheduler ( CSrvSocketTask task)

Variable Documentation

◆ s_CurJiffies

Uint8 s_CurJiffies
extern

Definition at line 53 of file time_man.cpp.

Referenced by s_IsThreadOverloaded().

◆ s_IdleStopTimeout

int s_IdleStopTimeout = 300
static

Definition at line 107 of file scheduler.cpp.

Referenced by ConfigureScheduler(), SchedStartJiffy(), and WriteSetup_Scheduler().

◆ s_JiffyTime

CSrvTime s_JiffyTime
extern

Definition at line 54 of file time_man.cpp.

Referenced by SchedExecuteTask(), and SchedIsAllIdle().

◆ s_MaxTaskLatency

Uint4 s_MaxTaskLatency = 500
static

Definition at line 106 of file scheduler.cpp.

Referenced by ConfigureScheduler(), s_ResetMaxTasks(), and WriteSetup_Scheduler().

◆ s_MaxTasksCoef

Uint4 s_MaxTasksCoef = 1
static

Definition at line 105 of file scheduler.cpp.

Referenced by s_FindQueueThread(), SchedCheckOverloads(), and SchedStartJiffy().

◆ s_TaskPriorityDefault

Uint4 s_TaskPriorityDefault = 1
static

◆ s_Threads

SSrvThread** s_Threads
extern
Modified on Sun Mar 03 03:16:16 2024 by modify_doxy.py rev. 669887