CUBRID Engine  latest
cubthread Namespace Reference

Namespaces

 internal_tasks_worker_pool
 

Classes

class  callable_task
 
class  callable_task< void >
 
class  context_manager
 
class  daemon
 
class  daemon_entry_manager
 
class  entry
 
class  entry_manager
 
class  lockfree_hashmap
 
class  looper
 
class  manager
 
class  task
 
class  task< void >
 
struct  wait_duration
 
class  waiter
 
class  worker_pool
 
class  worker_pool_task_capper
 

Typedefs

using entry_task = task< entry >
 
using entry_callable_task = callable_task< entry >
 
typedef std::chrono::system_clock::duration delta_time
 
typedef std::function< void(bool &, delta_time &)> period_function
 
using entry_workpool = worker_pool< entry >
 
using task_without_context = task< void >
 
using wait_seconds = wait_duration< std::chrono::seconds >
 

Functions

lockfree::tran::systemget_thread_entry_lftransys ()
 
void initialize (entry *&my_entry)
 
void finalize (void)
 
int initialize_thread_entries (bool with_lock_free)
 
entryget_main_entry (void)
 
managerget_manager (void)
 
void set_manager (manager *manager)
 
std::size_t get_max_thread_count (void)
 
entryget_entry (void)
 
void set_thread_local_entry (entry &tl_entry)
 
void clear_thread_local_entry (void)
 
bool is_single_thread (void)
 
void check_not_single_thread (void)
 
void return_lock_free_transaction_entries (void)
 
bool is_logging_configured (const int logging_flag)
 
template<typename D >
void condvar_wait (std::condition_variable &condvar, std::unique_lock< std::mutex > &lock, const wait_duration< D > &duration)
 
template<typename D , typename P >
bool condvar_wait (std::condition_variable &condvar, std::unique_lock< std::mutex > &lock, const wait_duration< D > &duration, P pred)
 
bool wp_is_thread_always_alive_forced ()
 
void wp_set_force_thread_always_alive ()
 
cubperf::statsetwp_worker_statset_create (void)
 
void wp_worker_statset_destroy (cubperf::statset &stats)
 
void wp_worker_statset_time_and_increment (cubperf::statset &stats, cubperf::stat_id id)
 
void wp_worker_statset_accumulate (const cubperf::statset &what, cubperf::stat_value *where)
 
std::size_t wp_worker_statset_get_count (void)
 
const char * wp_worker_statset_get_name (std::size_t stat_index)
 
std::size_t system_core_count (void)
 
void wp_handle_system_error (const char *message, const std::system_error &e)
 
void wp_er_log_stats (const char *header, cubperf::stat_value *statsp)
 
template<typename Func >
void wp_call_func_throwing_system_error (const char *message, Func &func)
 

Variables

constexpr size_t WORKER_COUNT = 2
 
constexpr size_t TASK_COUNT = 10
 
constexpr size_t CORE_COUNT = 1
 
constexpr bool ENABLE_LOGGING = true
 
entry_workpoolinstance = NULL
 
static const cubperf::stat_id STAT_LOOP_EXECUTE_COUNT_AND_TIME = 0
 
static const cubperf::stat_id STAT_LOOP_PAUSE_TIME = 1
 
static const cubperf::statset_definition Daemon_statistics
 
static const bool ENABLE_TRACKERS
 
const char * ALLOC_TRACK_NAME = "Virtual Memory"
 
const char * ALLOC_TRACK_RES_NAME = "res_ptr"
 
const std::size_t ALLOC_TRACK_MAX_ITEMS = 32767
 
const char * PGBUF_TRACK_NAME = "Page Buffer"
 
const char * PGBUF_TRACK_RES_NAME = "pgptr"
 
const std::size_t PGBUF_TRACK_MAX_ITEMS = 1024
 
const unsigned PGBUF_TRACK_MAX_AMOUNT = 16
 
static const cubperf::stat_id STAT_LOOPER_SLEEP_COUNT_AND_TIME = 0
 
static cubperf::stat_id STAT_LOOPER_RESET_COUNT = 1
 
static const cubperf::statset_definition Looper_statistics
 
