Games Task Scheduler (GTS)
A multi-processor scheduling framework for games engines
gts::MacroScheduler Class Referenceabstract

A MacroScheduler builds ISchedules for a set of ComputeResources from a DAG of Node. More...

#include <MacroScheduler.h>

Inherited by gts::CentralQueue_MacroScheduler, and gts::CriticalNode_MacroScheduler.

Public Member Functions

virtual ~MacroScheduler ()
 
virtual bool init (MacroSchedulerDesc const &desc)=0
 
ComputeResourcefindComputeResource (ComputeResourceId id)
 
Vector< ComputeResource * > const & computeResources () const
 
Vector< ComputeResource * > & computeResources ()
 
NodeallocateNode ()
 
void destroyNode (Node *pNode)
 
virtual void freeSchedule (Schedule *pSchedule)=0
 
virtual SchedulebuildSchedule (Node *pStart, Node *pEnd)=0
 
virtual void executeSchedule (Schedule *pSchedule, ComputeResourceId id)=0
 

Protected Member Functions

void * _allocateWorkload (size_t size)
 
void _freeWorkload (void *ptr)
 

Protected Attributes

Vector< ComputeResource * > m_computeResources
 

Friends

class Node
 

Detailed Description

A MacroScheduler builds ISchedules for a set of ComputeResources from a DAG of Node.

Constructor & Destructor Documentation

◆ ~MacroScheduler()

virtual gts::MacroScheduler::~MacroScheduler ( )
virtual

For polymorphic destruction.

Member Function Documentation

◆ allocateNode()

Node* gts::MacroScheduler::allocateNode ( )

Allocate a Node that can be inserted into a DAG.

Remarks
Adding a Node to multiple DAGs is undefined.

◆ buildSchedule()

virtual Schedule* gts::MacroScheduler::buildSchedule ( Node pStart,
Node pEnd 
)
pure virtual

Builds a schedule from the specified DAG that begins at 'pStart' and ends at 'pEnd'.

Returns
An Schedule or nullptr if the DAG is invalid.

Implemented in gts::CentralQueue_MacroScheduler, and gts::CriticalNode_MacroScheduler.

◆ computeResources() [1/2]

Vector<ComputeResource*>& gts::MacroScheduler::computeResources ( )
Returns
Get a list of all the ComputeResource.

◆ computeResources() [2/2]

Vector<ComputeResource*> const& gts::MacroScheduler::computeResources ( ) const
Returns
Get a list of all the ComputeResource.

◆ destroyNode()

void gts::MacroScheduler::destroyNode ( Node pNode)

Free pNode from memory.

◆ executeSchedule()

virtual void gts::MacroScheduler::executeSchedule ( Schedule pSchedule,
ComputeResourceId  id 
)
pure virtual

Executes the specified 'pSchedule' and uses the specified ComputeResource 'id' for the calling thread. Setting 'id' to UNKNOWN_COMP_RESOURCE will not use the calling thread.

Implemented in gts::CriticalNode_MacroScheduler, and gts::CentralQueue_MacroScheduler.

◆ findComputeResource()

ComputeResource* gts::MacroScheduler::findComputeResource ( ComputeResourceId  id)
Returns
A ComputeResource or nullptr if DNE.

◆ freeSchedule()

virtual void gts::MacroScheduler::freeSchedule ( Schedule pSchedule)
pure virtual

Free an existing Schedule from memory.

Implemented in gts::CentralQueue_MacroScheduler, and gts::CriticalNode_MacroScheduler.

◆ init()

virtual bool gts::MacroScheduler::init ( MacroSchedulerDesc const &  desc)
pure virtual

Initializes the IMacroScheduler object based on 'desc'.

Implemented in gts::CentralQueue_MacroScheduler, and gts::CriticalNode_MacroScheduler.