annotate TaskManager/kernel/ppe/TaskManagerImpl.h @ 719:cafffff0f45a

clean up scheduler main loop
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 19 Dec 2009 10:34:43 +0900
parents 3b6290c05f9f
children 31d0a5baafdf
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
7075842aa155 clean up include
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 109
diff changeset
4 #include "MailManager.h"
7075842aa155 clean up include
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 109
diff changeset
5 #include "ListData.h"
475
e083c4ff91c1 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
6 #include "TaskListInfo.h"
e083c4ff91c1 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
7 #include "TaskQueueInfo.h"
e083c4ff91c1 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
8 #include "HTaskInfo.h"
619
0decff4e867b RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
9 class Scheduler;
0decff4e867b RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
10 class MemList;
475
e083c4ff91c1 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
11
54
90523ccc4dff *** empty log message ***
gongo
parents: 50
diff changeset
12
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
13 class TaskManagerImpl {
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
14 public:
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
15
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
16 /* variables */
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
17 int machineNum;
498
cb5ecfc5aaa3 double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 496
diff changeset
18 HTaskInfo *activeTaskQueue;
cb5ecfc5aaa3 double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 496
diff changeset
19 HTaskInfo *waitTaskQueue;
475
e083c4ff91c1 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
20
e083c4ff91c1 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
21 TaskListInfo *taskListImpl;
e083c4ff91c1 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
22 TaskQueueInfo *taskQueueImpl;
e083c4ff91c1 BufferManager removed.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
23 HTaskInfo *htaskImpl;
619
0decff4e867b RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
24
514
2659376067e8 old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 507
diff changeset
25 SchedTask *schedTaskManager;
637
5530fa36d42e not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
26 Scheduler *scheduler;
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
27
480
46464727d825 TaskQueueInfo initiaization...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 479
diff changeset
28 /* constructor */
46464727d825 TaskQueueInfo initiaization...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 479
diff changeset
29 TaskManagerImpl(int num = 1) ;
46464727d825 TaskQueueInfo initiaization...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 479
diff changeset
30
46464727d825 TaskQueueInfo initiaization...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 479
diff changeset
31 virtual ~TaskManagerImpl() { }
46464727d825 TaskQueueInfo initiaization...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 479
diff changeset
32
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
33 /* functions */
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
34 // system
480
46464727d825 TaskQueueInfo initiaization...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 479
diff changeset
35 virtual void init() = 0;
46464727d825 TaskQueueInfo initiaization...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 479
diff changeset
36 virtual void run() = 0;
672
3b6290c05f9f add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 666
diff changeset
37 virtual void start_profile() = 0;
3b6290c05f9f add profiling code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 666
diff changeset
38 virtual void show_profile() = 0;
498
cb5ecfc5aaa3 double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 496
diff changeset
39 virtual void append_activeTask(HTaskPtr);
cb5ecfc5aaa3 double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 496
diff changeset
40 virtual void append_waitTask(HTaskPtr);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
41
647
7c9ded1ea750 MailManager rewrite. not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 637
diff changeset
42 void check_task_finish(HTaskPtr task, HTaskInfo *wait_queue);
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
43
480
46464727d825 TaskQueueInfo initiaization...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 479
diff changeset
44 void systask_init();
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
45
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 88
diff changeset
46 // user
637
5530fa36d42e not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
47 virtual HTaskPtr create_task(int cmd);
5530fa36d42e not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
48 virtual HTaskPtr create_task(int cmd, memaddr rbuf, long r_size, memaddr wbuf, long w_size);
5530fa36d42e not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
49 virtual void set_task_depend(HTaskPtr master, HTaskPtr slave);
5530fa36d42e not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
50 virtual void spawn_task(HTaskPtr);
5530fa36d42e not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
51 virtual void set_task_cpu(HTaskPtr, CPU_TYPE);
619
0decff4e867b RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
52
637
5530fa36d42e not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
53 void* allocate(int size, int alignment)
5530fa36d42e not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
54 {
666
4615489c5faa simplify word_count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
55 void *buff;
637
5530fa36d42e not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
56 if (size==0) return 0;
666
4615489c5faa simplify word_count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
57 #if defined(__SPU__) || ! defined(HAS_POSIX_MEMALIGN)
4615489c5faa simplify word_count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
58 buff = malloc(size);
4615489c5faa simplify word_count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
59 #else
637
5530fa36d42e not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
60 posix_memalign(&buff, alignment, size);
666
4615489c5faa simplify word_count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
61 #endif
4615489c5faa simplify word_count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
62 if (buff==0) fprintf(stderr,"Can't allocate memory\n");
637
5530fa36d42e not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
63 return buff;
5530fa36d42e not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
64 }
5530fa36d42e not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
65
5530fa36d42e not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
66 void* allocate(int size)
5530fa36d42e not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
67 {
666
4615489c5faa simplify word_count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
68 void *buff;
637
5530fa36d42e not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
69 if (size==0) return 0;
666
4615489c5faa simplify word_count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
70 #if defined(__SPU__) || ! defined(HAS_POSIX_MEMALIGN)
4615489c5faa simplify word_count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
71 buff = malloc(size);
4615489c5faa simplify word_count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
72 #else
637
5530fa36d42e not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
73 posix_memalign(&buff, DEFAULT_ALIGNMENT, size);
666
4615489c5faa simplify word_count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
74 #endif
4615489c5faa simplify word_count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
75 if (buff==0) fprintf(stderr,"Can't allocate memory\n");
637
5530fa36d42e not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
76 return buff;
5530fa36d42e not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
77 }
5530fa36d42e not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
78
5530fa36d42e not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
79 Scheduler* get_scheduler() { return scheduler; }
5530fa36d42e not yet worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 636
diff changeset
80 void set_scheduler(Scheduler *s) { scheduler = s; }
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
81 };
619
0decff4e867b RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
82
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
83 #endif