const std::size_t MAX_LOOPER_PERIODS = 3
 
thread_local entrytl_Entry_p = NULL
 
const bool Is_single_thread = true
 
static managerManager = NULL
 
static entryMain_entry_p = NULL
 
const int LOG_MANAGER = 0x1
 
const int LOG_MANAGER_ALL = 0xFF
 
const int LOG_WORKER_POOL_VACUUM = 0x100
 
const int LOG_WORKER_POOL_CONNECTIONS = 0x200
 
const int LOG_WORKER_POOL_TRAN_WORKERS = 0x400
 
const int LOG_WORKER_POOL_INDEX_BUILDER = 0x800
 
const int LOG_WORKER_POOL_ALL = 0xFF00
 
const int LOG_DAEMON_VACUUM = 0x10000
 
const int LOG_DAEMON_ALL = 0xFFFF0000
 
static const cubperf::stat_id STAT_LOCK_WAKEUP_COUNT = 0
 
static const cubperf::stat_id STAT_SLEEP_COUNT = 1
 
static const cubperf::stat_id STAT_TIMEOUT_COUNT = 2
 
static const cubperf::stat_id STAT_NO_SLEEP_COUNT = 3
 
static const cubperf::stat_id STAT_AWAKEN_COUNT_AND_TIME = 4
 
static const cubperf::statset_definition Waiter_statistics
 
static const char * STAT_WAKEUP_CALL_COUNT_NAME = "waiter_wakeup_count"
 
static bool FORCE_THREAD_ALWAYS_ALIVE = false
 
static const cubperf::statset_definition Worker_pool_statdef
 
static const cubperf::stat_id Wpstat_start_thread = 0
 
static const cubperf::stat_id Wpstat_create_context = 1
 
static const cubperf::stat_id Wpstat_execute_task = 2
 
static const cubperf::stat_id Wpstat_retire_task = 3
 
static const cubperf::stat_id Wpstat_found_in_queue = 4
 
static const cubperf::stat_id Wpstat_wakeup_with_task = 5
 
static const cubperf::stat_id Wpstat_recycle_context = 6
 
static const cubperf::stat_id Wpstat_retire_context = 7
 

Typedef Documentation

typedef std::chrono::system_clock::duration cubthread::delta_time

Definition at line 40 of file thread_looper.hpp.

Definition at line 58 of file thread_entry_task.hpp.

using cubthread::entry_task = typedef task<entry>

Definition at line 57 of file thread_entry_task.hpp.

Definition at line 65 of file thread_manager.hpp.

typedef std::function<void (bool &, delta_time &)> cubthread::period_function

Definition at line 41 of file thread_looper.hpp.

using cubthread::task_without_context = typedef task<void>

Definition at line 131 of file thread_task.hpp.

using cubthread::wait_seconds = typedef wait_duration<std::chrono::seconds>

Definition at line 133 of file thread_waiter.hpp.

Function Documentation

void cubthread::check_not_single_thread ( void  )
void cubthread::clear_thread_local_entry ( void  )

Definition at line 617 of file thread_manager.cpp.

References assert, and NULL.

Referenced by test_mvcc_get_oldest(), test_mvcc_get_snapshot(), and test_new_mvcc_complete().

Here is the caller graph for this function:

template<typename D >
void cubthread::condvar_wait ( std::condition_variable &  condvar,
std::unique_lock< std::mutex > &  lock,
const wait_duration< D > &  duration 
)

Definition at line 148 of file thread_waiter.hpp.

References cubthread::wait_duration< D >::m_duration, and cubthread::wait_duration< D >::m_infinite.

Referenced by cubthread::worker_pool< Context >::core::worker::get_new_task().

Here is the caller graph for this function:

template<typename D , typename P >
bool cubthread::condvar_wait ( std::condition_variable &  condvar,
std::unique_lock< std::mutex > &  lock,
const wait_duration< D > &  duration,
pred 
)
void cubthread::finalize ( void  )
entry * cubthread::get_main_entry ( void  )

Definition at line 569 of file thread_manager.cpp.

References assert, Main_entry_p, and NULL.

std::size_t cubthread::get_max_thread_count ( void  )

