changeset 1479:163220e54cc0 draft

remove hard code for TaskLog
author Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp>
date Tue, 24 Jul 2012 17:15:15 +0900
parents beda5f2f88ce
children f2512fb94223
files TaskManager/Cell/CellTaskManagerImpl.cc TaskManager/Cell/CellTaskManagerImpl.h TaskManager/Cell/spe/SpeTaskManagerImpl.cc TaskManager/Cell/spe/SpeTaskManagerImpl.h TaskManager/Fifo/FifoTaskManagerImpl.cc TaskManager/Fifo/FifoTaskManagerImpl.h TaskManager/kernel/main.cc TaskManager/kernel/ppe/HTask.cc TaskManager/kernel/ppe/HTask.h TaskManager/kernel/ppe/TaskManager.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 15 files changed, 46 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Cell/CellTaskManagerImpl.cc	Fri Jul 20 05:47:14 2012 +0900
+++ b/TaskManager/Cell/CellTaskManagerImpl.cc	Tue Jul 24 17:15:15 2012 +0900
@@ -23,7 +23,7 @@
 	delete ppeManager;
 }
 
-void CellTaskManagerImpl::init(int spuIdle_,int useRefDma) {
+void CellTaskManagerImpl::init(int spuIdle_,int useRefDma,int export_task_log) {
 	spe_running = 0;
 	spuIdle = spuIdle_;
 
@@ -60,6 +60,8 @@
 	schedTaskManager = new SchedTask();
 	schedTaskManager->init(0, 0, ppeManager->get_scheduler(), 0);
 	ppeManager->schedTaskManager = schedTaskManager;
+
+        _export_task_log = export_task_log;
 }
 
 void CellTaskManagerImpl::append_activeTask(HTaskPtr task) {
--- a/TaskManager/Cell/CellTaskManagerImpl.h	Fri Jul 20 05:47:14 2012 +0900
+++ b/TaskManager/Cell/CellTaskManagerImpl.h	Tue Jul 24 17:15:15 2012 +0900
@@ -26,7 +26,7 @@
 
     /* functions */
     // system
-    void init(int spuIdle,int useRefDma);
+    void init(int spuIdle,int useRefDma, int export_task_log);
     void run();
     void poll();
     void poll1(int spu_limit);
--- a/TaskManager/Cell/spe/SpeTaskManagerImpl.cc	Fri Jul 20 05:47:14 2012 +0900
+++ b/TaskManager/Cell/spe/SpeTaskManagerImpl.cc	Tue Jul 24 17:15:15 2012 +0900
@@ -5,7 +5,7 @@
 SpeTaskManagerImpl::SpeTaskManagerImpl() {}
 SpeTaskManagerImpl::~SpeTaskManagerImpl() {}
 
-void SpeTaskManagerImpl::init(int spuIdle_, int useRefDma) {}
+void SpeTaskManagerImpl::init(int spuIdle_, int useRefDma=0, int export_task_log=0) {}
 void SpeTaskManagerImpl::run() {}
 
 HTaskPtr SpeTaskManagerImpl::create_task(int cmd) {return 0;}
--- a/TaskManager/Cell/spe/SpeTaskManagerImpl.h	Fri Jul 20 05:47:14 2012 +0900
+++ b/TaskManager/Cell/spe/SpeTaskManagerImpl.h	Tue Jul 24 17:15:15 2012 +0900
@@ -16,7 +16,7 @@
 
     /* functions */
     // call by system
-    void init(int spuIdle,int useRefDma);
+    void init(int spuIdle,int useRefDma, int export_task_log);
     void run();
     void start_profile();
     void show_profile();
--- a/TaskManager/Fifo/FifoTaskManagerImpl.cc	Fri Jul 20 05:47:14 2012 +0900
+++ b/TaskManager/Fifo/FifoTaskManagerImpl.cc	Tue Jul 24 17:15:15 2012 +0900
@@ -31,7 +31,7 @@
  * FifoScheduler は PPE 側のスケジューラ
  */
 void
-FifoTaskManagerImpl::init(int spuIdle_, int useRefDma)
+FifoTaskManagerImpl::init(int spuIdle_, int useRefDma, int export_task_log)
 {
     // TaskManager から呼ばれるので、かなりの部分は初期化されている。
 
@@ -47,6 +47,8 @@
     others = 0;
     schedTaskManager->init(0,0,mainScheduler,0);
 
+    _export_task_log = export_task_log;
+
 }
 
 /**
--- a/TaskManager/Fifo/FifoTaskManagerImpl.h	Fri Jul 20 05:47:14 2012 +0900
+++ b/TaskManager/Fifo/FifoTaskManagerImpl.h	Tue Jul 24 17:15:15 2012 +0900
@@ -22,7 +22,7 @@
 
     /* functions */
     // call by system
-    void init(int spuIdle, int useRefDma);
+    void init(int spuIdle, int useRefDma, int export_task_log);
     void init(MainScheduler*, TaskManagerImpl*, int);
     void poll();  // called from CellTaskManagerImpl
     void poll1();  // single CPU run called from CellTaskManagerImpl
--- a/TaskManager/kernel/main.cc	Fri Jul 20 05:47:14 2012 +0900
+++ b/TaskManager/kernel/main.cc	Tue Jul 24 17:15:15 2012 +0900
@@ -55,7 +55,7 @@
     }
 
     TaskManager *manager = new TaskManager(machineNum);
-    manager->init(speIdle,useRefDma);
+    manager->init(speIdle,export_task_log, useRefDma);
 
     manager->set_TMend(defaultTMend);
 
--- a/TaskManager/kernel/ppe/HTask.cc	Fri Jul 20 05:47:14 2012 +0900
+++ b/TaskManager/kernel/ppe/HTask.cc	Tue Jul 24 17:15:15 2012 +0900
@@ -19,7 +19,9 @@
 void
 HTask::spawn(void)
 {
-    tasklog->create_time = rdtsc();
+    if (export_task_log)
+        tasklog->create_time = rdtsc();
+
     TaskList *tl = (TaskList*)rbuf;
     tl->self = this;
     tl->set_last(last);
@@ -37,10 +39,12 @@
 void
 HTask::wait_for(HTaskPtr master)
 {
-    waitTask *wait_task = new waitTask;
-    wait_task->task_id = master->tasklog->mtask_id;
-    wait_task->cmd = master->tasklog->cmd;
-    tasklog->wait_for_list.addLast(wait_task);
+    if (export_task_log) {
+        waitTask *wait_task = new waitTask;
+        wait_task->task_id = master->tasklog->mtask_id;
+        wait_task->cmd = master->tasklog->cmd;
+        tasklog->wait_for_list.addLast(wait_task);
+    }
 
     mimpl->set_task_depend(master, this);
 }
--- a/TaskManager/kernel/ppe/HTask.h	Fri Jul 20 05:47:14 2012 +0900
+++ b/TaskManager/kernel/ppe/HTask.h	Tue Jul 24 17:15:15 2012 +0900
@@ -43,6 +43,7 @@
     TaskManagerImpl *mimpl;
     TaskPtr last;
 
+    int export_task_log;
     TaskLog *tasklog;
 
     HTask *waiter;
--- a/TaskManager/kernel/ppe/TaskManager.cc	Fri Jul 20 05:47:14 2012 +0900
+++ b/TaskManager/kernel/ppe/TaskManager.cc	Tue Jul 24 17:15:15 2012 +0900
@@ -32,10 +32,10 @@
 extern TaskManagerImpl* create_impl(int,int);
 
 void
-TaskManager::init(int spuIdle, int useRefDma=0)
+TaskManager::init(int spuIdle, int export_task_log, int useRefDma=0)
 {
     m_impl = create_impl(machineNum,useRefDma);
-    m_impl->init(spuIdle, useRefDma);
+    m_impl->init(spuIdle, useRefDma, export_task_log);
     m_impl->systask_init();
 }
 
--- a/TaskManager/kernel/ppe/TaskManager.h	Fri Jul 20 05:47:14 2012 +0900
+++ b/TaskManager/kernel/ppe/TaskManager.h	Tue Jul 24 17:15:15 2012 +0900
@@ -40,7 +40,7 @@
     }
 
     /* functions */
-    void init(int spuIdle, int useRefDma);
+    void init(int spuIdle, int export_task_log, int useRefDma);
     void finish();
 
 private:
--- a/TaskManager/kernel/ppe/TaskManagerImpl.cc	Fri Jul 20 05:47:14 2012 +0900
+++ b/TaskManager/kernel/ppe/TaskManagerImpl.cc	Tue Jul 24 17:15:15 2012 +0900
@@ -72,10 +72,13 @@
     t->set_inData(0,rbuf,r_size);
     t->set_outData(0,wbuf,w_size);
 
-    TaskLog *tasklog = new TaskLog(); // この hard code は、ひどい... state pattern で切れるようにしてよ。
-    tasklog->set_cmd(cmd);
-    taskLogQueue->addLast(tasklog);
-    new_task->tasklog = tasklog;
+    new_task->export_task_log = _export_task_log;
+    if (_export_task_log) {
+        TaskLog *tasklog = new TaskLog();
+        tasklog->set_cmd(cmd);
+        taskLogQueue->addLast(tasklog);
+        new_task->tasklog = tasklog;
+    }
 
 #ifdef EARLY_TOUCH
         if (rbuf) {
@@ -115,10 +118,13 @@
     new_task->from = (memaddr)from;
     new_task->next_task_array(cmd,0,8,1,1);
 
-    TaskLog *tasklog = new TaskLog();
-    tasklog->set_cmd(cmd);
-    taskLogQueue->addLast(tasklog);
-    new_task->tasklog = tasklog;
+    new_task->export_task_log = _export_task_log;
+    if (_export_task_log) {
+        TaskLog *tasklog = new TaskLog();
+        tasklog->set_cmd(cmd);
+        taskLogQueue->addLast(tasklog);
+        new_task->tasklog = tasklog;
+    }
 
     return new_task;
 }
@@ -296,7 +302,8 @@
 void
 TaskManagerImpl::check_task_finish(HTaskPtr me, QueueInfo<HTask> *wait_queue)
 {
-    me->tasklog->finish_time = rdtsc();
+    if (_export_task_log)
+        me->tasklog->finish_time = rdtsc();
 
     while(TaskQueue *p = me->wait_me->poll()) {
 	HTaskPtr you = p->task;
@@ -363,7 +370,8 @@
 void
 TaskManagerImpl::set_taskList(HTaskPtr htask, QueueInfo<TaskList> * taskList)
 {
-    htask->tasklog->execute_time = rdtsc();
+    if (_export_task_log)
+        htask->tasklog->execute_time = rdtsc();
 
     TaskListPtr tl = (TaskList*)htask->rbuf;
     while(tl->prev) tl=tl->prev;
--- a/TaskManager/kernel/ppe/TaskManagerImpl.h	Fri Jul 20 05:47:14 2012 +0900
+++ b/TaskManager/kernel/ppe/TaskManagerImpl.h	Tue Jul 24 17:15:15 2012 +0900
@@ -31,6 +31,7 @@
     SchedTask *schedTaskManager;
     Scheduler *scheduler;
     TaskManagerImpl *others;
+    int _export_task_log;
 
     /* constructor */
     TaskManagerImpl(int num = 0) ;
@@ -39,7 +40,7 @@
 
     /* functions */
     // system
-    virtual void init(int,int) = 0;
+    virtual void init(int,int,int) = 0;
     virtual void run() = 0;
     virtual void start_profile() = 0;
     virtual void show_profile() = 0;
--- a/TaskManager/kernel/schedule/Scheduler.cc	Fri Jul 20 05:47:14 2012 +0900
+++ b/TaskManager/kernel/schedule/Scheduler.cc	Tue Jul 24 17:15:15 2012 +0900
@@ -40,7 +40,7 @@
 
 //useRefDmaは、0という初期値が設定されている。
 void
-Scheduler::init(TaskManagerImpl *m, int useRefDma)
+Scheduler::init(TaskManagerImpl *m, int useRefDma, int export_task_log)
 {
     hash = 0;
 
--- a/TaskManager/kernel/schedule/Scheduler.h	Fri Jul 20 05:47:14 2012 +0900
+++ b/TaskManager/kernel/schedule/Scheduler.h	Tue Jul 24 17:15:15 2012 +0900
@@ -85,7 +85,7 @@
 
 
     /* functions */
-    void init(TaskManagerImpl *m, int useRefDma=0);
+    void init(TaskManagerImpl *m, int useRefDma=0, int export_task_log=0);
     virtual void run(){};
     void run(SchedTaskBase* task1);