annotate TaskManager/kernel/ppe/TaskManagerImpl.cc @ 1465:fc5b23108608 draft

TaskList on going...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 15 Jul 2012 09:56:54 +0900
parents 3f2230d79eba
children cb57420a8219
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1142
801d57ae1e29 cut compile CreatePolygonTask on spe side because not enough spe memory. We have to use code loading.
yutaka@localhost.localdomain
parents: 1064
diff changeset
1 //#include <stdio.h>
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
2 #include "TaskManagerImpl.h"
46
f154d9d07a42 *** empty log message ***
gongo
parents: 42
diff changeset
3 #include "types.h"
f154d9d07a42 *** empty log message ***
gongo
parents: 42
diff changeset
4 #include "error.h"
546
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
5 #include "SchedTask.h"
619
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
6 #include "Scheduler.h"
634
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
7 #include "SysTask.h"
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
8 #include "SysFunc.h"
1423
515a0f15b5d2 add to log taskdependency
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1230
diff changeset
9 #include "rdtsc.h"
806
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
10 #include <string.h>
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
11
955
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 949
diff changeset
12 // singleton
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 949
diff changeset
13 QueueInfo<TaskQueue> *taskQueuePool = new QueueInfo<TaskQueue>() ;
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 949
diff changeset
14 QueueInfo<HTask> *htaskPool = new QueueInfo<HTask>() ;
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 949
diff changeset
15 QueueInfo<TaskList> *taskListPool = new QueueInfo<TaskList>() ;
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 949
diff changeset
16
220
gongo@localhost.localdomain
parents: 115
diff changeset
17 static HTaskPtr systask_start;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
18 static HTaskPtr systask_finish;
42
aa11038dbdc1 *** empty log message ***
gongo
parents: 18
diff changeset
19
550
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
20 static void
a9f27334963a old ball_bound fix...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 539
diff changeset
21 noaction(SchedTask *s, void *read, void *write)
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
22 {
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
23 }
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
24
835
yutaka@localhost.localdomain
parents: 833
diff changeset
25 TaskManagerImpl::TaskManagerImpl(int num)
yutaka@localhost.localdomain
parents: 833
diff changeset
26 : machineNum(num){
853
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 835
diff changeset
27 // 実行可能なHTaskのリスト
955
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 949
diff changeset
28 activeTaskQueue = new QueueInfo<HTask>(htaskPool);
853
game@zeus.cr.ie.u-ryukyu.ac.jp
parents: 835
diff changeset
29 // wait_forで止まっているHTaskのリスト。必要ないが、Dead lock detection に使う
955
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 949
diff changeset
30 waitTaskQueue = new QueueInfo<HTask>(htaskPool);
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 949
diff changeset
31 // HTask の factory. QueueInfo<HTask> ならなんでもいい。
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 949
diff changeset
32 htaskImpl = waitTaskQueue ; // any QueueInfo<HTask>
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 949
diff changeset
33 // Task の dependency を表現する double linked list. QueueInfo<HTask> とは別に必要。
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 949
diff changeset
34 taskQueueImpl = new QueueInfo<TaskQueue>(taskQueuePool);
1423
515a0f15b5d2 add to log taskdependency
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1230
diff changeset
35
480
75e4afa40da2 TaskQueueInfo initiaization...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 479
diff changeset
36 }
50
7927e00fb8e2 *** empty log message ***
gongo
parents: 48
diff changeset
37
220
gongo@localhost.localdomain
parents: 115
diff changeset
38 /**
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
39 * 一番最初に PPE で実行される systask_start
220
gongo@localhost.localdomain
parents: 115
diff changeset
40 */
42
aa11038dbdc1 *** empty log message ***
gongo
parents: 18
diff changeset
41 void
499
981aa2f89a80 still fixing...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 498
diff changeset
42 TaskManagerImpl::systask_init()
42
aa11038dbdc1 *** empty log message ***
gongo
parents: 18
diff changeset
43 {
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
44 systask_register();
897
6bd218d3f643 add return address in SimpleTask for debugging.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 855
diff changeset
45 systask_start = create_task(StartTask,0,0,0,0,__builtin_return_address(0));
6bd218d3f643 add return address in SimpleTask for debugging.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 855
diff changeset
46 systask_finish = create_task(FinishTask,0,0,0,0,__builtin_return_address(0));
220
gongo@localhost.localdomain
parents: 115
diff changeset
47
gongo@localhost.localdomain
parents: 115
diff changeset
48 systask_start->spawn();
gongo@localhost.localdomain
parents: 115
diff changeset
49
634
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
50 // すべての Task が FinishTask を wait_for すると、
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
51 // あらゆる Task が FinishTask の waiting task queue を操作する
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
52 // ことになる。それは、重すぎる。PPE/SPE Task が終了した時点で、
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
53 // TaskManager が実行する方が安い。
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
54 // append_waitTask(systask_finish);
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
55 }
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
56
945
9ed1c4a877ca sort example fix ( simple task accepts one param and more compatible with old task)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
57 /**
9ed1c4a877ca sort example fix ( simple task accepts one param and more compatible with old task)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
58 * Create Simple Task
9ed1c4a877ca sort example fix ( simple task accepts one param and more compatible with old task)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
59 */
634
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
60 HTaskPtr
897
6bd218d3f643 add return address in SimpleTask for debugging.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 855
diff changeset
61 TaskManagerImpl::create_task(int cmd,memaddr rbuf, long r_size, memaddr wbuf, long w_size, void *from) {
1465
fc5b23108608 TaskList on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1464
diff changeset
62 HTaskPtr new_task = htaskImpl->create();
955
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 949
diff changeset
63 new_task->init(cmd, rbuf, r_size, wbuf, w_size);
1465
fc5b23108608 TaskList on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1464
diff changeset
64 new_task->mimpl = this;
fc5b23108608 TaskList on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1464
diff changeset
65 new_task->create_task_array(cmd, 1, 8, 8, 8) ;
634
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
66 new_task->post_func = noaction;
897
6bd218d3f643 add return address in SimpleTask for debugging.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 855
diff changeset
67 new_task->from = (memaddr)from;
1423
515a0f15b5d2 add to log taskdependency
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1230
diff changeset
68
515a0f15b5d2 add to log taskdependency
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1230
diff changeset
69 TaskLog *tasklog = new TaskLog();
1424
0ce6c6880b4b change to the queue form the list.
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1423
diff changeset
70 taskLogQueue.addLast(tasklog);
1423
515a0f15b5d2 add to log taskdependency
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1230
diff changeset
71 new_task->tasklog = tasklog;
515a0f15b5d2 add to log taskdependency
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1230
diff changeset
72
949
5f0135ca75ee word count size fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 945
diff changeset
73 #ifdef EARLY_TOUCH
5f0135ca75ee word count size fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 945
diff changeset
74 if (rbuf) {
5f0135ca75ee word count size fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 945
diff changeset
75 if ((unsigned long)rbuf&0xf) {
1152
df293d433633 measure
yutaka@localhost.localdomain
parents: 1147
diff changeset
76 printf("Data is not aligned. command = %d, addr = 0x%lx, size = %ld\n",
949
5f0135ca75ee word count size fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 945
diff changeset
77 cmd, (unsigned long)rbuf, r_size);
5f0135ca75ee word count size fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 945
diff changeset
78 }
5f0135ca75ee word count size fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 945
diff changeset
79 char *p = (char *)rbuf; char b = *p;
5f0135ca75ee word count size fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 945
diff changeset
80 p = (char *)(rbuf+r_size-1); b += *p;
5f0135ca75ee word count size fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 945
diff changeset
81 }
5f0135ca75ee word count size fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 945
diff changeset
82 if (wbuf) {
5f0135ca75ee word count size fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 945
diff changeset
83 if ((unsigned long)wbuf&0xf) {
1152
df293d433633 measure
yutaka@localhost.localdomain
parents: 1147
diff changeset
84 printf("Data is not aligned. command = %d, addr = 0x%lx, size = %ld\n",
949
5f0135ca75ee word count size fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 945
diff changeset
85 cmd, (unsigned long)wbuf, w_size);
5f0135ca75ee word count size fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 945
diff changeset
86 }
5f0135ca75ee word count size fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 945
diff changeset
87 char *p = (char *)wbuf; char b = *p;
5f0135ca75ee word count size fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 945
diff changeset
88 p = (char *)(wbuf+w_size-1); b += *p;
5f0135ca75ee word count size fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 945
diff changeset
89 }
5f0135ca75ee word count size fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 945
diff changeset
90 #endif
634
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
91
62e570ac5db2 SimpleTask start
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
92 return new_task;
42
aa11038dbdc1 *** empty log message ***
gongo
parents: 18
diff changeset
93 }
aa11038dbdc1 *** empty log message ***
gongo
parents: 18
diff changeset
94
945
9ed1c4a877ca sort example fix ( simple task accepts one param and more compatible with old task)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
95 /**
9ed1c4a877ca sort example fix ( simple task accepts one param and more compatible with old task)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
96 * Create Compatible Task (TaskArray1)
9ed1c4a877ca sort example fix ( simple task accepts one param and more compatible with old task)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
97 */
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
98 HTaskPtr
897
6bd218d3f643 add return address in SimpleTask for debugging.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 855
diff changeset
99 TaskManagerImpl::create_task(int cmd,void *from)
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
100 {
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
101
1465
fc5b23108608 TaskList on going...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1464
diff changeset
102 HTaskPtr new_task = create_task(TaskArray,0,0,0,0, from);
703
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
103 new_task->post_func = noaction;
0c8ad8d99656 compatibility
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
104 new_task->mimpl = this;
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 719
diff changeset
105 new_task->create_task_array(cmd,1,8,8,8);
713
97adb3fe85c6 remove SIMPLE_TASK conditional
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 704
diff changeset
106 // rbuf, r_size were set
704
ec6c897448ca Compatibility mode works.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 703
diff changeset
107 new_task->command = TaskArray1;
897
6bd218d3f643 add return address in SimpleTask for debugging.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 855
diff changeset
108 new_task->from = (memaddr)from;
63
54355e641172 *** empty log message ***
gongo
parents: 58
diff changeset
109
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
110 return new_task;
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
111 }
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
112
945
9ed1c4a877ca sort example fix ( simple task accepts one param and more compatible with old task)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
113 /**
9ed1c4a877ca sort example fix ( simple task accepts one param and more compatible with old task)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
114 * Create Task Array
9ed1c4a877ca sort example fix ( simple task accepts one param and more compatible with old task)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 941
diff changeset
115 */
800
54f0180cea0f run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 736
diff changeset
116 HTaskPtr
897
6bd218d3f643 add return address in SimpleTask for debugging.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 855
diff changeset
117 TaskManagerImpl::create_task_array(int id, int num_task, int num_param, int num_inData, int num_outData, void *from)
800
54f0180cea0f run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 736
diff changeset
118 {
897
6bd218d3f643 add return address in SimpleTask for debugging.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 855
diff changeset
119 HTaskPtr ta = create_task(TaskArray,0,0,0,0, from);
800
54f0180cea0f run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 736
diff changeset
120 ta->create_task_array(id, num_task, num_param, num_inData, num_outData) ;
54f0180cea0f run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 736
diff changeset
121 return ta;
54f0180cea0f run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 736
diff changeset
122 }
54f0180cea0f run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 736
diff changeset
123
1062
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
124 /* call get_task_name from ppu only */
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
125 const char *
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
126 TaskManagerImpl::get_task_name(int cmd) {
1147
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
127
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
128 if (0 <= cmd && cmd < MAX_TASK_OBJECT) {
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
129
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
130 #ifndef NOT_CHECK
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
131
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
132 int flag = 0;
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
133
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
134 for (int i = 0; i < MAX_TASK_OBJECT; i++) {
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
135 if (entry_cmd[i] == cmd) {
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
136 flag = 1;
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
137 break;
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
138 }
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
139 }
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
140
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
141 if (flag == 0) {
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
142 printf("cmd %d is not registered on task_list\n", cmd);
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
143 return NULL;
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
144 }
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
145
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
146 #endif
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
147 return task_list[cmd].name;
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
148 }
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
149 else {
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
150 return NULL;
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
151 }
1062
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
152 }
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
153 const char *
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
154 TaskManagerImpl::get_task_name(TaskPtr task) {
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
155 return task != NULL ? get_task_name(task->command) : NULL;
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
156 }
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
157 const char *
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
158 TaskManagerImpl::get_task_name(SimpleTaskPtr simple_task) {
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
159 return simple_task != NULL ? get_task_name(simple_task->command) : NULL;
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
160 }
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
161 const char *
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
162 TaskManagerImpl::get_task_name(SchedTaskBase *sched_task) {
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
163 if (sched_task == NULL) return NULL;
1464
3f2230d79eba TaskList no compile errors
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1462
diff changeset
164 if (sched_task->atask != NULL) {
3f2230d79eba TaskList no compile errors
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1462
diff changeset
165 return get_task_name(sched_task->atask->command);
1062
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
166 }
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
167 return NULL;
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
168 }
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
169 const char *
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
170 TaskManagerImpl::get_task_name(HTaskPtr htask) {
1147
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
171
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
172 return get_task_name(htask, 0);
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
173
1062
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
174 }
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
175 const char *
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
176 TaskManagerImpl::get_task_name(HTaskPtr htask, int index) {
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
177 if (!htask) return NULL;
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
178 switch (htask->command) {
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
179 case TaskArray1:
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
180 return get_task_name((TaskPtr)htask->rbuf);
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
181 break;
1064
23dab670c5aa TaskManagerImpl::get_task_name() fix in header file...
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 1062
diff changeset
182 case TaskArray: {
1147
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
183
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
184 TaskPtr tmp = (TaskPtr)htask->rbuf;
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
185 return get_task_name(tmp[0].command);
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
186
1064
23dab670c5aa TaskManagerImpl::get_task_name() fix in header file...
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 1062
diff changeset
187 }
1062
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
188 default:
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
189 return get_task_name(htask->command);
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
190 }
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
191 return NULL;
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
192 }
f994f5032299 add TaskManagerImpl::get_task_name()
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 955
diff changeset
193
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
194 /**
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
195 * task の依存関係を設定
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
196 * master task が終わってから、slave task を実行するように
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
197 * master->wait_for(slave);
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
198 */
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
199 void
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
200 TaskManagerImpl::set_task_depend(HTaskPtr master, HTaskPtr slave)
547
e5431e658038 continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
201 {
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
202 TaskQueuePtr m, s;
941
fc6cfaae6de7 add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 940
diff changeset
203 if (!master->self) return;
547
e5431e658038 continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
204
955
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 949
diff changeset
205 m = taskQueueImpl->create(); m->init(master);
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 949
diff changeset
206 s = taskQueueImpl->create(); s->init(slave);
547
e5431e658038 continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
207
479
bf2d2625485e Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 475
diff changeset
208 master->wait_me->addLast(s);
bf2d2625485e Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 475
diff changeset
209 slave->wait_i->addLast(m);
481
f9ffcffb6d09 Double linked list modification done (tested on Mac OS X)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 480
diff changeset
210 s->waiter = m;
547
e5431e658038 continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
211 }
e5431e658038 continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 546
diff changeset
212
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
213 /**
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
214 * タスクを実行可能キューまたは待機キューへ追加する。
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
215 * 依存関係が満たされていれば active, まだだったら wait へ。
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
216 * task->spawn();
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
217 */
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
218 void
18
0c9341da4522 *** empty log message ***
gongo
parents: 5
diff changeset
219 TaskManagerImpl::spawn_task(HTaskPtr task)
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
220 {
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
221 // waiter // master
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
222 // waitee // slave
480
75e4afa40da2 TaskQueueInfo initiaization...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 479
diff changeset
223 if (task->wait_i->empty()) {
498
bce667ff20b9 double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 497
diff changeset
224 append_activeTask(task);
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
225 } else {
498
bce667ff20b9 double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 497
diff changeset
226 append_waitTask(task);
3
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
227 }
2356238ebea7 *** empty log message ***
gongo
parents:
diff changeset
228 }
42
aa11038dbdc1 *** empty log message ***
gongo
parents: 18
diff changeset
229
800
54f0180cea0f run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 736
diff changeset
230
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
231 /**
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
232 * Task を実行可能キューに追加する
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
233 */
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
234 void
498
bce667ff20b9 double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 497
diff changeset
235 TaskManagerImpl::append_activeTask(HTaskPtr q)
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
236 {
479
bf2d2625485e Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 475
diff changeset
237 activeTaskQueue->addLast(q);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
238 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
239
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
240 /**
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
241 * タスクが実行する CPU を選択する
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
242 *
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
243 * 現在は CPU_PPE, CPU_SPE, SPE_ANY, SPE_0, SPE_1, ..., SPE_5
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
244 * types.h に書いてます。
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
245 */
65
519d24aa7ac8 *** empty log message ***
gongo
parents: 63
diff changeset
246 void
519d24aa7ac8 *** empty log message ***
gongo
parents: 63
diff changeset
247 TaskManagerImpl::set_task_cpu(HTaskPtr task, CPU_TYPE type)
519d24aa7ac8 *** empty log message ***
gongo
parents: 63
diff changeset
248 {
664
beb0f17c19f9 word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
249 if (machineNum==0)
beb0f17c19f9 word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
250 task->cpu_type = CPU_PPE ;
beb0f17c19f9 word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
251 else
beb0f17c19f9 word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 647
diff changeset
252 task->cpu_type = type;
65
519d24aa7ac8 *** empty log message ***
gongo
parents: 63
diff changeset
253 }
519d24aa7ac8 *** empty log message ***
gongo
parents: 63
diff changeset
254
940
e01b551f25d6 unknown dead lock still...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 939
diff changeset
255 #if 0
e01b551f25d6 unknown dead lock still...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 939
diff changeset
256 static void
955
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 949
diff changeset
257 check_wait(TaskManagerImpl *tm, QueueInfo<TaskQueue> *wait_i) {
940
e01b551f25d6 unknown dead lock still...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 939
diff changeset
258 for(TaskQueue *t = wait_i->getFirst(); t; t = wait_i->getNext(t)) {
e01b551f25d6 unknown dead lock still...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 939
diff changeset
259 if (!tm->waitTaskQueue->find(t->task)) {
1152
df293d433633 measure
yutaka@localhost.localdomain
parents: 1147
diff changeset
260 //this->printf("stray waiting task%d %lx\n",t->task->command, (long)t->task);
df293d433633 measure
yutaka@localhost.localdomain
parents: 1147
diff changeset
261 printf("stray waiting task%d %lx\n",t->task->command, (long)t->task);
940
e01b551f25d6 unknown dead lock still...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 939
diff changeset
262 } else if (tm->activeTaskQueue->find(t->task)) {
1152
df293d433633 measure
yutaka@localhost.localdomain
parents: 1147
diff changeset
263 //this->printf(" active task%d in waiting queue %lx\n",t->task->command, (long)t->task);
df293d433633 measure
yutaka@localhost.localdomain
parents: 1147
diff changeset
264 printf(" active task%d in waiting queue %lx\n",t->task->command, (long)t->task);
940
e01b551f25d6 unknown dead lock still...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 939
diff changeset
265 } else
1152
df293d433633 measure
yutaka@localhost.localdomain
parents: 1147
diff changeset
266 printf(".");
940
e01b551f25d6 unknown dead lock still...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 939
diff changeset
267 }
e01b551f25d6 unknown dead lock still...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 939
diff changeset
268 }
e01b551f25d6 unknown dead lock still...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 939
diff changeset
269 #endif
e01b551f25d6 unknown dead lock still...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 939
diff changeset
270
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
271 /**
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
272 * @brief 終了したタスクから依存の処理とか
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
273 * post_func() はこのタスクが終了したら実行する関数。
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
274 *
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 220
diff changeset
275 * @param [task] 終了したタスク
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
276 */
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
277 void
955
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 949
diff changeset
278 TaskManagerImpl::check_task_finish(HTaskPtr me, QueueInfo<HTask> *wait_queue)
42
aa11038dbdc1 *** empty log message ***
gongo
parents: 18
diff changeset
279 {
1423
515a0f15b5d2 add to log taskdependency
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1230
diff changeset
280 me->tasklog->finish_time = rdtsc();
515a0f15b5d2 add to log taskdependency
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1230
diff changeset
281
497
3429986b8a28 no wakeup loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 496
diff changeset
282 while(TaskQueue *p = me->wait_me->poll()) {
499
981aa2f89a80 still fixing...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 498
diff changeset
283 HTaskPtr you = p->task;
955
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 949
diff changeset
284 QueueInfo<TaskQueue> *wait_i = you->wait_i;
479
bf2d2625485e Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 475
diff changeset
285 // 相手の wait queue から自分(を指しているTaskQueue)を削除
bf2d2625485e Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 475
diff changeset
286 wait_i->remove(p->waiter);
bf2d2625485e Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 475
diff changeset
287 // queue を free する
493
2a7a9f80b8e7 fix free conflict.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
288 wait_i->free_(p->waiter);
483
5f4ffff2c2aa renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 481
diff changeset
289
497
3429986b8a28 no wakeup loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 496
diff changeset
290 if (wait_i->empty()) {
647
7ba4ad4538b1 MailManager rewrite. not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 639
diff changeset
291 wait_queue->remove(you);
499
981aa2f89a80 still fixing...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 498
diff changeset
292 append_activeTask(you);
497
3429986b8a28 no wakeup loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 496
diff changeset
293 }
3429986b8a28 no wakeup loop
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 496
diff changeset
294
940
e01b551f25d6 unknown dead lock still...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 939
diff changeset
295 wait_i->free_(p); // p->wait_i, p->wait_me は再利用される
479
bf2d2625485e Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 475
diff changeset
296 }
bf2d2625485e Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 475
diff changeset
297
1169
b93ff55ba015 free TaskArray rbuf
Yutaka_Kinjyo
parents: 1152
diff changeset
298 // TaskArray1 の場合、Task,rbuf共にtasklistに入る。
b93ff55ba015 free TaskArray rbuf
Yutaka_Kinjyo
parents: 1152
diff changeset
299 // tasklistはどこかでfreeされてるはずなので、メモリリークしない。
b93ff55ba015 free TaskArray rbuf
Yutaka_Kinjyo
parents: 1152
diff changeset
300 // TaskArray の rbuf はfreeされない見たいなので、ここでfreeしてみる。
1227
bb75ee244826 exile free on fifo
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents: 1169
diff changeset
301
1228
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents: 1227
diff changeset
302
1230
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents: 1228
diff changeset
303 if (me->command == TaskArray) {
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents: 1228
diff changeset
304 free(me->rbuf);
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents: 1228
diff changeset
305 }
1169
b93ff55ba015 free TaskArray rbuf
Yutaka_Kinjyo
parents: 1152
diff changeset
306
939
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 897
diff changeset
307 // me を誰かが持っていて、me が finish した後に、
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 897
diff changeset
308 // me->wait_for(i) とか、やられると気まずい。
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 897
diff changeset
309 // 特に、me が他人に再利用されていると。そういう時には、
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 897
diff changeset
310 // このfreeをコメントアウトしてみる。
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 897
diff changeset
311
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 897
diff changeset
312 // id かななんかでチェックした方が良いが...
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 897
diff changeset
313
aafa99c856a3 loop detection.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 897
diff changeset
314 me->self = 0;
941
fc6cfaae6de7 add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 940
diff changeset
315 if (!me->flag.no_auto_free)
fc6cfaae6de7 add no_auto_free flag on HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 940
diff changeset
316 htaskImpl->free_(me);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
317 }
42
aa11038dbdc1 *** empty log message ***
gongo
parents: 18
diff changeset
318
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
319 /**
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
320 * @brief 終了したタスクリストの依存の処理
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
321 * @param [task] 終了したタスク
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
322 */
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
323 void
955
6ffeb543e8d4 unify all QueueInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 949
diff changeset
324 TaskManagerImpl::check_task_list_finish(SchedTask *s, TaskListPtr list, QueueInfo<HTask> *wait_queue)
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
325 {
1462
8cf62aea798f HTask/TaskList fix (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1424
diff changeset
326 HTask *me = list->self;
8cf62aea798f HTask/TaskList fix (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1424
diff changeset
327 if (me) {
8cf62aea798f HTask/TaskList fix (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1424
diff changeset
328 me->post_func(s, me->post_arg1, me->post_arg2);
8cf62aea798f HTask/TaskList fix (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1424
diff changeset
329 check_task_finish(me, wait_queue);
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
330 }
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
331 }
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
332
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
333 /**
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
334 * @brief waitTaskqueue への挿入 。必須ではない。
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
335 * 現状では、dead lock 検出にしか使ってない
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
336 *
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
337 * @param [task] 終了したタスク
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
338 */
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
339 void
498
bce667ff20b9 double linked HTaskInfo/HTask
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 497
diff changeset
340 TaskManagerImpl::append_waitTask(HTaskPtr q)
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
341 {
479
bf2d2625485e Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 475
diff changeset
342 waitTaskQueue ->addLast(q);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
343 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 94
diff changeset
344
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
345 /**
1462
8cf62aea798f HTask/TaskList fix (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1424
diff changeset
346 @brief htask のTaskListを DMA でCPUに渡すための TaskListQueue に入れる
830
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
347 @param htask
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
348 @param taskList
af2fb2e641eb return TaskList->self
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 809
diff changeset
349 */
806
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
350 void
1423
515a0f15b5d2 add to log taskdependency
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1230
diff changeset
351 TaskManagerImpl::set_taskList(HTaskPtr htask, QueueInfo<TaskList> * taskList)
515a0f15b5d2 add to log taskdependency
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1230
diff changeset
352 {
515a0f15b5d2 add to log taskdependency
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1230
diff changeset
353 htask->tasklog->execute_time = rdtsc();
515a0f15b5d2 add to log taskdependency
Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
parents: 1230
diff changeset
354
1462
8cf62aea798f HTask/TaskList fix (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1424
diff changeset
355 TaskListPtr tl = (TaskList*)htask->rbuf;
8cf62aea798f HTask/TaskList fix (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1424
diff changeset
356 while(tl->prev) tl=tl->prev;
8cf62aea798f HTask/TaskList fix (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1424
diff changeset
357 while(tl) {
8cf62aea798f HTask/TaskList fix (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1424
diff changeset
358 TaskListPtr next = tl->next;
8cf62aea798f HTask/TaskList fix (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1424
diff changeset
359 taskList->addLast(tl);
8cf62aea798f HTask/TaskList fix (on going)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1424
diff changeset
360 tl = next;
806
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
361 }
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
362 }
fb49e881f2ed TaslListInfo
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 800
diff changeset
363
54
90523ccc4dff *** empty log message ***
gongo
parents: 50
diff changeset
364
619
278db3ca751d RenewTask removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 567
diff changeset
365
479
bf2d2625485e Double Linked List base TaskQueue
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 475
diff changeset
366 /* end */