Definition at line 592 of file thread_manager.cpp.

References cubthread::manager::get_max_thread_count(), and NULL.

Referenced by thread_num_total_threads().

Here is the caller graph for this function:

lockfree::tran::system & cubthread::get_thread_entry_lftransys ( )

Definition at line 26 of file thread_lockfree_hash_map.cpp.

References cubthread::manager::get_lockfree_transys(), and get_manager().

Referenced by cubthread::lockfree_hashmap< Key, T >::init().

Here is the caller graph for this function:

bool cubthread::is_logging_configured ( const int  logging_flag)

Definition at line 650 of file thread_manager.cpp.

References flag< T >::is_flag_set(), prm_get_integer_value(), and PRM_ID_THREAD_LOGGING_FLAG.

Referenced by btree_is_worker_pool_logging_true(), css_init(), and vacuum_boot().

Here is the caller graph for this function:

bool cubthread::is_single_thread ( void  )
void cubthread::return_lock_free_transaction_entries ( void  )
void cubthread::set_manager ( manager manager)

Definition at line 584 of file thread_manager.cpp.

References assert, cubthread::manager::manager(), and NULL.

void cubthread::set_thread_local_entry ( entry tl_entry)

Definition at line 610 of file thread_manager.cpp.

References assert, and NULL.

Referenced by test_mvcc_get_oldest(), test_mvcc_get_snapshot(), and test_new_mvcc_complete().

Here is the caller graph for this function:

std::size_t cubthread::system_core_count ( void  )

Definition at line 113 of file thread_worker_pool.cpp.

References cubregex::count().

Referenced by css_init().

Here is the caller graph for this function:

template<typename Func >
void cubthread::wp_call_func_throwing_system_error ( const char *  message,
Func &  func 
)

Definition at line 1457 of file thread_worker_pool.hpp.

References wp_handle_system_error().

Referenced by cubthread::worker_pool< Context >::core::worker::start_thread().

Here is the caller graph for this function:

void cubthread::wp_er_log_stats ( const char *  header,
cubperf::stat_value statsp 
)
void cubthread::wp_handle_system_error ( const char *  message,
const std::system_error &  e 
)

Definition at line 126 of file thread_worker_pool.cpp.

References ARG_FILE_LINE, assert, and er_print_callstack().

Referenced by wp_call_func_throwing_system_error().

Here is the caller graph for this function:

bool cubthread::wp_is_thread_always_alive_forced ( )

Definition at line 37 of file thread_worker_pool.cpp.

References FORCE_THREAD_ALWAYS_ALIVE.

Referenced by cubthread::worker_pool< Context >::worker_pool().

Here is the caller graph for this function:

void cubthread::wp_set_force_thread_always_alive ( )

Definition at line 43 of file thread_worker_pool.cpp.

Referenced by initialize().

Here is the caller graph for this function:

void cubthread::wp_worker_statset_accumulate ( const cubperf::statset what,
cubperf::stat_value where 
)

Definition at line 91 of file thread_worker_pool.cpp.

References cubperf::statset_definition::add_stat_values_with_converted_timers().

Referenced by cubthread::worker_pool< Context >::core::worker::get_stats().

Here is the caller graph for this function:

cubperf::statset & cubthread::wp_worker_statset_create ( void  )
void cubthread::wp_worker_statset_destroy ( cubperf::statset stats)

Definition at line 79 of file thread_worker_pool.cpp.

Referenced by cubthread::worker_pool< Context >::core::worker::~worker().

Here is the caller graph for this function:

std::size_t cubthread::wp_worker_statset_get_count ( void  )
const char * cubthread::wp_worker_statset_get_name ( std::size_t  stat_index)

Variable Documentation

const std::size_t cubthread::ALLOC_TRACK_MAX_ITEMS = 32767

Definition at line 65 of file thread_entry.cpp.

const char* cubthread::ALLOC_TRACK_NAME = "Virtual Memory"

Definition at line 63 of file thread_entry.cpp.

const char* cubthread::ALLOC_TRACK_RES_NAME = "res_ptr"

Definition at line 64 of file thread_entry.cpp.

