Mercurial > hg > Game > Cerium
changeset 1718:93f051a51d9e draft
fix profile
author | Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 22 Oct 2013 18:07:27 +0900 |
parents | 5d68a55d5561 |
children | d911bef11c8a |
files | TaskManager/Fifo/FifoDmaManager.cc TaskManager/Fifo/FifoDmaManager.h TaskManager/kernel/schedule/DmaManager.h TaskManager/kernel/schedule/SchedTask.cc TaskManager/test/UtilizationTest/main.cc TaskManager/test/UtilizationTest/multiply |
diffstat | 6 files changed, 70 insertions(+), 69 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Fifo/FifoDmaManager.cc Tue Oct 15 17:29:37 2013 +0900 +++ b/TaskManager/Fifo/FifoDmaManager.cc Tue Oct 22 18:07:27 2013 +0900 @@ -13,12 +13,12 @@ if (size == 0) return buf; unsigned long long wait = 0; - (*this->start_dmawait_profile)(); + (*this->start_dmawait_profile)(&start_time); buf = s->manager->allocate(size); memcpy(buf, (void*)addr, size); - (*this->end_dmawait_profile)(&wait); + (*this->end_dmawait_profile)(&wait,&start_time,&stop_time); global_load_time += wait; dma_load_time += wait; @@ -31,11 +31,11 @@ if (size == 0) return buf; unsigned long long wait = 0; - (*this->start_dmawait_profile)(); + (*this->start_dmawait_profile)(&start_time); memcpy(buf, (void*)addr, size); - (*this->end_dmawait_profile)(&wait); + (*this->end_dmawait_profile)(&wait,&start_time,&stop_time); global_load_time += wait; dma_load_time += wait; return buf; @@ -55,11 +55,11 @@ if (size == 0) return buf; unsigned long long wait = 0; - (*this->start_dmawait_profile)(); + (*this->start_dmawait_profile)(&start_time); memcpy((void*)addr, buf, size); - (*this->end_dmawait_profile)(&wait); + (*this->end_dmawait_profile)(&wait,&start_time,&stop_time); global_store_time += wait; dma_store_time += wait; @@ -79,7 +79,7 @@ FifoDmaManager::dma_loadList(Scheduler *s, ListDataPtr list, uint32 mask) { unsigned long long wait = 0; - (*this->start_dmawait_profile)(); + (*this->start_dmawait_profile)(&start_time); int list_size = list->length; long bound; @@ -93,7 +93,7 @@ bound += elm->size; } - (*this->end_dmawait_profile)(&wait); + (*this->end_dmawait_profile)(&wait,&start_time,&stop_time); global_load_time += wait; dma_loadList_time += wait; @@ -104,7 +104,7 @@ FifoDmaManager::dma_storeList(ListDataPtr list, void *buff, uint32 mask) { unsigned long long wait = 0; - (*this->start_dmawait_profile)(); + (*this->start_dmawait_profile)(&start_time); int list_size = list->length; memaddr bound; @@ -117,7 +117,7 @@ bound += elm->size; } - (*this->end_dmawait_profile)(&wait); + (*this->end_dmawait_profile)(&wait,&start_time,&stop_time); global_store_time += wait; dma_storeList_time += wait; } @@ -126,11 +126,11 @@ FifoDmaManager::mail_write(memaddr data) { unsigned long long wait = 0; - (*this->start_dmawait_profile)(); + (*this->start_dmawait_profile)(&start_time); mail_queue1->send(data); - (*this->end_dmawait_profile)(&wait); + (*this->end_dmawait_profile)(&wait,&start_time,&stop_time); global_mail_time += wait; mail_write_time += wait; } @@ -139,11 +139,11 @@ FifoDmaManager::mail_write_finish_list(memaddr data) { unsigned long long wait = 0; - (*this->start_dmawait_profile)(); + (*this->start_dmawait_profile)(&start_time); mail_queue1->send(data); - (*this->end_dmawait_profile)(&wait); + (*this->end_dmawait_profile)(&wait,&start_time,&stop_time); global_mail_time += wait; mail_write_time += wait; } @@ -152,12 +152,12 @@ FifoDmaManager::mail_read() { unsigned long long wait = 0; - (*this->start_dmawait_profile)(); + (*this->start_dmawait_profile)(&start_time); memaddr data; data = mail_queue2->recv(); - (*this->end_dmawait_profile)(&wait); + (*this->end_dmawait_profile)(&wait,&start_time,&stop_time); global_mail_time += wait; mail_read_time += wait; @@ -168,12 +168,12 @@ FifoDmaManager::task_list_mail_read() { unsigned long long wait = 0; - (*this->start_dmawait_profile)(); + (*this->start_dmawait_profile)(&start_time); memaddr data; data = mail_queue2->recv(); - (*this->end_dmawait_profile)(&wait); + (*this->end_dmawait_profile)(&wait,&start_time,&stop_time); global_mail_time += wait; mail_read_time += wait; @@ -184,11 +184,11 @@ FifoDmaManager::mail_write_from_host(memaddr data) { unsigned long long wait = 0; - (*this->start_dmawait_profile)(); + (*this->start_dmawait_profile)(&start_time); mail_queue2->send(data); - (*this->end_dmawait_profile)(&wait); + (*this->end_dmawait_profile)(&wait,&start_time,&stop_time); global_mail_time += wait; mail_write_from_host_time += wait; } @@ -197,12 +197,12 @@ FifoDmaManager::mail_read_from_host() { unsigned long long wait = 0; - (*this->start_dmawait_profile)(); + (*this->start_dmawait_profile)(&start_time); memaddr data; data = mail_queue1->recv(); - (*this->end_dmawait_profile)(&wait); + (*this->end_dmawait_profile)(&wait,&start_time,&stop_time); global_mail_time += wait; mail_read_from_host_time += wait; @@ -215,22 +215,21 @@ return mail_queue1->count(); } -static unsigned long long start_time,stop_time; void -do_start_dmawait_profile() +do_start_dmawait_profile(unsigned long long *start) { - start_time = gettime(); + *start = gettime(); } void -do_end_dmawait_profile(unsigned long long *counter) +do_end_dmawait_profile(unsigned long long *counter,unsigned long long *start,unsigned long long *stop) { - stop_time = gettime(); - *counter += stop_time - start_time; + *stop = gettime(); + *counter += *stop - *start; } -void null_start_dmawait_profile() {} -void null_end_dmawait_profile(unsigned long long *counter) {} +void null_start_dmawait_profile(unsigned long long *start) {} +void null_end_dmawait_profile(unsigned long long *counter,unsigned long long *start,unsigned long long *stop) {} void FifoDmaManager::start_profile() @@ -251,8 +250,7 @@ start_dmawait_profile = &do_start_dmawait_profile; end_dmawait_profile = &do_end_dmawait_profile; - (*this->start_dmawait_profile)(); - stop_time = gettime(); + (*this->start_dmawait_profile)(&start_time); } void @@ -266,7 +264,7 @@ FifoDmaManager::show_dma_wait(Scheduler *s, int cpu) { unsigned long long all_time = gettime() - global_start_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; @@ -278,22 +276,24 @@ 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); - + " 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" + " all_time = %lld\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, + all_time); + global_busy_time = 0; global_load_time = 0; global_store_time = 0;
--- a/TaskManager/Fifo/FifoDmaManager.h Tue Oct 15 17:29:37 2013 +0900 +++ b/TaskManager/Fifo/FifoDmaManager.h Tue Oct 22 18:07:27 2013 +0900 @@ -10,10 +10,10 @@ #include "MailManager.h" #endif -void do_start_dmawait_profile(); -void do_end_dmawait_profile(unsigned long long *counter); -void null_start_dmawait_profile(); -void null_end_dmawait_profile(unsigned long long *counter); +void do_start_dmawait_profile(unsigned long long *start); +void do_end_dmawait_profile(unsigned long long *counter,unsigned long long *start,unsigned long long *stop); +void null_start_dmawait_profile(unsigned long long *start); +void null_end_dmawait_profile(unsigned long long *counter,unsigned long long *start,unsigned long long *stop); class FifoDmaManager : public DmaManager {
--- a/TaskManager/kernel/schedule/DmaManager.h Tue Oct 15 17:29:37 2013 +0900 +++ b/TaskManager/kernel/schedule/DmaManager.h Tue Oct 22 18:07:27 2013 +0900 @@ -32,9 +32,10 @@ virtual void show_dma_wait(Scheduler *s, int cpu) {} virtual void start_profile() {} virtual void show_profile() {} - void (*start_dmawait_profile)(); - void (*end_dmawait_profile)(unsigned long long* global_busy_time); + void (*start_dmawait_profile)(unsigned long long* start); + void (*end_dmawait_profile)(unsigned long long* global_busy_time,unsigned long long* start,unsigned long long* stop); unsigned long long global_busy_time; + unsigned long long start_time,stop_time; // API for SPU inbound/outbound mailbox virtual void mail_write(memaddr data) {} virtual void mail_write_finish_list(memaddr data) {}
--- a/TaskManager/kernel/schedule/SchedTask.cc Tue Oct 15 17:29:37 2013 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.cc Tue Oct 22 18:07:27 2013 +0900 @@ -115,13 +115,13 @@ void *read = get_input(readbuf, 0); void *write = get_output(writebuf, 0); // set param (if exist dim ) list->task_start_time = gettime(); - (*connector->start_dmawait_profile)(); + (*connector->start_dmawait_profile)(&connector->start_time); if (list->dim) { multi_dimension(list, read, write,run); } else { run(this, read,write); } - (*connector->end_dmawait_profile)(&connector->global_busy_time); + (*connector->end_dmawait_profile)(&connector->global_busy_time,&connector->start_time,&connector->stop_time); list->task_end_time = gettime(); this->printf("%d %s\t%lld\n",list->self->cpu_type,(char *)(task_list[atask->command].name),list->task_end_time-list->task_start_time); connector->free_(readbuf);
--- a/TaskManager/test/UtilizationTest/main.cc Tue Oct 15 17:29:37 2013 +0900 +++ b/TaskManager/test/UtilizationTest/main.cc Tue Oct 22 18:07:27 2013 +0900 @@ -84,23 +84,23 @@ multiply->spawn(); - HTask* previous = multiply; + // HTask* previous = multiply; - for(int i=1;i<4;i++) { - multiply = manager->create_task(MULTIPLY_TASK); - multiply->set_cpu((CPU_TYPE)((int)SPE_0+i)); + // for(int i=1;i<4;i++) { + // multiply = manager->create_task(MULTIPLY_TASK); + // multiply->set_cpu((CPU_TYPE)((int)SPE_0+i)); - multiply->set_inData(0,(memaddr)A, sizeof(float)*length); - multiply->set_inData(1,(memaddr)B, sizeof(float)*length); - multiply->set_param(0,task_id++); - multiply->set_outData(0,(memaddr)C, sizeof(float)*length); + // multiply->set_inData(0,(memaddr)A, sizeof(float)*length); + // multiply->set_inData(1,(memaddr)B, sizeof(float)*length); + // multiply->set_param(0,task_id++); + // multiply->set_outData(0,(memaddr)C, sizeof(float)*length); - multiply->wait_for(previous); + // multiply->wait_for(previous); - multiply->spawn(); + // multiply->spawn(); - previous = multiply; - } + // previous = multiply; + // } // for(int i=1;i<4;i++) { // multiply = manager->create_task(MULTIPLY_TASK);