32 struct transient_data_container
37 transient_data_container(
size_t _max_data_parallel_workload);
41 ~transient_data_container();
45 data_vector data_workload;
49 data_dispatcher_type *data_dispatcher;
53 uint32_t minimum_batch_size;
101 void run_internal(
typename super::function_type* _work_function, TDataType& _data);
108 template <
class TMemInterface,
class TDataType >
110 : data_workload(_max_data_parallel_workload)
111 , data_dispatcher(nullptr)
115 template <
class TMemInterface,
class TDataType >
118 assert(data_dispatcher ==
nullptr);
121 template <
class TMemInterface,
class TDataType >
128 template <
class TMemInterface,
class TDataType >
133 template <
class TMemInterface,
class TDataType >
142 template <
class TMemInterface,
class TDataType >
147 typename super::function_type *work_function =
nullptr;
150 size_t available_batch_size = 0;
154 for (uint32_t batch_index; batch_index < available_batch_size; ++batch_index)
156 profile::instrument< void, data_task_type, void (data_task_type::*)(typename super::function_type*) >(
super::transient.
task_time,
this, &data_task_type::run_internal, work_function, *(batch + batch_index));
165 template <
class TMemInterface,
class TDataType >
168 (*_work_function)(_data);
171 template <
class TMemInterface,
class TDataType >
178 for (thread_num_t count = 0; count < _scheduled_on_num_workers; ++count)
190 template <
class TMemInterface,
class TDataType >
200 template <
class TMemInterface,
class TDataType >
Definition: datatask.h:25
transient_container transient
The transient
Definition: task.h:259
bool run() override
Callback to run task
Definition: datatask.h:143
work_queue_type * work_queue
The work queue
Definition: task.h:122
profile::time task_time
Total time spent running all work functions in this task
Definition: task.h:134
Class stl_allocator.
Definition: allocator.h:16
virtual void after_run()
Callback is called after a task is run
Definition: task.h:505
std::atomic_int64_t num_runned
Total number of times work function was called
Definition: task.h:138
bool add_data_parallel_work(typename data_vector::iterator _begin, typename data_vector::iterator _end)
Add data parallel work class.
Definition: datatask.h:134
void after_run() override
Callback is called after a task is run
Definition: datatask.h:191
virtual thread_num_t get_recommended_num_workers() override
Gets the best number of workers for the task every frame
Definition: datatask.h:201
Class scoped_enter_exit.
Definition: utils.h:140
virtual void before_scheduled(thread_num_t _scheduled_on_num_workers)
Callback is called when a task is scheduled
Definition: task.h:499
Class lock_free_batch_dispatcher.
Definition: lockfreebatchdispenser.h:17
base_data_task(typename super::task_graph_type &_task_graph, size_t _max_data_parallel_workload=0)
Initializes a new instance of the base_task class.
Definition: datatask.h:122
Class base_task.
Definition: task.h:44
Class base_task_graph.
Definition: task.h:35
transient_data_container data_transient
The transient
Definition: datatask.h:60
void before_scheduled(thread_num_t _scheduled_on_num_workers) override
Callback is called when a task is scheduled
Definition: datatask.h:172
Struct thread_unsafe_access_storage
Definition: utils.h:195
persistent_container persistent
The persistent
Definition: task.h:263
~base_data_task()
Finalizes an instance of the base_task class.
Definition: datatask.h:129