constexpr size_t cubthread::CORE_COUNT = 1

Definition at line 30 of file internal_tasks_worker_pool.cpp.

const cubperf::statset_definition cubthread::Daemon_statistics
static
Initial value:

Definition at line 39 of file thread_daemon.cpp.

constexpr bool cubthread::ENABLE_LOGGING = true

Definition at line 31 of file internal_tasks_worker_pool.cpp.

const bool cubthread::ENABLE_TRACKERS
static
Initial value:
=
false

Definition at line 54 of file thread_entry.cpp.

bool cubthread::FORCE_THREAD_ALWAYS_ALIVE = false
static

Definition at line 34 of file thread_worker_pool.cpp.

Referenced by wp_is_thread_always_alive_forced().

const bool cubthread::Is_single_thread = true

Definition at line 465 of file thread_manager.cpp.

Referenced by cubthread::manager::find_by_tid(), and is_single_thread().

const int cubthread::LOG_DAEMON_ALL = 0xFFFF0000

Definition at line 305 of file thread_manager.hpp.

const int cubthread::LOG_DAEMON_VACUUM = 0x10000

Definition at line 304 of file thread_manager.hpp.

const int cubthread::LOG_MANAGER = 0x1

Definition at line 293 of file thread_manager.hpp.

const int cubthread::LOG_MANAGER_ALL = 0xFF

Definition at line 294 of file thread_manager.hpp.

const int cubthread::LOG_WORKER_POOL_ALL = 0xFF00

Definition at line 301 of file thread_manager.hpp.

const int cubthread::LOG_WORKER_POOL_CONNECTIONS = 0x200

Definition at line 298 of file thread_manager.hpp.

Referenced by css_init().

const int cubthread::LOG_WORKER_POOL_INDEX_BUILDER = 0x800

Definition at line 300 of file thread_manager.hpp.

Referenced by btree_is_worker_pool_logging_true().

const int cubthread::LOG_WORKER_POOL_TRAN_WORKERS = 0x400

Definition at line 299 of file thread_manager.hpp.

Referenced by css_init().

const int cubthread::LOG_WORKER_POOL_VACUUM = 0x100

Definition at line 297 of file thread_manager.hpp.

Referenced by vacuum_boot().

const cubperf::statset_definition cubthread::Looper_statistics
static
Initial value:

Definition at line 36 of file thread_looper.cpp.

entry* cubthread::Main_entry_p = NULL
static

Definition at line 469 of file thread_manager.cpp.

Referenced by finalize(), get_main_entry(), and initialize().

manager* cubthread::Manager = NULL
static

Definition at line 468 of file thread_manager.cpp.

Referenced by finalize(), and get_manager().

const std::size_t cubthread::MAX_LOOPER_PERIODS = 3

Definition at line 44 of file thread_looper.hpp.

const unsigned cubthread::PGBUF_TRACK_MAX_AMOUNT = 16

Definition at line 71 of file thread_entry.cpp.

const std::size_t cubthread::PGBUF_TRACK_MAX_ITEMS = 1024

Definition at line 70 of file thread_entry.cpp.

const char* cubthread::PGBUF_TRACK_NAME = "Page Buffer"

Definition at line 68 of file thread_entry.cpp.

const char* cubthread::PGBUF_TRACK_RES_NAME = "pgptr"

Definition at line 69 of file thread_entry.cpp.

const cubperf::stat_id cubthread::STAT_AWAKEN_COUNT_AND_TIME = 4
static

Definition at line 40 of file thread_waiter.cpp.

const cubperf::stat_id cubthread::STAT_LOCK_WAKEUP_COUNT = 0
static

Definition at line 36 of file thread_waiter.cpp.

const cubperf::stat_id cubthread::STAT_LOOP_EXECUTE_COUNT_AND_TIME = 0
static

Definition at line 37 of file thread_daemon.cpp.

const cubperf::stat_id cubthread::STAT_LOOP_PAUSE_TIME = 1
static

Definition at line 38 of file thread_daemon.cpp.

cubperf::stat_id cubthread::STAT_LOOPER_RESET_COUNT = 1
static

Definition at line 35 of file thread_looper.cpp.

