A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/thread__pool__ctrl_8cpp_source.html below:

NCBI C++ ToolKit: src/util/thread_pool_ctrl.cpp Source File

42  unsigned int

max_threads,

43  unsigned int

min_threads

71  if

(threads_count == 0) {

76  if

(threads_count == 0) {

77  if

(queued_tasks == 0) {

86  double

now_err = (double(queued_tasks + run_tasks) - threads_count)

99  double

period = now_time -

m_ErrHistory

.back().call_time;

133  double

final_val = (now_err + integr_err + deriv_err) /

m_Threshold

;

141  if

(final_val >= 1 || final_val <= -2) {

142  if

(final_val < 0 && -final_val > threads_count)

155  double

last_err = 0, integr_err = 0;

179  double

sleep_time = 0;

181

sleep_time = (

m_Threshold

- last_err - integr_err)

185

sleep_time = (-

m_Threshold

- last_err - integr_err)

Abstract class for controlling the number of threads in pool.

Main class implementing functionality of pool of threads.

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

EEvent

Events that can happen with ThreadPool.

void EnsureLimits(void)

Ensure that constraints of minimum and maximum count of threads in pool are met.

unsigned int GetMinThreads(void) const

Get the minimum number of threads in pool.

deque< SThreadPool_PID_ErrInfo > m_ErrHistory

History of changing of "error" value "error" - number of tasks per thread waiting in queue.

CThreadPool * GetPool(void) const

Get pool to which this class is attached.

virtual CTimeSpan GetSafeSleepTime(void) const

Get maximum timeout for which calls to method HandleEvent() can be missing.

CStopWatch m_Timer

Timer for measuring time periods.

unsigned int GetThreadsCount(void) const

Get total number of threads currently running in pool.

CMutex & GetMainPoolMutex(CThreadPool *pool) const

Get mutex which guards access to pool All work in controller should be based on the same mutex as in ...

unsigned int GetMaxThreads(void) const

Get the maximum number of threads in pool.

virtual void OnEvent(EEvent event)

Main method for implementation of controlling algorithm.

double m_IntegrCoeff

Integral coefficient.

double m_DerivTime

Period of taking average "error" change speed.

double m_IntegrErr

Value of "error" integrated over all working time.

double m_DerivCoeff

Derivative coefficient.

CThreadPool_Controller_PID(unsigned int max_threads, unsigned int min_threads)

Constructor.

virtual CTimeSpan GetSafeSleepTime(void) const

Get maximum timeout for which calls to method HandleEvent() can be missing.

double m_Threshold

Threshold value.

void SetThreadsCount(unsigned int count)

Set number of threads in pool Adjust given number to conform to minimum and maximum threads count con...

unsigned int GetExecutingTasksCount(void) const

Get the number of currently executing tasks.

unsigned int GetQueuedTasksCount(void) const

Get the number of tasks currently waiting in queue.

@ eResume

ThreadPool is resumed after exclusive task execution.

@ eSuspend

ThreadPool is suspended for exclusive task execution.

double Elapsed(void) const

Return time elapsed since first Start() or last Restart() call (in seconds).

Entry in "error" changing history Information about "error" in some point of time in the past kept in...

Implementations of controllers for ThreadPool.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4