Back to Taskflow

tf::ChromeObserver class

docs/classtf_1_1ChromeObserver.html

4.0.03.2 KB
Original Source

tf::ChromeObserver class

class to create an observer based on Chrome tracing format

A tf::ChromeObserver inherits tf::ObserverInterface and defines methods to dump the observed thread activities into a format that can be visualized through Chrome Tracing.

tf::Taskflow taskflow;tf::Executor executor;// insert tasks into taskflow// ...// create a custom observerstd::shared\_ptr\<tf::ChromeObserver\> observer = executor.make\_observer\<tf::ChromeObserver\>();// run the taskflowexecutor.run(taskflow).wait();// dump the thread activities to a chrome-tracing format.observer-\>dump(std::cout);

Base classes

class ObserverInterfaceclass to derive an executor observer

Public functions

void dump(std::ostream& ostream) constdumps the timelines into a Chrome Tracing format through an output streamauto dump() const -> std::stringdumps the timelines into a Chrome Tracing formatvoid clear()clears the timeline dataauto num_tasks() const -> size_tqueries the number of tasks observed

Private functions

void set_up(size_t num_workers) finalconstructor-like method to call when the executor observer is fully createdvoid on_entry(WorkerView wv, TaskView task_view) finalmethod to call before a worker thread executes a closurevoid on_exit(WorkerView wv, TaskView task_view) finalmethod to call after a worker thread executed a closure

Function documentation

void tf::ChromeObserver::set_up(size_t num_workers) final private

constructor-like method to call when the executor observer is fully created

Parameters
num_workers

void tf::ChromeObserver::on_entry(WorkerView wv, TaskView task_view) final private

method to call before a worker thread executes a closure

Parameters
wv
task_view

void tf::ChromeObserver::on_exit(WorkerView wv, TaskView task_view) final private

method to call after a worker thread executed a closure

Parameters
wv
task_view