const cubperf::stat_id cubthread::STAT_LOOPER_SLEEP_COUNT_AND_TIME = 0
static

Definition at line 34 of file thread_looper.cpp.

const cubperf::stat_id cubthread::STAT_NO_SLEEP_COUNT = 3
static

Definition at line 39 of file thread_waiter.cpp.

const cubperf::stat_id cubthread::STAT_SLEEP_COUNT = 1
static

Definition at line 37 of file thread_waiter.cpp.

const cubperf::stat_id cubthread::STAT_TIMEOUT_COUNT = 2
static

Definition at line 38 of file thread_waiter.cpp.

const char* cubthread::STAT_WAKEUP_CALL_COUNT_NAME = "waiter_wakeup_count"
static

Definition at line 53 of file thread_waiter.cpp.

Referenced by cubthread::waiter::get_stat_name().

constexpr size_t cubthread::TASK_COUNT = 10

Definition at line 29 of file internal_tasks_worker_pool.cpp.

thread_local entry* cubthread::tl_Entry_p = NULL

Definition at line 47 of file thread_manager.cpp.

Referenced by cubthread::manager::claim_entry(), and get_entry().

const cubperf::statset_definition cubthread::Waiter_statistics
static
Initial value:
=
{
"waiter_timeout_count"),
"waiter_awake_count", "waiter_wakeup_delay_time")
}
static const cubperf::stat_id STAT_AWAKEN_COUNT_AND_TIME
static const cubperf::stat_id STAT_LOCK_WAKEUP_COUNT
static const cubperf::stat_id STAT_NO_SLEEP_COUNT
static const cubperf::stat_id STAT_SLEEP_COUNT
static const cubperf::stat_id STAT_TIMEOUT_COUNT

Definition at line 41 of file thread_waiter.cpp.

constexpr size_t cubthread::WORKER_COUNT = 2

Definition at line 28 of file internal_tasks_worker_pool.cpp.

const cubperf::statset_definition cubthread::Worker_pool_statdef
static
Initial value:
=
{
"Counter_start_thread", "Timer_start_thread"),
"Counter_create_context", "Timer_create_context"),
"Counter_execute_task", "Timer_execute_task"),
"Counter_retire_task", "Timer_retire_task"),
"Counter_found_task_in_queue", "Timer_found_task_in_queue"),
"Counter_wakeup_with_task", "Timer_wakeup_with_task"),
"Counter_recycle_context", "Timer_recycle_context"),
"Counter_retire_context", "Timer_retire_context")
}
static const cubperf::stat_id Wpstat_recycle_context
static const cubperf::stat_id Wpstat_start_thread
static const cubperf::stat_id Wpstat_create_context
static const cubperf::stat_id Wpstat_wakeup_with_task
static const cubperf::stat_id Wpstat_found_in_queue
static const cubperf::stat_id Wpstat_retire_context
static const cubperf::stat_id Wpstat_retire_task
static const cubperf::stat_id Wpstat_execute_task

Definition at line 52 of file thread_worker_pool.cpp.

const cubperf::stat_id cubthread::Wpstat_create_context = 1
static

Definition at line 491 of file thread_worker_pool.hpp.

const cubperf::stat_id cubthread::Wpstat_execute_task = 2
static

Definition at line 492 of file thread_worker_pool.hpp.

const cubperf::stat_id cubthread::Wpstat_found_in_queue = 4
static

Definition at line 494 of file thread_worker_pool.hpp.

const cubperf::stat_id cubthread::Wpstat_recycle_context = 6
static

Definition at line 496 of file thread_worker_pool.hpp.

const cubperf::stat_id cubthread::Wpstat_retire_context = 7
static

Definition at line 497 of file thread_worker_pool.hpp.

const cubperf::stat_id cubthread::Wpstat_retire_task = 3
static

Definition at line 493 of file thread_worker_pool.hpp.

const cubperf::stat_id cubthread::Wpstat_start_thread = 0
static

Definition at line 490 of file thread_worker_pool.hpp.

const cubperf::stat_id cubthread::Wpstat_wakeup_with_task = 5
static

Definition at line 495 of file thread_worker_pool.hpp.