# HG changeset patch # User Daichi TOMA # Date 1331287398 -32400 # Node ID 515a0f15b5d2def8127206100fac6e8a8dce1672 # Parent be036663780c8a315491cb32651e8e444ddbf934 add to log taskdependency diff -r be036663780c -r 515a0f15b5d2 TaskManager/kernel/ppe/HTask.cc --- a/TaskManager/kernel/ppe/HTask.cc Wed Mar 07 19:39:27 2012 +0900 +++ b/TaskManager/kernel/ppe/HTask.cc Fri Mar 09 19:03:18 2012 +0900 @@ -2,6 +2,7 @@ #include "ListData.h" #include "TaskManagerImpl.h" #include "strings.h" +#include "rdtsc.h" /*! @@ -18,7 +19,8 @@ void HTask::spawn(void) { - mimpl->spawn_task(this); + tasklog->create_time = rdtsc(); + mimpl->spawn_task(this); } /*! @@ -32,6 +34,11 @@ void HTask::wait_for(HTaskPtr master) { + waitTask *wait_task = new waitTask; + wait_task->task_id = master->tasklog->mtask_id; + wait_task->cmd = master->command; + tasklog->wait_for_list.push_back(wait_task); + mimpl->set_task_depend(master, this); } diff -r be036663780c -r 515a0f15b5d2 TaskManager/kernel/ppe/HTask.h --- a/TaskManager/kernel/ppe/HTask.h Wed Mar 07 19:39:27 2012 +0900 +++ b/TaskManager/kernel/ppe/HTask.h Fri Mar 09 19:03:18 2012 +0900 @@ -6,6 +6,7 @@ #include "Task.h" #include "TaskQueue.h" #include "QueueInfo.h" +#include "TaskLog.h" //#include class TaskManagerImpl; @@ -40,6 +41,8 @@ CPU_TYPE cpu_type; TaskManagerImpl *mimpl; + TaskLog *tasklog; + HTask *waiter; HTask *next; HTask *prev; diff -r be036663780c -r 515a0f15b5d2 TaskManager/kernel/ppe/TaskLog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TaskManager/kernel/ppe/TaskLog.h Fri Mar 09 19:03:18 2012 +0900 @@ -0,0 +1,35 @@ +#ifndef INCLUDED_TASKLOG +#define INCLUDED_TASKLOG + +#include +#include "HTask.h" + +struct waitTask { + int task_id; + int cmd; +}; + +class TaskLog { +public: + + /* variables */ + int mtask_id; + int cmd; + std::list wait_for_list; + unsigned long long create_time; + unsigned long long execute_time; + unsigned long long finish_time; + + /* constructor */ + TaskLog() { + mtask_id = task_id; + task_id++; + } + +private: + // Unique id + static int task_id; + +}; + +#endif diff -r be036663780c -r 515a0f15b5d2 TaskManager/kernel/ppe/TaskManagerImpl.cc --- a/TaskManager/kernel/ppe/TaskManagerImpl.cc Wed Mar 07 19:39:27 2012 +0900 +++ b/TaskManager/kernel/ppe/TaskManagerImpl.cc Fri Mar 09 19:03:18 2012 +0900 @@ -6,7 +6,9 @@ #include "Scheduler.h" #include "SysTask.h" #include "SysFunc.h" +#include "rdtsc.h" #include +#include // singleton QueueInfo *taskQueuePool = new QueueInfo() ; @@ -32,6 +34,7 @@ htaskImpl = waitTaskQueue ; // any QueueInfo // Task の dependency を表現する double linked list. QueueInfo とは別に必要。 taskQueueImpl = new QueueInfo(taskQueuePool); + } /** @@ -65,6 +68,11 @@ new_task->post_func = noaction; new_task->mimpl = this; new_task->from = (memaddr)from; + + TaskLog *tasklog = new TaskLog(); + taskLogQueue.push_back(tasklog); + new_task->tasklog = tasklog; + #ifdef EARLY_TOUCH if (rbuf) { if ((unsigned long)rbuf&0xf) { @@ -276,6 +284,8 @@ void TaskManagerImpl::check_task_finish(HTaskPtr me, QueueInfo *wait_queue) { + me->tasklog->finish_time = rdtsc(); + while(TaskQueue *p = me->wait_me->poll()) { HTaskPtr you = p->task; QueueInfo *wait_i = you->wait_i; @@ -297,8 +307,6 @@ // TaskArray の rbuf はfreeされない見たいなので、ここでfreeしてみる。 - //;TODO - //ReferencedDmaManagerを使う場合ここでfreeすると、wordcountが動かない if (me->command == TaskArray) { free(me->rbuf); } @@ -355,7 +363,10 @@ TaskList は自動的に延長される */ void -TaskManagerImpl::set_taskList(HTaskPtr htask, QueueInfo * taskList) { +TaskManagerImpl::set_taskList(HTaskPtr htask, QueueInfo * taskList) +{ + htask->tasklog->execute_time = rdtsc(); + TaskListPtr list ; if ( taskList->empty() ) { diff -r be036663780c -r 515a0f15b5d2 TaskManager/kernel/ppe/TaskManagerImpl.h --- a/TaskManager/kernel/ppe/TaskManagerImpl.h Wed Mar 07 19:39:27 2012 +0900 +++ b/TaskManager/kernel/ppe/TaskManagerImpl.h Fri Mar 09 19:03:18 2012 +0900 @@ -7,6 +7,7 @@ #include "TaskQueue.h" #include "HTask.h" #include "Scheduler.h" +#include "TaskLog.h" class MemList; extern QueueInfo *taskQueuePool ; @@ -26,6 +27,8 @@ QueueInfo *taskQueueImpl; QueueInfo *htaskImpl; + std::list taskLogQueue; + SchedTask *schedTaskManager; Scheduler *scheduler; TaskManagerImpl *others;