diff TaskManager/Cell/spe/CellDmaManager.cc @ 1007:18a548c337cb

add mail_queue
author yutaka@localhost.localdomain
date Thu, 28 Oct 2010 08:39:19 +0900
parents 61f33945f85d
children c67379f9d411
line wrap: on
line diff
--- a/TaskManager/Cell/spe/CellDmaManager.cc	Tue Oct 26 17:41:41 2010 +0900
+++ b/TaskManager/Cell/spe/CellDmaManager.cc	Thu Oct 28 08:39:19 2010 +0900
@@ -82,6 +82,48 @@
     (this->*end_dmawait_profile)(&global_mail_time);
 }
 
+// mail を queue にしたみた。mailの書き出しの待ちあるのかわからないけど
+//TASK_LIST_MAIL は仕事が最後に溜まってしまうけど、MailQueueなら出来る時にmailを書き出す
+//ので多少は効果あるといいな。
+void CellDmaManager::mail_write_queue(memaddr data)
+{
+    (this->*start_dmawait_profile)();
+    if (0 == spu_readchcnt(SPU_WrOutMbox)) {
+      if (mail_queue.empty()) {
+          spu_write_out_mbox((uint32)data);
+      } else {
+	  MailQueuePtr mail = mail_queue.getFirst();
+	  spu_write_out_mbox((uint32)mail->data);
+	  mail_queue.free_(mail);
+	  mail = mail_queue.create();
+	  mail->data = data;
+	  mail_queue.addLast(mail);
+      }
+    } else {
+        MailQueuePtr mail = mail_queue.create();
+	mail->data = data;
+	mail_queue.addLast(mail);
+    }
+    (this->*end_dmawait_profile)(&global_mail_time);
+}
+
+// tasklist おわりに、MailQueue 全部を書き出す
+void CellDmaManager::mail_write_finish_list(memaddr data)
+{
+
+    (this->*start_dmawait_profile)();
+
+    while (!mail_queue.empty()) {
+      MailQueuePtr mail = mail_queue.getFirst();
+      spu_write_out_mbox((uint32)mail->data);
+      mail_queue.free_(mail);
+    }
+
+    spu_write_out_mbox((uint32)data);
+
+    (this->*end_dmawait_profile)(&global_mail_time);
+}
+
 memaddr CellDmaManager::mail_read()
 {
     (this->*start_dmawait_profile)();