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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
1 #ifndef INCLUDED_TASK_MANAGER_IMPL
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
2 #define INCLUDED_TASK_MANAGER_IMPL
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
3
307
3fc86ddf5d1c clean up include
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 109
diff changeset
4 #include "MailManager.h"
3fc86ddf5d1c clean up include
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 109
diff changeset
5 #include "ListData.h"
955
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
6 #include "QueueInfo.h"
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
7 #include "TaskQueue.h"
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
8 #include "HTask.h"
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 719
diff changeset
9 #include "Scheduler.h"
619
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
10 class MemList;
475
4e0308d2ba73 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
11
955
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
12 extern QueueInfo<TaskQueue> *taskQueuePool ;
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
13 extern QueueInfo<HTask> *htaskPool ;
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
14 extern QueueInfo<TaskList> *taskListPool;
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
15
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
16
54
90523ccc4dff *** empty log message ***
gongo
parents: 50
diff changeset
17
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
18 class TaskManagerImpl {
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
19 public:
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
20
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
21 /* variables */
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
22 int machineNum;
955
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
23 QueueInfo<HTask> *activeTaskQueue;
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
24 QueueInfo<HTask> *waitTaskQueue;
475
4e0308d2ba73 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
25
955
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
26 QueueInfo<TaskQueue> *taskQueueImpl;
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
27 QueueInfo<HTask> *htaskImpl;
619
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
28
546
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
29 SchedTask *schedTaskManager;
637
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
30 Scheduler *scheduler;
833
577bde5d0cec poling (may recurse..)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 830
diff changeset
31 TaskManagerImpl *others;
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
32
480
75e4afa40da2 TaskQueueInfo initiaization...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 479
diff changeset
33 /* constructor */
1149
bccd192a43b2 Cell fix
yutaka@localhost.localdomain
parents: 1147
diff changeset
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
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
38 /* functions */
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
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
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 666
diff changeset
42 virtual void start_profile() = 0;
27fec8c70c9c add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 666
diff changeset
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
5ad8fb1dc70f print_arch add.
tkaito
parents: 1063
diff changeset
47 virtual void print_arch() = 0;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
48
955
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
49 void check_task_finish(HTaskPtr task, QueueInfo<HTask> *wait_queue);
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
50 void check_task_list_finish(SchedTask *s, TaskListPtr list, QueueInfo<HTask> *wait_queue);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
51
480
75e4afa40da2 TaskQueueInfo initiaization...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 479
diff changeset
52 void systask_init();
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
53
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
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
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
64 virtual void set_task_depend(HTaskPtr master, HTaskPtr slave);
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
65 virtual void spawn_task(HTaskPtr);
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
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
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
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
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
79 void* allocate(int size, int alignment)
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
80 {
899
1b9418af3127 minor fix..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 897
diff changeset
81 void *buff = 0;
637
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
82 if (size==0) return 0;
666
f02b3338b91b simplify word_count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
83 #if defined(__SPU__) || ! defined(HAS_POSIX_MEMALIGN)
f02b3338b91b simplify word_count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
84 buff = malloc(size);
f02b3338b91b simplify word_count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
85 #else
637
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
86 posix_memalign(&buff, alignment, size);
666
f02b3338b91b simplify word_count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
87 #endif
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 719
diff changeset
88 if (buff==0)
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 719
diff changeset
89 get_scheduler()->printf("Can't allocate memory\n");
637
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
90 return buff;
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
91 }
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
92
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
93 void* allocate(int size)
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
94 {
899
1b9418af3127 minor fix..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 897
diff changeset
95 void *buff = 0;
637
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
96 if (size==0) return 0;
666
f02b3338b91b simplify word_count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
97 #if defined(__SPU__) || ! defined(HAS_POSIX_MEMALIGN)
f02b3338b91b simplify word_count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
98 buff = malloc(size);
f02b3338b91b simplify word_count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
99 #else
637
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
100 posix_memalign(&buff, DEFAULT_ALIGNMENT, size);
666
f02b3338b91b simplify word_count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
101 #endif
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 719
diff changeset
102 if (buff==0)
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 719
diff changeset
103 get_scheduler()->printf("Can't allocate memory\n");
637
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
104 return buff;
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
105 }
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
106
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
107 Scheduler* get_scheduler() { return scheduler; }
20665e4060ea not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
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
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
110
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
111 #endif