Mercurial > hg > Game > Cerium
annotate TaskManager/kernel/ppe/TaskManagerImpl.h @ 1149:bccd192a43b2 draft
Cell fix
author | yutaka@localhost.localdomain |
---|---|
date | Wed, 23 Feb 2011 03:55:54 +0900 |
parents | 279b41354753 |
children | b93ff55ba015 |
rev | line source |
---|---|
3 | 1 #ifndef INCLUDED_TASK_MANAGER_IMPL |
2 #define INCLUDED_TASK_MANAGER_IMPL | |
3 | |
307 | 4 #include "MailManager.h" |
5 #include "ListData.h" | |
955 | 6 #include "QueueInfo.h" |
7 #include "TaskQueue.h" | |
8 #include "HTask.h" | |
736 | 9 #include "Scheduler.h" |
619 | 10 class MemList; |
475
4e0308d2ba73
BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
11 |
955 | 12 extern QueueInfo<TaskQueue> *taskQueuePool ; |
13 extern QueueInfo<HTask> *htaskPool ; | |
14 extern QueueInfo<TaskList> *taskListPool; | |
15 | |
16 | |
54 | 17 |
3 | 18 class TaskManagerImpl { |
19 public: | |
20 | |
21 /* variables */ | |
22 int machineNum; | |
955 | 23 QueueInfo<HTask> *activeTaskQueue; |
24 QueueInfo<HTask> *waitTaskQueue; | |
475
4e0308d2ba73
BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
373
diff
changeset
|
25 |
955 | 26 QueueInfo<TaskQueue> *taskQueueImpl; |
27 QueueInfo<HTask> *htaskImpl; | |
619 | 28 |
546 | 29 SchedTask *schedTaskManager; |
637 | 30 Scheduler *scheduler; |
833
577bde5d0cec
poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
830
diff
changeset
|
31 TaskManagerImpl *others; |
3 | 32 |
480
75e4afa40da2
TaskQueueInfo initiaization...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
479
diff
changeset
|
33 /* constructor */ |
1149 | 34 TaskManagerImpl(int num = 0) ; |
480
75e4afa40da2
TaskQueueInfo initiaization...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
479
diff
changeset
|
35 |
75e4afa40da2
TaskQueueInfo initiaization...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
479
diff
changeset
|
36 virtual ~TaskManagerImpl() { } |
75e4afa40da2
TaskQueueInfo initiaization...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
479
diff
changeset
|
37 |
3 | 38 /* functions */ |
109 | 39 // system |
1057
8cd123d2f3ca
debug_check_spu_idle add. commandline option [-spuidle].
tkaito@henri
parents:
955
diff
changeset
|
40 virtual void init(int) = 0; |
480
75e4afa40da2
TaskQueueInfo initiaization...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
479
diff
changeset
|
41 virtual void run() = 0; |
672 | 42 virtual void start_profile() = 0; |
43 virtual void show_profile() = 0; | |
498
bce667ff20b9
double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
496
diff
changeset
|
44 virtual void append_activeTask(HTaskPtr); |
bce667ff20b9
double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
496
diff
changeset
|
45 virtual void append_waitTask(HTaskPtr); |
833
577bde5d0cec
poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
830
diff
changeset
|
46 virtual void polling() = 0; |
1067 | 47 virtual void print_arch() = 0; |
109 | 48 |
955 | 49 void check_task_finish(HTaskPtr task, QueueInfo<HTask> *wait_queue); |
50 void check_task_list_finish(SchedTask *s, TaskListPtr list, QueueInfo<HTask> *wait_queue); | |
109 | 51 |
480
75e4afa40da2
TaskQueueInfo initiaization...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
479
diff
changeset
|
52 void systask_init(); |
109 | 53 |
54 // user | |
897
6bd218d3f643
add return address in SimpleTask for debugging.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
895
diff
changeset
|
55 virtual HTaskPtr create_task(int cmd,void *from); |
6bd218d3f643
add return address in SimpleTask for debugging.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
895
diff
changeset
|
56 virtual HTaskPtr create_task(int cmd, memaddr rbuf, long r_size, memaddr wbuf, long w_size,void *from); |
6bd218d3f643
add return address in SimpleTask for debugging.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
895
diff
changeset
|
57 virtual HTaskPtr create_task_array(int id, int num_task, int num_param, int num_inData, int num_outData,void *from); |
1063
dbd083c00be4
TaskManagerImpl::get_task_name() fix in header file
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
1062
diff
changeset
|
58 const char *get_task_name(int cmd); |
dbd083c00be4
TaskManagerImpl::get_task_name() fix in header file
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
1062
diff
changeset
|
59 const char *get_task_name(TaskPtr task); |
dbd083c00be4
TaskManagerImpl::get_task_name() fix in header file
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
1062
diff
changeset
|
60 const char *get_task_name(SimpleTaskPtr simpletask); |
dbd083c00be4
TaskManagerImpl::get_task_name() fix in header file
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
1062
diff
changeset
|
61 const char *get_task_name(SchedTaskBase *schedtask); |
dbd083c00be4
TaskManagerImpl::get_task_name() fix in header file
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
1062
diff
changeset
|
62 const char *get_task_name(HTaskPtr htask); |
dbd083c00be4
TaskManagerImpl::get_task_name() fix in header file
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
1062
diff
changeset
|
63 const char *get_task_name(HTaskPtr htask, int index); |
637 | 64 virtual void set_task_depend(HTaskPtr master, HTaskPtr slave); |
65 virtual void spawn_task(HTaskPtr); | |
66 virtual void set_task_cpu(HTaskPtr, CPU_TYPE); | |
1062
f994f5032299
add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
1057
diff
changeset
|
67 void set_taskList(HTaskPtr htask, QueueInfo<TaskList> * taskList); |
619 | 68 |
941
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
69 void free_htask(HTaskPtr htask) { |
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
70 #if !defined(__SPU__) |
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
71 if (htask->self) { |
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
72 htask->flag.no_auto_free = 0; |
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
73 return; |
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
74 } |
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
75 htaskImpl->free_(htask); |
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
76 #endif |
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
77 } |
fc6cfaae6de7
add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
899
diff
changeset
|
78 |
637 | 79 void* allocate(int size, int alignment) |
80 { | |
899 | 81 void *buff = 0; |
637 | 82 if (size==0) return 0; |
666 | 83 #if defined(__SPU__) || ! defined(HAS_POSIX_MEMALIGN) |
84 buff = malloc(size); | |
85 #else | |
637 | 86 posix_memalign(&buff, alignment, size); |
666 | 87 #endif |
736 | 88 if (buff==0) |
89 get_scheduler()->printf("Can't allocate memory\n"); | |
637 | 90 return buff; |
91 } | |
92 | |
93 void* allocate(int size) | |
94 { | |
899 | 95 void *buff = 0; |
637 | 96 if (size==0) return 0; |
666 | 97 #if defined(__SPU__) || ! defined(HAS_POSIX_MEMALIGN) |
98 buff = malloc(size); | |
99 #else | |
637 | 100 posix_memalign(&buff, DEFAULT_ALIGNMENT, size); |
666 | 101 #endif |
736 | 102 if (buff==0) |
103 get_scheduler()->printf("Can't allocate memory\n"); | |
637 | 104 return buff; |
105 } | |
106 | |
107 Scheduler* get_scheduler() { return scheduler; } | |
108 void set_scheduler(Scheduler *s) { scheduler = s; } | |
895
b662e9dd26b0
add alignment of classes in SPU
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
835
diff
changeset
|
109 } __attribute__ ((aligned (DEFAULT_ALIGNMENT))); |
619 | 110 |
3 | 111 #endif |