# tf::ChromeObserver class
#include <taskflow/core/observer.hpp>

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 observer
    std::shared_ptr<tf::ChromeObserver> observer = executor.make_observer<tf::ChromeObserver>();

    // run the taskflow
    executor.run(taskflow).wait();

    // dump the thread activities to a chrome-tracing format.
    observer->dump(std::cout);

## Base classes

class ObserverInterface
  class to derive an executor observer

## Public functions

void dump( std::ostream& ostream) const
  dumps the timelines into a Chrome Tracing format through an output stream
auto dump() const -> std::string
  dumps the timelines into a Chrome Tracing format
void clear()
  clears the timeline data
auto num_tasks() const -> size_t
  queries the number of tasks observed

## Private functions

void set_up(size_t num_workers) final
  constructor-like method to call when the executor observer is fully created
void on_entry( WorkerView wv, TaskView task_view) final
  method to call before a worker thread executes a closure
void on_exit( WorkerView wv, TaskView task_view) final
  method 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 | the number of the worker threads in the executor

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

method to call before a worker thread executes a closure

Parameters
wv | an immutable view of this worker thread
task_view | a constant wrapper object to the task

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

method to call after a worker thread executed a closure

Parameters
wv | an immutable view of this worker thread
task_view | a constant wrapper object to the task

Tab / T to search, Esc to close
…

Search for symbols, directories, files, pages or modules. You can omit any prefix from the symbol or file path; adding a `:` or `/` suffix lists all members of given symbol or directory.

Use ↓ / ↑ to navigate through the list, Enter to go. Tab autocompletes common prefix, you can copy a link to the result using ⌘ L while ⌘ M produces a Markdown link.

Sorry, nothing was found.