You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Knowing the thread activities is very important for performance analysis.
242
+
Cpp-Taskflow provides a tf::ExecutorObserver to let users create an observer to record an executor's task execution. The following example shows creating an observer through the executor's tf::Executor::make_observer method.
243
+
244
+
@code{.cpp}
245
+
tf::Taskflow taskflow;
246
+
auto observer = taskflow.share_executor()->make_observer<tf::ExecutorObserver>();
247
+
@endcode
248
+
249
+
Note that each executor can only have an observer at a time and creating observer during task execution
250
+
will result in undefined behavior. An observer will automatically record the start and end timestamps
251
+
of each executed task. Users can query, dump or remove the timestamps through the tf::ExecutorObserver::num_tasks,
252
+
tf::ExecutorObserver::dump and tf::ExecutorObserver::clear methods.
253
+
254
+
@code{.cpp}
255
+
1. tf::Taskflow taskflow;
256
+
2. auto observer = taskflow.share_executor()->make_observer<tf::ExecutorObserver>();
0 commit comments