Mercurial > hg > Game > Cerium
view TaskManager/kernel/ppe/TaskManagerImpl.h @ 672:27fec8c70c9c draft
add profiling code
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 05 Dec 2009 20:20:08 +0900 |
parents | f02b3338b91b |
children | cc1b7333de92 |
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" class Scheduler; 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 wakeup_waitTask(); 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 void set_task_depend(HTaskPtr master, HTaskPtr slave); virtual void spawn_task(HTaskPtr); virtual void set_task_cpu(HTaskPtr, CPU_TYPE); 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) fprintf(stderr,"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) fprintf(stderr,"Can't allocate memory\n"); return buff; } Scheduler* get_scheduler() { return scheduler; } void set_scheduler(Scheduler *s) { scheduler = s; } }; #endif