50template<
typename Time_accumulator>
220 template<
typename Handler>
289template<
typename Time_accumulator>
292 m_clock_type(clock_type),
294 m_exhanger_func(std::move(exchanger_func_moved)),
295 m_time_accumulator(0)
300template<
typename Time_accumulator>
304 m_loop->start(std::move(init_task_or_empty), thread_init_func_or_empty);
307template<
typename Time_accumulator>
313template<
typename Time_accumulator>
316 return m_loop->n_threads();
319template<
typename Time_accumulator>
322 return m_loop->create_op();
325template<
typename Time_accumulator>
328 return m_loop->per_thread_ops();
331template<
typename Time_accumulator>
338template<
typename Time_accumulator>
346template<
typename Time_accumulator>
350 return m_loop->schedule_from_now(from_now,
354template<
typename Time_accumulator>
358 return m_loop->schedule_at(at,
362template<
typename Time_accumulator>
366 return m_loop->schedule_from_now(op, from_now,
370template<
typename Time_accumulator>
374 return m_loop->schedule_at(op, at,
378template<
typename Time_accumulator>
381 return m_loop->task_engine();
384template<
typename Time_accumulator>
390template<
typename Time_accumulator>
391template<
typename Handler>
The core flow::async interface, providing an optionally multi-threaded thread pool onto which runnabl...
Function< void(size_t thread_idx)> Thread_init_func
Short-hand for the thread-initializer-function optional arg type to start().
Simple, immutable vector-like sequence of N opaque async::Op objects, usually corresponding to N work...
Decorator of a Concurrent_task_loop with same or greater lifetime that accumulates time elapsed in an...
Concurrent_task_loop *const m_loop
See constructor.
const Exchanger_func m_exhanger_func
See constructor.
size_t n_threads() const override
Implements superclass API.
const flow::perf::Clock_type m_clock_type
See constructor.
util::Scheduled_task_handle schedule_at(const Fine_time_pt &at, Scheduled_task &&task) override
Implements superclass API.
void post(const Op &op, Task &&task, Synchronicity synchronicity=Synchronicity::S_ASYNC) override
Implements superclass API.
perf::Duration accumulated_time()
Returns the accumulated time spent on tasks this thread pool handles since its last invocation; and r...
Time_accumulator m_time_accumulator
Accumulates time ticks, of clock type m_clock_type, spent in tasks posted onto m_loop.
void start(Task &&init_task_or_empty=Task(), const Thread_init_func &thread_init_func_or_empty=Thread_init_func()) override
Implements superclass API.
util::Scheduled_task_handle schedule_from_now(const Fine_duration &from_now, Scheduled_task &&task) override
Implements superclass API.
util::Scheduled_task_handle schedule_at(const Op &op, const Fine_time_pt &at, Scheduled_task &&task) override
See superclass API.
Op create_op() override
Implements superclass API.
const Op_list & per_thread_ops() override
Implements superclass API.
auto asio_handler_timed(Handler &&handler_moved)
Given a boost.asio completion handler handler for a boost.asio async_*() action on some boost....
Task_engine_ptr task_engine() override
See superclass API.
void stop() override
Implements superclass API.
void post(Task &&task, Synchronicity synchronicity=Synchronicity::S_ASYNC) override
Implements superclass API.
util::Scheduled_task_handle schedule_from_now(const Op &op, const Fine_duration &from_now, Scheduled_task &&task) override
Implements superclass API.
Timed_concurrent_task_loop_impl(Concurrent_task_loop *loop, perf::Clock_type clock_type, Exchanger_func &&exchanger_func_moved)
Constructs a time-accumulating version of existing loop *loop.
Decorates a general – potentially multi-threaded – Concurrent_task_loop of any kind but with timing c...
Timed_concurrent_task_loop(Concurrent_task_loop *loop, perf::Clock_type clock_type=perf::Clock_type::S_CPU_THREAD_TOTAL_HI_RES)
Constructs a time-accumulating version of existing loop *loop.
std::atomic< perf::duration_rep_t > Time_accumulator
Convenience alias to our thread-safe tick accumulator type.
Flow module containing tools enabling multi-threaded event loops operating under the asynchronous-tas...
boost::any Op
An object of this opaque type represents a collection of 1 or more async::Task, past or future,...
Synchronicity
Enumeration indicating the manner in which asio_exec_ctx_post(), and various boost....
@ S_ASYNC
Simply post the given task to execute asynchronously in some execution context – as soon as the conte...
boost::shared_ptr< util::Task_engine > Task_engine_ptr
Short-hand for reference-counting pointer to a mutable util::Task_engine (a/k/a boost::asio::io_servi...
Function< void()> Task
Short-hand for a task that can be posted for execution by a Concurrent_task_loop or flow::util::Task_...
auto timed_function(Clock_type clock_type, Accumulator *accumulator, Func &&function)
Constructs a closure that times and executes void-returning function(), adding the elapsed time with ...
Fine_duration Duration
Short-hand for a high-precision boost.chrono duration, formally equivalent to flow::Fine_duration.
Duration::rep duration_rep_t
The raw type used in Duration to store its clock ticks.
auto timed_handler(Clock_type clock_type, Accumulator *accumulator, Handler &&handler)
Identical to timed_function() but suitable for boost.asio-targeted handler functions.
Clock_type
Clock types supported by flow::perf module facilities, perf::Checkpointing_timer in particular.
@ S_CPU_THREAD_TOTAL_HI_RES
Similar to S_CPU_TOTAL_HI_RES but applied to the calling thread as opposed to entire process.
boost::shared_ptr< Scheduled_task_handle_state > Scheduled_task_handle
Black-box type that represents a handle to a scheduled task as scheduled by schedule_task_at() or sch...
Fine_clock::duration Fine_duration
A high-res time duration as computed from two Fine_time_pts.
Fine_clock::time_point Fine_time_pt
A high-res time point as returned by Fine_clock::now() and suitable for precise time math in general.