changeset 1147:279b41354753 draft

add check code.
author Yutaka_Kinjyo
date Tue, 22 Feb 2011 23:16:31 +0900
parents 1fd472cd1ee9
children b4f8ec8b80a9
files Renderer/Engine/Makefile.def Renderer/Engine/viewer.cc TaskManager/Cell/CellTaskManagerImpl.cc TaskManager/Fifo/FifoTaskManagerImpl.cc TaskManager/Fifo/FifoTaskManagerImpl.h TaskManager/kernel/main.cc TaskManager/kernel/ppe/TaskManager.h TaskManager/kernel/ppe/TaskManagerImpl.cc TaskManager/kernel/ppe/TaskManagerImpl.h TaskManager/kernel/schedule/Scheduler.cc TaskManager/kernel/schedule/Scheduler.h
diffstat 11 files changed, 111 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/Renderer/Engine/Makefile.def	Mon Feb 21 04:30:40 2011 +0900
+++ b/Renderer/Engine/Makefile.def	Tue Feb 22 23:16:31 2011 +0900
@@ -5,7 +5,7 @@
 ABIBIT = 64 
 ABI = -m$(ABIBIT)
 CC      = g++
-OPT	=  -O9 #-g 
+OPT	=  -O9 -g 
 
 CFLAGS  = -Wall $(ABI) $(OPT)  #  -DDEBUG
 
--- a/Renderer/Engine/viewer.cc	Mon Feb 21 04:30:40 2011 +0900
+++ b/Renderer/Engine/viewer.cc	Tue Feb 22 23:16:31 2011 +0900
@@ -551,7 +551,8 @@
 
     light_sysswitch[0] = light_sysswitch_stock;
 
-    /*
+#if 1
+
     HTask *data_update_wait = 0;
     for (int i = 0; i < spe_num; i++) {
 	data_update_wait = manager->create_task(DataUpdate);
@@ -562,7 +563,9 @@
 	data_update_wait->set_inData(2,light_sysswitch,16);                       // LightSysSwitch = Light+2
         data_update_wait->set_cpu((CPU_TYPE)(SPE_0+i));
 	data_update_wait->spawn();
-	}*/
+	}
+
+#else
 
     HTask *data_update_wait = manager->create_task(Dummy);
     for (int i = 0; i < spe_num; i++) {
@@ -576,7 +579,9 @@
         data_update->set_cpu((CPU_TYPE)(SPE_0+i));
         data_update->wait_for(data_update_wait);
 	data_update->spawn();
-    }
+	}
+
+#endif
 
     ppi ^= 1; 
     r[ppi].ppack->clear();
@@ -631,7 +636,7 @@
 	  
 	  task_draw_array->spawn_task_array(task_draw->next());
 	  task_draw_array->set_cpu(SPE_ANY);
-	  task_draw_array->wait_for(data_update_wait);
+	  //task_draw_array->wait_for(data_update_wait);
 	  //task_next->wait_for(task_draw_array);
 	  task_draw_array->spawn();
 
@@ -694,7 +699,7 @@
 
     }
 
