35 static constexpr TaskId NoTask = {
static_cast<uint32_t
>(-1), 0, 0 };
45 float tasksPerSecond = 0.f;
46 float tasksPerFrame = 0.f;
52 float utilization = 0.f;
53 float tasksPerSecond = 0.f;
54 float tasksPerFrame = 0.f;
70 void updateState(
Context* context);
73 size_t getQueueCount()
const;
91 [[nodiscard]]
TaskQueueId createQueue(std::string_view name,
const size_t numThreads);
97 const std::string& getQueueName(
TaskQueueId queue)
const;
100 void getQueueState(
QueueState& queueState, std::vector<QueueWorkerState>& workerStates,
TaskQueueId queue)
const;
108 [[nodiscard]]
size_t getQueueConcurrency(
TaskQueueId queue);
113 [[nodiscard]]
bool onMainThread()
const;
151 [[nodiscard]]
TaskId createChild(
const TaskId & parentTask, TaskFunctionRef func);
159 void enqueue(
const TaskId & taskId);
171 TaskId enqueueChild(
const TaskId & parentTask, TaskFunctionRef func);
194 void destroy(
const TaskId & taskId);
199 [[nodiscard]]
bool isActive(
const TaskId& taskId);
206 void wait(
const TaskId & taskId);
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Manages Task queuing and execution.
std::unique_ptr< class TaskQueues > taskQueues
Task queues manager.
Task queues holds tasks ready for execution by TaskWorkers.
std::function< void()> TaskFunction
Type of task function used by the task manager.
uint16_t TaskQueueId
Unique id for a task queue.
Contains all Cogs related functionality.
Reports current state of a queue.
reports current state of a queue worker.
Task id struct used to identify unique Task instances.
bool isValid() const
Check if the task id is valid.
uint32_t taskHandle
Integer handle to the task in a TaskPool.
uint16_t generation
Generation counter used to separate generational instances.
TaskQueueId queueId
Id of the TaskQueue the Task belongs to.