Mercurial > hg > Game > Cerium
view TaskManager/kernel/ppe/TaskManagerImpl.h @ 807:eb747703c525 draft
merge
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 22 May 2010 18:21:13 +0900 |
parents | fb49e881f2ed c63110ac1430 |
children | 13c736659c63 |
line wrap: on
line source
#ifndef INCLUDED_TASK_MANAGER_IMPL #define INCLUDED_TASK_MANAGER_IMPL #include "MailManager.h" #include "ListData.h" #include "TaskListInfo.h" #include "TaskQueueInfo.h" #include "HTaskInfo.h" #include "Scheduler.h" class MemList; class TaskManagerImpl { public: /* variables */ int machineNum; HTaskInfo *activeTaskQueue; HTaskInfo *waitTaskQueue; TaskListInfo *taskListImpl; TaskQueueInfo *taskQueueImpl; HTaskInfo *htaskImpl; SchedTask *schedTaskManager; Scheduler *scheduler; /* constructor */ TaskManagerImpl(int num = 1) ; virtual ~TaskManagerImpl() { } /* functions */ // system virtual void init() = 0; virtual void run() = 0; virtual void start_profile() = 0; virtual void show_profile() = 0; virtual void append_activeTask(HTaskPtr); virtual void append_waitTask(HTaskPtr); void check_task_finish(HTaskPtr task, HTaskInfo *wait_queue); void systask_init(); // user virtual HTaskPtr create_task(int cmd); virtual HTaskPtr create_task(int cmd, memaddr rbuf, long r_size, memaddr wbuf, long w_size); virtual HTaskPtr create_task_array(int id, int num_task, int num_param, int num_inData, int num_outData); virtual void set_task_depend(HTaskPtr master, HTaskPtr slave); virtual void spawn_task(HTaskPtr); virtual void set_task_cpu(HTaskPtr, CPU_TYPE); void set_taskList(HTaskPtr htask, TaskListInfoPtr taskList) ; void* allocate(int size, int alignment) { void *buff; if (size==0) return 0; #if defined(__SPU__) || ! defined(HAS_POSIX_MEMALIGN) buff = malloc(size); #else posix_memalign(&buff, alignment, size); #endif if (buff==0) get_scheduler()->printf("Can't allocate memory\n"); return buff; } void* allocate(int size) { void *buff; if (size==0) return 0; #if defined(__SPU__) || ! defined(HAS_POSIX_MEMALIGN) buff = malloc(size); #else posix_memalign(&buff, DEFAULT_ALIGNMENT, size); #endif if (buff==0) get_scheduler()->printf("Can't allocate memory\n"); return buff; } Scheduler* get_scheduler() { return scheduler; } void set_scheduler(Scheduler *s) { scheduler = s; } }; #endif