-    data_update_wait->spawn();
+    //data_update_wait->spawn();
 
     spi ^= 1; 
     for (int i = 1; i <= r[spi].spackList_length; i++) {
--- a/TaskManager/Cell/CellTaskManagerImpl.cc	Mon Feb 21 04:30:40 2011 +0900
+++ b/TaskManager/Cell/CellTaskManagerImpl.cc	Tue Feb 22 23:16:31 2011 +0900
@@ -261,6 +261,23 @@
 #else
 	    // 終了したタスク(PPEにあるのでアドレス)
 	    HTaskPtr task = (HTaskPtr)data;
+#ifndef NOT_CHECK
+	
+
+	    if (task != NULL) {
+	      //SPE で処理された Task が返ってくるはず。それがもし、type PPE なら・・・
+	      if (task->cpu_type == CPU_PPE) {
+		printf("attention : PPE task run on SPE\n");
+		printf("Task id : %d\n", task->command);
+		const char *name = get_task_name(task);
+		if (name != NULL) {	       
+		  printf("Task name : %s\n", name);
+		}
+	      }
+	    }
+
+#endif
+	    
 	    task->post_func(schedTaskManager, task->post_arg1, task->post_arg2);
 	    check_task_finish(task, waitTaskQueue);
 #endif
--- a/TaskManager/Fifo/FifoTaskManagerImpl.cc	Mon Feb 21 04:30:40 2011 +0900
+++ b/TaskManager/Fifo/FifoTaskManagerImpl.cc	Tue Feb 22 23:16:31 2011 +0900
@@ -228,6 +228,23 @@
             check_task_list_finish(schedTaskManager, list, waitTaskQueue);
 #else
             HTaskPtr task = (HTaskPtr)data;
+	    
+#ifndef NOT_CHECK
+	    
+	    if (task != NULL) {
+	      //PPE で処理された Task が返ってくるはず。
+	      if (task->cpu_type != CPU_PPE) {
+		printf("attention : SPE task run on PPE\n");
+		printf("Task id : %d\n", task->command);
+		const char *name = get_task_name(task);
+		if (name != NULL) {	       
+		  printf("Task name : %s\n", name);
+		}
+	      }
+	    }
+	    
+#endif
+
             task->post_func(schedTaskManager, task->post_arg1, task->post_arg2);
             check_task_finish(task, waitTaskQueue);
 #endif
@@ -287,7 +304,7 @@
 TaskManagerImpl*
 create_impl(int num)
 {
-    return new FifoTaskManagerImpl();
+    return new FifoTaskManagerImpl(num);
 }
 #endif // __CERIUM_FIFO__
 
--- a/TaskManager/Fifo/FifoTaskManagerImpl.h	Mon Feb 21 04:30:40 2011 +0900
+++ b/TaskManager/Fifo/FifoTaskManagerImpl.h	Tue Feb 22 23:16:31 2011 +0900
@@ -8,7 +8,7 @@
 class FifoTaskManagerImpl : public TaskManagerImpl {
 public:
     /* constructor */
-    FifoTaskManagerImpl(int num = 1) : TaskManagerImpl(num) {}
+    FifoTaskManagerImpl(int num) : TaskManagerImpl(num) {}
     ~FifoTaskManagerImpl(void);
 
     /* variables */
--- a/TaskManager/kernel/main.cc	Mon Feb 21 04:30:40 2011 +0900
+++ b/TaskManager/kernel/main.cc	Tue Feb 22 23:16:31 2011 +0900
@@ -33,7 +33,7 @@
 int
 main(int argc, char *argv[])
 {
-    int machineNum = 1;
+    int machineNum = 0;
     int speIdle = 0;
     int poll_pattern = 0;
 
--- a/TaskManager/kernel/ppe/TaskManager.h	Mon Feb 21 04:30:40 2011 +0900
+++ b/TaskManager/kernel/ppe/TaskManager.h	Tue Feb 22 23:16:31 2011 +0900
@@ -11,7 +11,7 @@
 class TaskManager {
 public:
     /* constructor */
-    TaskManager(int num = 1); // The number of threads
+    TaskManager(int num = 0); // The number of threads
     ~TaskManager();
 
     /* variables */
--- a/TaskManager/kernel/ppe/TaskManagerImpl.cc	Mon Feb 21 04:30:40 2011 +0900
+++ b/TaskManager/kernel/ppe/TaskManagerImpl.cc	Tue Feb 22 23:16:31 2011 +0900
@@ -121,10 +121,31 @@
 /* call get_task_name from ppu only */
 const char *
 TaskManagerImpl::get_task_name(int cmd) {
-	if (0 <= cmd && cmd < MAX_TASK_OBJECT)
-		return task_list[cmd].name;
-	else
-		return NULL;
+
+    if (0 <= cmd && cmd < MAX_TASK_OBJECT) {
+
+#ifndef NOT_CHECK
+
+	  int flag = 0;
+	  
+	  for (int i = 0; i < MAX_TASK_OBJECT; i++) {
+	    if (entry_cmd[i] == cmd) {
+	      flag = 1;
+	      break;
+	    }
+	  }
+
+	  if (flag == 0) {
+	    printf("cmd %d is not registered on task_list\n", cmd);
+	    return NULL;
+	  }
+			  
+#endif
+	  return task_list[cmd].name;
+    }
+    else {
+      return NULL;
+    }
 }
 const char *
 TaskManagerImpl::get_task_name(TaskPtr task) {
@@ -146,7 +167,9 @@
 }
 const char *
 TaskManagerImpl::get_task_name(HTaskPtr htask) {
-	return get_task_name(htask, 0);
+
+        return get_task_name(htask, 0);
+
 }
 const char *
 TaskManagerImpl::get_task_name(HTaskPtr htask, int index) {
@@ -156,13 +179,10 @@
 		return get_task_name((TaskPtr)htask->rbuf);
 		break;
 	case TaskArray: {
-		HTaskPtr t = htask->next;
-		for (int i = 0; i < index; i++) {
-			if (!t->next) return NULL;
-			t = t->next;
-		}
-		return get_task_name(t->command);
-		break;
+
+		TaskPtr tmp = (TaskPtr)htask->rbuf;
+		return get_task_name(tmp[0].command);
+
 	}
 	default:
 		return get_task_name(htask->command);
@@ -323,6 +343,7 @@
  */
 void
 TaskManagerImpl::set_taskList(HTaskPtr htask, QueueInfo<TaskList> * taskList) {
+
     TaskListPtr list ; 
     if ( taskList->empty() ) {
 	list = taskList->create();
--- a/TaskManager/kernel/ppe/TaskManagerImpl.h	Mon Feb 21 04:30:40 2011 +0900
+++ b/TaskManager/kernel/ppe/TaskManagerImpl.h	Tue Feb 22 23:16:31 2011 +0900
@@ -31,7 +31,7 @@
     TaskManagerImpl *others;
 
     /* constructor */
-    TaskManagerImpl(int num = 1) ;
+    TaskManagerImpl(int num) ;
 
     virtual ~TaskManagerImpl() { }
 
--- a/TaskManager/kernel/schedule/Scheduler.cc	Mon Feb 21 04:30:40 2011 +0900
+++ b/TaskManager/kernel/schedule/Scheduler.cc	Tue Feb 22 23:16:31 2011 +0900
@@ -16,6 +16,11 @@
 
 TaskObject task_list[MAX_TASK_OBJECT];
 
+#ifndef NOT_CHECK
+int entry_cmd[MAX_TASK_OBJECT];
+int task_count = 0;
+#endif
+
 Scheduler::~Scheduler()
 {
     delete connector;
@@ -38,10 +43,19 @@
 {
     hash = 0;
 
+#ifndef NOT_CHECK
+    task_count = 0;
+#endif
+
     for (int i = 0; i< MAX_TASK_OBJECT; i++) {
 	task_list[i].run = null_run;
 	task_list[i].load = null_loader;
 	task_list[i].wait = null_loader;
+
+#ifndef NOT_CHECK
+	entry_cmd[i] = NULL;
+#endif
+
     }
 
     set_manager(m);
@@ -303,7 +317,12 @@
     task_list[cmd].run = run;
     task_list[cmd].load = null_loader;
     task_list[cmd].wait = null_waiter;
-	task_list[cmd].name = str;
+    task_list[cmd].name = str;
+
+#ifndef NOT_CHECK
+    entry_cmd[task_count++] = cmd;    
+#endif
+
 }
 
 extern void 
@@ -319,7 +338,12 @@
     task_list[cmd].entry_offset = entry_offset;
     task_list[cmd].load = load_task;
     task_list[cmd].wait = wait_load;
-	task_list[cmd].name = str;
+    task_list[cmd].name = str;
+
+#ifndef NOT_CHECK
+    entry_cmd[task_count++] = cmd;    
+#endif
+
 #if 0
 this->printf("cmd        = %d\n",cmd);
 this->printf("locatation = 0x%x\n",start);
--- a/TaskManager/kernel/schedule/Scheduler.h	Mon Feb 21 04:30:40 2011 +0900
+++ b/TaskManager/kernel/schedule/Scheduler.h	Tue Feb 22 23:16:31 2011 +0900
@@ -40,7 +40,7 @@
 	const char *name;
     void (*load)(Scheduler *,int);
     void (*wait)(Scheduler *,int);
-}  __attribute__ ((aligned (DEFAULT_ALIGNMENT)))
+}  __attribute__ ((aligned (DEFAULT_ALIGNMENT))) //sizeはどれくらい?
       TaskObject, *TaskObjectPtr;
 
 extern "C" {
@@ -163,6 +163,7 @@
 }; 
 
 extern TaskObject task_list[MAX_TASK_OBJECT];
+extern int entry_cmd[MAX_TASK_OBJECT];
 
 inline void
 loadSchedTask(Scheduler *scheduler,int command)