changeset 242:8382f0f8c0b4

dma_wait
author e065746@localhost.localdomain
date Sun, 31 May 2009 15:55:00 +0900
parents 3fd1731d6151
children 52db409f255a
files TaskManager/Cell/spe/CellDmaManager.cc TaskManager/Cell/spe/main.cc TaskManager/kernel/main.cc include/TaskManager/CellDmaManager.h
diffstat 4 files changed, 31 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Cell/spe/CellDmaManager.cc	Sat May 30 16:21:42 2009 +0900
+++ b/TaskManager/Cell/spe/CellDmaManager.cc	Sun May 31 15:55:00 2009 +0900
@@ -37,13 +37,34 @@
  *
  * @param[in] mask Tag for Wait DMA process
  */
+void
+CellDmaManager::start_dmawait_profile()
+{
+    wait_time = spu_readch(SPU_RdDec); 
+    global_busy_time += busy_time - wait_time;
+    spu_writech(SPU_WrDec, 0xffffffff);
+}
+
+void
+CellDmaManager::end_dmawait_profile()
+{
+    wait_time = spu_readch(SPU_RdDec);
+    global_wait_time += 0xffffffff - wait_time;
+    busy_time = wait_time;
+}
 
 void
 CellDmaManager::dma_wait(uint32 mask)
 {
+#ifdef SPU_PROFILE
+    start_dmawait_profile();
+#endif
     mfc_write_tag_mask(1 << mask);
     mfc_write_tag_update_all();
     mfc_read_tag_status();
+#ifdef SPU_PROFILE
+    end_dmawait_profile();
+#endif
 }
 
 void
--- a/TaskManager/Cell/spe/main.cc	Sat May 30 16:21:42 2009 +0900
+++ b/TaskManager/Cell/spe/main.cc	Sun May 31 15:55:00 2009 +0900
@@ -11,9 +11,9 @@
 {
     CellScheduler *manager;
 
-    const unsigned ls_size   = (unsigned)&argc;
-    unsigned code_size = (unsigned)&_end;
-    unsigned heap_size = ls_size - code_size;
+    //const unsigned ls_size   = (unsigned)&argc;
+    //unsigned code_size = (unsigned)&_end;
+    //unsigned heap_size = ls_size - code_size;
 
     __debug("  ls_size:%10d bytes\n", ls_size);
     __debug("code_size:%10d bytes\n", code_size);
--- a/TaskManager/kernel/main.cc	Sat May 30 16:21:42 2009 +0900
+++ b/TaskManager/kernel/main.cc	Sun May 31 15:55:00 2009 +0900
@@ -11,7 +11,7 @@
 defaultTMend(void) {}
 
 TaskManager *manager;
-static char *help_str = "\n\
+static char help_str[] = "\n\
 * Cerium program option *\n\
   -chelp Print this message \n\
   -cpu   Number of CPU (default 1) \n";
--- a/include/TaskManager/CellDmaManager.h	Sat May 30 16:21:42 2009 +0900
+++ b/include/TaskManager/CellDmaManager.h	Sun May 31 15:55:00 2009 +0900
@@ -11,6 +11,8 @@
 
 #include <spu_mfcio.h>
 
+#define SPU_PROFILE 1
+
 class CellDmaManager : public DmaManager {
 public:
     BASE_NEW_DELETE(CellDmaManager);
@@ -21,11 +23,15 @@
     } DmaList, *DmaListPtr;
 
     /* variables */
+    unsigned int wait_time, busy_time;
+    unsigned long long global_busy_time, global_wait_time;
 
     /* functions */
     void dma_load(void *buf, uint32 addr, uint32 size, uint32 mask);
     void dma_store(void *buf, uint32 addr, uint32 size, uint32 mask);
     void dma_wait(uint32 mask) ;
+    void start_dmawait_profile();
+    void end_dmawait_profile();
 
     void mail_write(uint32 data);
     uint32 mail_read(void);