22 #include "gts/platform/Thread.h"
24 #include "gts/micro_scheduler/WorkerPool.h"
25 #include "gts/micro_scheduler/MicroScheduler.h"
29 namespace gts_examples {
33 printf (
"================\n");
34 printf (
"partitionInit\n");
35 printf (
"================\n");
62 AffinitySet mainPoolAffinity;
63 AffinitySet slowPoolAffinity;
65 int numMainThreads = 0;
66 int numSlowThreads = 0;
107 AffinitySet masterAffinity;
111 for (
int iWorker = 0; iWorker < numMainThreads; ++iWorker)
115 workerDesc.
affinity = {0, mainPoolAffinity};
117 sprintf(workerDesc.
name,
"MainWorker %d", iWorker);
121 sprintf(mainPoolDesc.
name,
"MainWorkerPool");
123 mainMicroScheduler.
initialize(&mainWorkerPool);
131 for (
int iWorker = 0; iWorker < numSlowThreads; ++iWorker)
135 workerDesc.
affinity = {0, slowPoolAffinity};
137 sprintf(workerDesc.
name,
"SlowWorker %d", iWorker);
141 sprintf(slowPoolDesc.
name,
"SlowWorkerPool");
143 slowMicroScheduler.
initialize(&slowWorkerPool);
A work-stealing task scheduler. The scheduler is executed by the WorkerPool it is initialized with.
Definition: MicroScheduler.h:81
bool initialize(WorkerPool *pWorkerPool)
Initializes the MicroScheduler and attaches it to pWorkPool, where each worker in pWorkPool will exec...
void addExternalVictim(MicroScheduler *pScheduler)
Adds 'pScheduler' as an external victim. All Schedules in this MicroScheduler will be able to steal f...
A collection of running Worker threads that a MicroScheduler can be run on.
Definition: WorkerPool.h:54
bool initialize(uint32_t threadCount=0)
A description of a CPU core.
Definition: Thread.h:149
A description of a processor group.
Definition: Thread.h:202
A description of the system's processor topology.
Definition: Thread.h:231
The description of a WorkerPool.
Definition: MicroSchedulerTypes.h:172
gts::Vector< WorkerThreadDesc > workerDescs
The description of each worker thread.
Definition: MicroSchedulerTypes.h:184
char name[DESC_NAME_SIZE]
A name to help with debugging.
Definition: MicroSchedulerTypes.h:224
The description of a worker Thread.
Definition: MicroSchedulerTypes.h:87
char name[DESC_NAME_SIZE]
The thread's name.
Definition: MicroSchedulerTypes.h:132
WorkerThreadDesc::GroupAndAffinity affinity
Specifies the thread affinity for each processor group. See gts::Thread::getSystemTopology to identif...
Definition: MicroSchedulerTypes.h:114