Mercurial > hg > Game > Cerium
changeset 928:aaf3c4a83fbe draft
fix
author | koba <koba@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 30 Jul 2010 18:24:08 +0900 |
parents | fada580e4604 (current diff) e2a0988c5cb7 (diff) |
children | 21be2f7e13ff |
files | Renderer/Engine/viewer.h |
diffstat | 15 files changed, 56 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Engine/main.cc Fri Jul 30 17:57:49 2010 +0900 +++ b/Renderer/Engine/main.cc Fri Jul 30 18:24:08 2010 +0900 @@ -33,6 +33,7 @@ video_type vtype = VTYPE_SDL; int mem_flag = 0; + int profile = 0; for(int i = 1; argv[i]; ++i) { @@ -48,6 +49,9 @@ if (strcmp(argv[i], "-cpu") == 0) { spenum = atoi(argv[++i]); } + if (strcmp(argv[i], "-p") == 0) { + profile = 1; + } if (strcmp(argv[i], "-video") == 0) { if (strcmp(argv[i+1], "sdl") == 0) { vtype = VTYPE_SDL; @@ -78,6 +82,7 @@ } screen->mem_flag = mem_flag; + screen->profile = 1; screen->run_init(manager, application()); return 0;
--- a/Renderer/Engine/viewer.cc Fri Jul 30 17:57:49 2010 +0900 +++ b/Renderer/Engine/viewer.cc Fri Jul 30 18:24:08 2010 +0900 @@ -940,6 +940,11 @@ } data_update_wait->spawn(); + if (profile) { + if (frames % 1000 == 999) { + manager->show_profile(); + } + } } @@ -950,6 +955,9 @@ if (this_time != start_time) { printf("%f FPS\n", (((float)frames)/(this_time-start_time))*1000.0); } + if (profile) { + manager->show_profile(); + } delete sgroot; // delete sgroot_2;
--- a/Renderer/Engine/viewer.h Fri Jul 30 17:57:49 2010 +0900 +++ b/Renderer/Engine/viewer.h Fri Jul 30 18:24:08 2010 +0900 @@ -19,7 +19,7 @@ class Viewer : public MainLoop { public: - Viewer(){}; + Viewer(){ profile = 0;}; Viewer(TaskManager *manager, ViewerDevice *dev, int bpp, int width, int height, int spenum); virtual ~Viewer() {} @@ -51,6 +51,7 @@ Uint32 *pixels; int mem_flag; + int profile; SceneGraphRoot *sgroot;
--- a/TaskManager/Cell/CellTaskManagerImpl.cc Fri Jul 30 17:57:49 2010 +0900 +++ b/TaskManager/Cell/CellTaskManagerImpl.cc Fri Jul 30 18:24:08 2010 +0900 @@ -247,7 +247,7 @@ void CellTaskManagerImpl::show_profile() { for (int id = 0; id < machineNum; id++) { - HTaskPtr t = create_task(ShowTime,__builtin_return_address(0)); + HTaskPtr t = schedTaskManager->create_task(ShowTime,0,0,0,0); t->set_cpu((CPU_TYPE)(id+2)); t->spawn(); } @@ -255,7 +255,7 @@ void CellTaskManagerImpl::start_profile() { for (int id = 0; id < machineNum; id++) { - HTaskPtr t = create_task(StartProfile,__builtin_return_address(0)); + HTaskPtr t = schedTaskManager->create_task(StartProfile,0,0,0,0); t->set_cpu((CPU_TYPE)(id+2)); t->spawn(); }
--- a/TaskManager/Cell/spe/CellDmaManager.cc Fri Jul 30 17:57:49 2010 +0900 +++ b/TaskManager/Cell/spe/CellDmaManager.cc Fri Jul 30 18:24:08 2010 +0900 @@ -89,6 +89,9 @@ void CellDmaManager::start_profile() { + global_busy_time = 0; + global_mail_time = 0; + global_wait_time = 0; start_dmawait_profile = &CellDmaManager::do_start_dmawait_profile; end_dmawait_profile = &CellDmaManager::do_end_dmawait_profile; } @@ -131,11 +134,24 @@ double r = ((double)global_busy_time)/((double)( global_busy_time+global_wait_time+global_mail_time ))*100.0; + + double d = ((double)global_wait_time)/((double)( + global_busy_time+global_wait_time+global_mail_time + ))*100.0; + + double m = ((double)global_mail_time)/((double)( + global_busy_time+global_wait_time+global_mail_time + ))*100.0; + s->printf("spu%d: busy_time = %lld" - " wait_time = %lld" - " mail_time = %lld" - " busy_ratio = %g%%\n", cpu, global_busy_time, - global_wait_time, global_mail_time, r); + " wait_time = %lld(%.3g%%), " + " mail_time = %lld(%.3g%%), " + " busy_ratio = %.3g%%\n", cpu, global_busy_time, + global_wait_time, d, global_mail_time, m, r); + + global_busy_time = 0; + global_mail_time = 0; + global_wait_time = 0; }
--- a/TaskManager/Cell/spe/ShowTime.cc Fri Jul 30 17:57:49 2010 +0900 +++ b/TaskManager/Cell/spe/ShowTime.cc Fri Jul 30 18:24:08 2010 +0900 @@ -10,8 +10,8 @@ /* * ここで show_dma_wait() を呼びたい */ + // printf("Show Time !\n"); smanager->show_dma_wait(); - //printf("Show Time !\n"); return 0; }
--- a/TaskManager/Cell/spe/main.cc Fri Jul 30 17:57:49 2010 +0900 +++ b/TaskManager/Cell/spe/main.cc Fri Jul 30 18:24:08 2010 +0900 @@ -29,8 +29,6 @@ TaskManagerImpl *manager = new SpeTaskManagerImpl(); - SchedRegister(ShowTime); - SchedRegister(StartProfile); c_scheduler = new CellScheduler(); c_scheduler->init(manager); @@ -38,6 +36,9 @@ manager->set_scheduler(c_scheduler); + SchedRegister(ShowTime); + SchedRegister(StartProfile); + c_scheduler->run(new SchedNop()); c_scheduler->finish();
--- a/TaskManager/ChangeLog Fri Jul 30 17:57:49 2010 +0900 +++ b/TaskManager/ChangeLog Fri Jul 30 18:24:08 2010 +0900 @@ -1,3 +1,7 @@ +2010-7-30 Shinji KONO <kono@ie.u-ryukyu.ac.jp> + + TASK_LIST_MAIL でない方が高速なみたい + 2010-7-24 Shinji KONO <kono@ie.u-ryukyu.ac.jp> やっぱり、load module のlinkの解決はやらないといけないので、
--- a/TaskManager/Makefile.def Fri Jul 30 17:57:49 2010 +0900 +++ b/TaskManager/Makefile.def Fri Jul 30 18:24:08 2010 +0900 @@ -29,8 +29,8 @@ ABIBIT = 32 -#OPT = -O9 -OPT = -g -DTASK_LIST_MAIL -O9 +OPT = -g -O9 +# OPT = -g -DTASK_LIST_MAIL -O9 CC = g++ CFLAGS = -Wall `sdl-config --cflags` -m$(ABIBIT) $(OPT)
--- a/TaskManager/kernel/schedule/DmaManager.h Fri Jul 30 17:57:49 2010 +0900 +++ b/TaskManager/kernel/schedule/DmaManager.h Fri Jul 30 18:24:08 2010 +0900 @@ -13,6 +13,8 @@ DMA_READ_TASKLIST = 31, }; +class Scheduler; + class DmaManager { public: virtual ~DmaManager() {}; @@ -23,7 +25,7 @@ virtual void dma_load(void *buf, memaddr addr, uint32 size, uint32 mask) {} virtual void dma_store(void *buf,memaddr addr, uint32 size, uint32 mask) {} virtual void dma_wait(uint32 mask) {} - virtual void show_dma_wait(int cpu) {} + virtual void show_dma_wait(Scheduler *s, int cpu) {} virtual void start_profile() {} // API for SPU inbound/outbound mailbox
--- a/TaskManager/kernel/schedule/Scheduler.cc Fri Jul 30 17:57:49 2010 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.cc Fri Jul 30 18:24:08 2010 +0900 @@ -4,6 +4,7 @@ #include "Scheduler.h" #include "SchedTask.h" #include "SchedNop.h" +#include "SysFunc.h" #include "error.h" #include <assert.h> #include "TaskManagerImpl.h" @@ -23,7 +24,7 @@ static int null_run(SchedTask* smanager, void* r, void *w) { - smanager->printf("Calling Undefined Task\n"); + smanager->printf("Calling Undefined Task %d\n", smanager->task->command==TaskArray1? smanager->atask->command: smanager->task->command); return 0; }
--- a/TaskManager/kernel/schedule/Scheduler.h Fri Jul 30 17:57:49 2010 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.h Fri Jul 30 18:24:08 2010 +0900 @@ -119,7 +119,7 @@ void dma_load(void *buf, memaddr addr, uint32 size, uint32 mask); void dma_store(void *buf,memaddr addr, uint32 size, uint32 mask); void dma_wait(uint32 mask); - void show_dma_wait() { connector->show_dma_wait(id); }; + void show_dma_wait() { connector->show_dma_wait(this, id); }; void start_profile() { connector->start_profile(); }; void mail_write(memaddr data); memaddr mail_read();
--- a/example/Bulk/Func.h Fri Jul 30 17:57:49 2010 +0900 +++ b/example/Bulk/Func.h Fri Jul 30 18:24:08 2010 +0900 @@ -1,4 +1,4 @@ -enum { +enum Tasks { #include "SysTasks.h" Twice, TwiceMain,