changeset 1373:f97bb81a034f draft

merge
author Yutaka_Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
date Sat, 21 Jan 2012 22:25:19 +0900
parents 7afeb56ba212 (current diff) 66ae94572433 (diff)
children 75d5eededecb
files
diffstat 4 files changed, 175 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Fifo/FifoDmaManager.cc	Sat Jan 21 22:24:51 2012 +0900
+++ b/TaskManager/Fifo/FifoDmaManager.cc	Sat Jan 21 22:25:19 2012 +0900
@@ -113,15 +113,126 @@
 }
 
 void
+FifoDmaManager::mail_write(memaddr data)
+{
+	unsigned long long wait = 0;
+	(this->*start_dmawait_profile)();
+
+    mail_queue1->send(data);
+
+	(this->*end_dmawait_profile)(&wait);
+	global_mail_time += wait;
+	mail_write_time += wait;
+}
+
+void
+FifoDmaManager::mail_write_queue(memaddr data)
+{
+	unsigned long long wait = 0;
+	(this->*start_dmawait_profile)();
+
+    mail_queue1->send(data);
+
+	(this->*end_dmawait_profile)(&wait);
+	global_mail_time += wait;
+	mail_write_time += wait;
+}
+
+void
+FifoDmaManager::mail_write_finish_list(memaddr data)
+{
+	unsigned long long wait = 0;
+	(this->*start_dmawait_profile)();
+
+    mail_queue1->send(data);
+
+	(this->*end_dmawait_profile)(&wait);
+	global_mail_time += wait;
+	mail_write_time += wait;
+}
+
+memaddr
+FifoDmaManager::mail_read()
+{
+	unsigned long long wait = 0;
+	(this->*start_dmawait_profile)();
+
+	memaddr data;
+	data = mail_queue2->recv();
+
+	(this->*end_dmawait_profile)(&wait);
+	global_mail_time += wait;
+	mail_read_time += wait;
+
+	return data;
+}
+
+memaddr
+FifoDmaManager::task_list_mail_read()
+{
+	unsigned long long wait = 0;
+	(this->*start_dmawait_profile)();
+
+	memaddr data;
+	data = mail_queue2->recv();
+
+	(this->*end_dmawait_profile)(&wait);
+	global_mail_time += wait;
+	mail_read_time += wait;
+
+	return data;
+}
+
+void
+FifoDmaManager::mail_write_from_host(memaddr data)
+{
+	unsigned long long wait = 0;
+	(this->*start_dmawait_profile)();
+
+	mail_queue2->send(data);
+
+	(this->*end_dmawait_profile)(&wait);
+	global_mail_time += wait;
+	mail_write_from_host_time += wait;
+}
+
+memaddr 
+FifoDmaManager::mail_read_from_host() 
+{
+	unsigned long long wait = 0;
+	(this->*start_dmawait_profile)();
+
+	memaddr data;
+	data = mail_queue1->recv();
+
+	(this->*end_dmawait_profile)(&wait);
+	global_mail_time += wait;
+	mail_read_from_host_time += wait;
+
+	return data;
+}
+
+int 
+FifoDmaManager::has_mail_from_host() 
+{ 
+	return mail_queue1->count(); 
+}
+
+void
 FifoDmaManager::start_profile()
 {
 	global_busy_time = 0;
 	global_load_time = 0;
 	global_store_time = 0;
+	global_mail_time = 0;
 	dma_load_time = 0;
 	dma_store_time = 0;
 	dma_loadList_time = 0;
 	dma_storeList_time = 0;
+	mail_read_time = 0;
+	mail_write_time = 0;
+	mail_read_from_host_time = 0;
+	mail_write_from_host_time = 0;
 
 	start_dmawait_profile = &FifoDmaManager::do_start_dmawait_profile;
 	end_dmawait_profile = &FifoDmaManager::do_end_dmawait_profile;
@@ -133,7 +244,7 @@
 FifoDmaManager::stop_profile()
 {
 	start_time = rdtsc();
-	global_busy_time = stop_time - start_time;
+	global_busy_time += start_time - stop_time;
 
 	start_dmawait_profile = &FifoDmaManager::null_start_dmawait_profile;
 	end_dmawait_profile = &FifoDmaManager::null_end_dmawait_profile;
@@ -143,7 +254,7 @@
 FifoDmaManager::do_start_dmawait_profile()
 {
 	start_time = rdtsc();
-	global_busy_time += stop_time - start_time;
+	global_busy_time += start_time - stop_time;
 }
 
 void
@@ -159,25 +270,48 @@
 void
 FifoDmaManager::show_dma_wait(Scheduler *s, int cpu)
 {
-	unsigned long long all_time = global_busy_time + global_load_time + global_store_time;
+	unsigned long long all_time = global_busy_time + global_load_time + 
+				global_store_time + global_mail_time;
 
 	double busy = ((double)global_busy_time)/((double)all_time)*100.0;
 	double load = ((double)global_load_time)/((double)all_time)*100.0;
 	double store = ((double)global_store_time)/((double)all_time)*100.0;
+	double mail = ((double)global_mail_time)/((double)all_time)*100.0;
+	double read = ((double)mail_read_time)/((double)all_time)*100.0;
+	double write = ((double)mail_write_time)/((double)all_time)*100.0;
+	double read_from_host = ((double)mail_read_from_host_time)/((double)all_time)*100.0;
+	double write_from_host = ((double)mail_write_from_host_time)/((double)all_time)*100.0;
 
 
-	s->printf("cpu%d:\n busy_time = %.3g%%"
-			" load_time = %.3g%%, "
-			" store_time = %.3g%% \n"
-			,cpu, busy, load, store);
+	s->printf("cpu%d:\n busy_time = %lld(%.3g%%)\n"
+			" load_time = %lld(%.3g%%), "
+			" store_time = %lld(%.3g%%), "
+			" mail_time = %lld(%.3g%%) \n"
+			" mail_read_time = %lld(%.3g%%), "
+			" mail_write_time = %lld(%.3g%%)\n"
+			" mail_read_from_host_time = %lld(%.3g%%), "
+			" mail_write_from_host_time = %lld(%.3g%%)\n"
+			,cpu, global_busy_time, busy, 
+			global_load_time, load,
+			global_store_time, store,
+			global_mail_time, mail,
+			mail_read_time, read,
+			mail_write_time, write,
+			mail_read_from_host_time, read_from_host,
+			mail_write_from_host_time, write_from_host);
 
 	global_busy_time = 0;
 	global_load_time = 0;
 	global_store_time = 0;
+	global_mail_time = 0;
 	dma_load_time = 0;
 	dma_store_time = 0;
 	dma_loadList_time = 0;
 	dma_storeList_time = 0;
+	mail_read_time = 0;
+	mail_write_time = 0;
+	mail_read_from_host_time = 0;
+	mail_write_from_host_time = 0;
 }
 
 uint32
--- a/TaskManager/Fifo/FifoDmaManager.h	Sat Jan 21 22:24:51 2012 +0900
+++ b/TaskManager/Fifo/FifoDmaManager.h	Sat Jan 21 22:25:19 2012 +0900
@@ -40,8 +40,10 @@
 	/* variables */
 protected:
 	unsigned long long start_time, stop_time;
-	unsigned long long global_busy_time, global_load_time, global_store_time;
+	unsigned long long global_busy_time, global_load_time, global_store_time, global_mail_time;
 	unsigned long long dma_load_time, dma_store_time, dma_loadList_time, dma_storeList_time;
+	unsigned long long mail_read_time, mail_write_time;
+	unsigned long long mail_read_from_host_time, mail_write_from_host_time;
 
     /* functions */
 public:
@@ -56,15 +58,15 @@
 
     void show_dma_wait(Scheduler *s, int cpu);
 
-    void mail_write(memaddr data) { mail_queue1->send(data); }
-    void mail_write_queue(memaddr data) { mail_queue1->send(data); }
-    void mail_write_finish_list(memaddr data) { mail_queue1->send(data); }
-    memaddr mail_read() { return mail_queue2->recv(); }
-    memaddr task_list_mail_read() { return mail_queue2->recv(); }
+    void mail_write(memaddr data);
+    void mail_write_queue(memaddr data);
+    void mail_write_finish_list(memaddr data);
+    memaddr mail_read();
+    memaddr task_list_mail_read();
 
-    void mail_write_from_host(memaddr data) { mail_queue2->send(data); }
-    memaddr mail_read_from_host() { return mail_queue1->recv(); }
-    int has_mail_from_host() { return mail_queue1->count(); }
+    void mail_write_from_host(memaddr data); 
+    memaddr mail_read_from_host();
+    int has_mail_from_host();
 
     virtual void *dma_loadList(Scheduler *s, ListDataPtr list, void *buff, uint32 mask);
     void dma_storeList(ListDataPtr, void *buff, uint32 mask);
--- a/TaskManager/Fifo/PreRefDmaManager.cc	Sat Jan 21 22:24:51 2012 +0900
+++ b/TaskManager/Fifo/PreRefDmaManager.cc	Sat Jan 21 22:25:19 2012 +0900
@@ -5,9 +5,17 @@
 void *
 PreRefDmaManager::dma_load(Scheduler *s, void *buf, memaddr addr, uint32 size, uint32 mask)
 {
+	unsigned long long wait = 0;
+	(this->*start_dmawait_profile)();
+
 #ifdef __CERIUM_FIFO__
 	asm("prefetcht0 %0"::"m"(addr):"memory");
 #endif // __CERIUM_FIFO__
+
+	(this->*end_dmawait_profile)(&wait);
+	global_load_time += wait;
+	dma_load_time += wait;
+
 	return (void*)addr;
 }
 
--- a/TaskManager/Fifo/ReferencedDmaManager.cc	Sat Jan 21 22:24:51 2012 +0900
+++ b/TaskManager/Fifo/ReferencedDmaManager.cc	Sat Jan 21 22:25:19 2012 +0900
@@ -5,12 +5,27 @@
 void *
 ReferencedDmaManager::dma_load(Scheduler *s, void *buf, memaddr addr, uint32 size, uint32 mask)
 {
+	unsigned long long wait = 0;
+	(this->*start_dmawait_profile)();
+
+	(this->*end_dmawait_profile)(&wait);
+	global_load_time += wait;
+	dma_load_time += wait;
+
 	return (void*)addr;
 }
 
 void *
 ReferencedDmaManager::dma_loadList(Scheduler *s, ListDataPtr list, void *buff, uint32 mask)
 {
+	unsigned long long wait = 0;
+	(this->*start_dmawait_profile)();
+
 	ListElementPtr elm = &list->element[0];
+
+	(this->*end_dmawait_profile)(&wait);
+	global_load_time += wait;
+	dma_loadList_time += wait;
+
     return (void*)elm->addr; 
 }