CUBRID Engine
latest
|
#include <thread_looper.hpp>
Public Member Functions | |
looper () | |
looper (const looper &other) | |
looper (const period_function &setup_period_function) | |
looper (const delta_time &fixed_period) | |
template<std::size_t Count> | |
looper (const std::array< delta_time, Count > periods) | |
~looper (void) | |
void | put_to_sleep (waiter &waiter_arg) |
void | reset (void) |
bool | stop (void) |
bool | is_stopped (void) const |
bool | was_woken_up (void) const |
void | get_stats (cubperf::stat_value *stats_out) |
Static Public Member Functions | |
static std::size_t | get_stats_value_count (void) |
static const char * | get_stat_name (std::size_t stat_index) |
Private Types | |
enum | wait_type { INF_WAITS, FIXED_WAITS, INCREASING_WAITS, CUSTOM_WAITS } |
Private Member Functions | |
void | setup_fixed_waits (bool &is_timed_wait, delta_time &period) |
void | setup_infinite_wait (bool &is_timed_wait, delta_time &period) |
void | setup_increasing_waits (bool &is_timed_wait, delta_time &period) |
Private Attributes | |
std::size_t | m_periods_count |
delta_time | m_periods [MAX_LOOPER_PERIODS] |
std::atomic< std::size_t > | m_period_index |
std::atomic< bool > | m_stop |
std::atomic< bool > | m_was_woken_up |
period_function | m_setup_period |
std::chrono::system_clock::time_point | m_start_execution_time |
cubperf::statset & | m_stats |
wait_type | m_wait_type |
Definition at line 81 of file thread_looper.hpp.
|
private |
Enumerator | |
---|---|
INF_WAITS | |
FIXED_WAITS | |
INCREASING_WAITS | |
CUSTOM_WAITS |
Definition at line 132 of file thread_looper.hpp.
cubthread::looper::looper | ( | ) |
Definition at line 47 of file thread_looper.cpp.
References m_setup_period, and setup_infinite_wait().
Definition at line 63 of file thread_looper.cpp.
References assert, begin(), CUSTOM_WAITS, FIXED_WAITS, INCREASING_WAITS, INF_WAITS, m_periods, m_periods_count, m_setup_period, m_start_execution_time, m_wait_type, setup_fixed_waits(), and setup_increasing_waits().
cubthread::looper::looper | ( | const period_function & | setup_period_function | ) |
Definition at line 95 of file thread_looper.cpp.
References CUSTOM_WAITS, m_setup_period, and m_wait_type.
cubthread::looper::looper | ( | const delta_time & | fixed_period | ) |
Definition at line 102 of file thread_looper.cpp.
References FIXED_WAITS, m_periods, m_setup_period, m_wait_type, and setup_fixed_waits().
cubthread::looper::looper | ( | const std::array< delta_time, Count > | periods | ) |
Definition at line 169 of file thread_looper.hpp.
References assert, i, INCREASING_WAITS, m_periods, m_periods_count, m_setup_period, m_wait_type, min, and setup_increasing_waits().
cubthread::looper::~looper | ( | void | ) |
Definition at line 111 of file thread_looper.cpp.
References m_stats.
|
static |
Definition at line 237 of file thread_looper.cpp.
References cubperf::statset_definition::get_value_name().
Referenced by cubthread::daemon::get_stat_name().
void cubthread::looper::get_stats | ( | cubperf::stat_value * | stats_out | ) |
Definition at line 225 of file thread_looper.cpp.
References cubperf::statset_definition::get_stat_values_with_converted_timers(), and m_stats.
Referenced by cubthread::daemon::get_stats().
|
static |
Definition at line 231 of file thread_looper.cpp.
References cubperf::statset_definition::get_value_count().
Referenced by cubthread::daemon::get_stat_name(), cubthread::daemon::get_stats(), and cubthread::daemon::get_stats_value_count().
bool cubthread::looper::is_stopped | ( | void | ) | const |
Definition at line 177 of file thread_looper.cpp.
References m_stop.
Referenced by cubthread::daemon::loop_with_context(), cubthread::daemon::loop_without_context(), and put_to_sleep().
void cubthread::looper::put_to_sleep | ( | waiter & | waiter_arg | ) |
Definition at line 117 of file thread_looper.cpp.
References assert, is_stopped(), m_setup_period, m_start_execution_time, m_stats, cubperf::generic_statset< IsAtomic >::m_timept, m_was_woken_up, cubperf::reset_timept(), cubperf::statset_definition::time_and_increment(), cubthread::waiter::wait_for(), and cubthread::waiter::wait_inf().
Referenced by cubthread::daemon::pause().
void cubthread::looper::reset | ( | void | ) |
Definition at line 164 of file thread_looper.cpp.
References cubperf::statset_definition::increment(), m_period_index, and m_stats.
Referenced by cubthread::daemon::reset_looper(), and setup_increasing_waits().
|
private |
Definition at line 189 of file thread_looper.cpp.
References assert, m_period_index, and m_periods.
Referenced by looper().
|
private |
Definition at line 206 of file thread_looper.cpp.
References m_period_index, m_periods, m_periods_count, m_was_woken_up, and reset().
Referenced by looper().
|
private |
Definition at line 198 of file thread_looper.cpp.
References assert, and m_period_index.
Referenced by looper().
bool cubthread::looper::stop | ( | void | ) |
Definition at line 171 of file thread_looper.cpp.
References m_stop.
Referenced by cubthread::daemon::stop_execution().
bool cubthread::looper::was_woken_up | ( | void | ) | const |
Definition at line 183 of file thread_looper.cpp.
References m_was_woken_up.
Referenced by cubthread::daemon::was_woken_up().
|
private |
Definition at line 147 of file thread_looper.hpp.
Referenced by reset(), setup_fixed_waits(), setup_increasing_waits(), and setup_infinite_wait().
|
private |
Definition at line 145 of file thread_looper.hpp.
Referenced by looper(), setup_fixed_waits(), and setup_increasing_waits().
|
private |
Definition at line 144 of file thread_looper.hpp.
Referenced by looper(), and setup_increasing_waits().
|
private |
Definition at line 151 of file thread_looper.hpp.
Referenced by looper(), and put_to_sleep().
|
private |
Definition at line 155 of file thread_looper.hpp.
Referenced by looper(), and put_to_sleep().
|
private |
Definition at line 158 of file thread_looper.hpp.
Referenced by get_stats(), put_to_sleep(), reset(), and ~looper().
|
private |
Definition at line 148 of file thread_looper.hpp.
Referenced by is_stopped(), and stop().
|
private |
Definition at line 161 of file thread_looper.hpp.
Referenced by looper().
|
private |
Definition at line 149 of file thread_looper.hpp.
Referenced by put_to_sleep(), setup_increasing_waits(), and was_woken_up().