CUBRID Engine
latest
|
#include <thread_manager.hpp>
Classes | |
class | core |
Public Types | |
using | context_type = Context |
using | task_type = task< Context > |
using | context_manager_type = context_manager< Context > |
Public Member Functions | |
worker_pool (std::size_t pool_size, std::size_t task_max_count, context_manager_type &context_mgr, const char *name, std::size_t core_count=1, bool debug_logging=false, bool pool_threads=false, wait_seconds wait_for_task_time=std::chrono::seconds(5)) | |
~worker_pool () | |
bool | try_execute (task_type *work_arg) |
void | execute (task_type *work_arg) |
void | execute_on_core (task_type *work_arg, std::size_t core_hash) |
void | stop_execution (void) |
void | start_all_workers (void) |
bool | is_running (void) const |
bool | is_full (void) const |
std::size_t | get_max_count (void) const |
std::size_t | get_core_count (void) const |
void | get_stats (cubperf::stat_value *stats_out) const |
void | er_log_stats (void) const |
bool | is_pooling_threads () const |
const wait_seconds & | get_wait_for_task_time () const |
template<typename Func , typename... Args> | |
void | map_running_contexts (Func &&func, Args &&...args) |
template<typename Func , typename... Args> | |
void | map_cores (Func &&func, Args &&...args) |
Private Types | |
using | atomic_context_ptr = std::atomic< context_type * > |
Private Member Functions | |
std::size_t | get_round_robin_core_hash (void) |
Private Attributes | |
std::size_t | m_max_workers |
std::size_t | m_task_max_count |
std::atomic< std::size_t > | m_task_count |
context_manager_type & | m_context_manager |
core * | m_core_array |
std::size_t | m_core_count |
std::atomic< std::size_t > | m_round_robin_counter |
std::atomic< bool > | m_stopped |
bool | m_log |
bool | m_pool_threads |
wait_seconds | m_wait_for_task_time |
std::string | m_name |
Friends | |
class | core |
Definition at line 59 of file thread_manager.hpp.
|
private |
Definition at line 227 of file thread_worker_pool.hpp.
using cubthread::worker_pool< Context >::context_manager_type = context_manager<Context> |
Definition at line 139 of file thread_worker_pool.hpp.
using cubthread::worker_pool< Context >::context_type = Context |
Definition at line 137 of file thread_worker_pool.hpp.
using cubthread::worker_pool< Context >::task_type = task<Context> |
Definition at line 138 of file thread_worker_pool.hpp.
cubthread::worker_pool< Context >::worker_pool | ( | std::size_t | pool_size, |
std::size_t | task_max_count, | ||
context_manager_type & | context_mgr, | ||
const char * | name, | ||
std::size_t | core_count = 1 , |
||
bool | debug_logging = false , |
||
bool | pool_threads = false , |
||
wait_seconds | wait_for_task_time = std::chrono::seconds (5) |
||
) |
Definition at line 536 of file thread_worker_pool.hpp.
References assert, cubthread::worker_pool< Context >::core::init_pool_and_workers(), cubthread::worker_pool< Context >::m_core_array, cubthread::worker_pool< Context >::m_core_count, cubthread::worker_pool< Context >::m_max_workers, cubthread::worker_pool< Context >::m_pool_threads, cubthread::worker_pool< Context >::m_wait_for_task_time, cubthread::wait_duration< D >::set_infinite_wait(), and cubthread::wp_is_thread_always_alive_forced().
cubthread::worker_pool< Context >::~worker_pool | ( | ) |
Definition at line 590 of file thread_worker_pool.hpp.
References assert, cubthread::worker_pool< Context >::m_core_array, cubthread::worker_pool< Context >::m_stopped, and NULL.
void cubthread::worker_pool< Context >::er_log_stats | ( | void | ) | const |
Definition at line 741 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::get_stats(), cubthread::worker_pool< Context >::m_log, cubthread::worker_pool< Context >::m_name, and cubthread::wp_er_log_stats().
Referenced by css_init(), and vacuum_stop_workers().
void cubthread::worker_pool< Context >::execute | ( | task_type * | work_arg | ) |
Definition at line 614 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::execute_on_core(), and cubthread::worker_pool< Context >::get_round_robin_core_hash().
Referenced by cubthread::manager::push_task(), and cubthread::worker_pool< Context >::try_execute().
void cubthread::worker_pool< Context >::execute_on_core | ( | task_type * | work_arg, |
std::size_t | core_hash | ||
) |
Definition at line 621 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::core::execute_task(), cubthread::worker_pool< Context >::m_core_array, cubthread::worker_pool< Context >::m_core_count, and cubthread::worker_pool< Context >::m_task_count.
Referenced by cubthread::worker_pool< Context >::execute(), and cubthread::manager::push_task_on_core().
std::size_t cubthread::worker_pool< Context >::get_core_count | ( | void | ) | const |
Definition at line 724 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::m_core_count.
std::size_t cubthread::worker_pool< Context >::get_max_count | ( | void | ) | const |
Definition at line 717 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::m_max_workers.
Referenced by css_are_all_request_handlers_suspended(), css_get_num_connection_workers(), css_get_num_request_workers(), cubthread::manager::destroy_worker_pool(), and cubthread::worker_pool_task_capper< Context >::worker_pool_task_capper().
|
private |
Definition at line 793 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::m_max_workers, and cubthread::worker_pool< Context >::m_round_robin_counter.
Referenced by cubthread::worker_pool< Context >::execute().
void cubthread::worker_pool< Context >::get_stats | ( | cubperf::stat_value * | stats_out | ) | const |
Definition at line 731 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::core::get_stats(), cubthread::worker_pool< Context >::m_core_array, and cubthread::worker_pool< Context >::m_core_count.
Referenced by css_get_thread_stats(), cubthread::worker_pool< Context >::er_log_stats(), and cubload::worker_manager_get_stats().
|
inline |
Definition at line 191 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::m_wait_for_task_time, cubthread::worker_pool< Context >::map_cores(), and cubthread::worker_pool< Context >::map_running_contexts().
|
inline |
Definition at line 710 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::m_task_count, and cubthread::worker_pool< Context >::m_task_max_count.
Referenced by cubthread::manager::is_pool_full(), and cubthread::worker_pool< Context >::try_execute().
|
inline |
Definition at line 187 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::m_pool_threads.
bool cubthread::worker_pool< Context >::is_running | ( | void | ) | const |
Definition at line 703 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::m_stopped.
void cubthread::worker_pool< Context >::map_cores | ( | Func && | func, |
Args &&... | args | ||
) |
Definition at line 775 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::m_core_array, and cubthread::worker_pool< Context >::m_core_count.
Referenced by cubthread::worker_pool< Context >::get_wait_for_task_time().
void cubthread::worker_pool< Context >::map_running_contexts | ( | Func && | func, |
Args &&... | args | ||
) |
Definition at line 758 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::m_core_array, cubthread::worker_pool< Context >::m_core_count, and cubthread::worker_pool< Context >::core::map_running_contexts().
Referenced by css_are_all_request_handlers_suspended(), css_count_transaction_worker_threads(), css_stop_all_workers(), and cubthread::worker_pool< Context >::get_wait_for_task_time().
void cubthread::worker_pool< Context >::start_all_workers | ( | void | ) |
Definition at line 693 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::m_core_array, cubthread::worker_pool< Context >::m_core_count, and cubthread::worker_pool< Context >::core::start_all_workers().
Referenced by css_start_all_threads().
void cubthread::worker_pool< Context >::stop_execution | ( | void | ) |
Definition at line 632 of file thread_worker_pool.hpp.
References assert, cubthread::worker_pool< Context >::m_core_array, cubthread::worker_pool< Context >::m_core_count, cubthread::worker_pool< Context >::m_stopped, cubthread::worker_pool< Context >::core::notify_stop(), and cubthread::worker_pool< Context >::core::retire_queued_tasks().
Referenced by vacuum_stop_workers().
bool cubthread::worker_pool< Context >::try_execute | ( | task_type * | work_arg | ) |
Definition at line 601 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::execute(), and cubthread::worker_pool< Context >::is_full().
Referenced by cubthread::manager::try_task().
|
friend |
Definition at line 230 of file thread_worker_pool.hpp.
|
private |
Definition at line 243 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::core::get_context_manager().
|
private |
Definition at line 246 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::execute_on_core(), cubthread::worker_pool< Context >::get_stats(), cubthread::worker_pool< Context >::map_cores(), cubthread::worker_pool< Context >::map_running_contexts(), cubthread::worker_pool< Context >::start_all_workers(), cubthread::worker_pool< Context >::stop_execution(), cubthread::worker_pool< Context >::worker_pool(), and cubthread::worker_pool< Context >::~worker_pool().
|
private |
Definition at line 247 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::execute_on_core(), cubthread::worker_pool< Context >::get_core_count(), cubthread::worker_pool< Context >::get_stats(), cubthread::worker_pool< Context >::map_cores(), cubthread::worker_pool< Context >::map_running_contexts(), cubthread::worker_pool< Context >::start_all_workers(), cubthread::worker_pool< Context >::stop_execution(), and cubthread::worker_pool< Context >::worker_pool().
|
private |
Definition at line 254 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::er_log_stats().
|
private |
Definition at line 236 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::get_max_count(), cubthread::worker_pool< Context >::get_round_robin_core_hash(), and cubthread::worker_pool< Context >::worker_pool().
|
private |
Definition at line 262 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::er_log_stats().
|
private |
Definition at line 257 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::core::init_pool_and_workers(), cubthread::worker_pool< Context >::is_pooling_threads(), and cubthread::worker_pool< Context >::worker_pool().
|
private |
Definition at line 248 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::get_round_robin_core_hash().
|
private |
|
private |
Definition at line 240 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::execute_on_core(), cubthread::worker_pool< Context >::core::finished_task_notification(), and cubthread::worker_pool< Context >::is_full().
|
private |
Definition at line 239 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::is_full().
|
private |
Definition at line 260 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::get_wait_for_task_time(), and cubthread::worker_pool< Context >::worker_pool().