diff options
author | Won Star | 2006-06-03 15:07:26 +0000 |
---|---|---|
committer | Won Star | 2006-06-03 15:07:26 +0000 |
commit | db709f57f694336fbf6bf7d21f61b5f8c35f099b (patch) | |
tree | e3f5af57580b61a3e31da0d4ad320ba6e339ab3f /backends | |
parent | cb50b454e7e734309f6c6aee3e58b2a5a743c3bf (diff) | |
download | scummvm-rg350-db709f57f694336fbf6bf7d21f61b5f8c35f099b.tar.gz scummvm-rg350-db709f57f694336fbf6bf7d21f61b5f8c35f099b.tar.bz2 scummvm-rg350-db709f57f694336fbf6bf7d21f61b5f8c35f099b.zip |
Cleanup. / Add speed meter for 'operator new'
svn-id: r22887
Diffstat (limited to 'backends')
-rw-r--r-- | backends/gp32/gp32_main.cpp | 5 | ||||
-rw-r--r-- | backends/gp32/gp32std.cpp | 26 |
2 files changed, 20 insertions, 11 deletions
diff --git a/backends/gp32/gp32_main.cpp b/backends/gp32/gp32_main.cpp index 8316ead1bb..b05117edc1 100644 --- a/backends/gp32/gp32_main.cpp +++ b/backends/gp32/gp32_main.cpp @@ -66,9 +66,10 @@ void GpMain(void *arg) { gp_setCpuSpeed(g_vars.cpuSpeed); // FOR DEBUG PURPOSE! - int argc = 1; + //int argc = 4; //char *argv[] = { "scummvm", "-enull", "-pgp:\\game\\dott\\", "tentacle" }; - char *argv[] = { "scummvm", "-d9" }; + //int argc = 2; + //char *argv[] = { "scummvm", "-d5" }; extern OSystem *OSystem_GP32_create(); g_system = OSystem_GP32_create(); diff --git a/backends/gp32/gp32std.cpp b/backends/gp32/gp32std.cpp index 5fd86386b8..5622f4d465 100644 --- a/backends/gp32/gp32std.cpp +++ b/backends/gp32/gp32std.cpp @@ -67,7 +67,7 @@ void _dprintf(const char *s, ...) { //gp_fillRect(frameBuffer1, 0, (243 - (DEBUG_MAX * 8) - 4) + 8 * deba, 320, 8, 0); gp_textOut(frameBuffer1, 0, (240 - (DEBUG_MAX * 8) - 4) + 8 * deba, debline[deb], 0xFFFF); } - + // gp_delay(100); } @@ -328,33 +328,41 @@ static char usedMemStr[16]; int gUsedMem = 1024 * 1024; //#define CLEAN_MEMORY_WITH_0xE7 -//#define CHECK_FREE_MEMORY +//#define CHECK_USED_MEMORY +#define CHECK_NEW_TIME void *operator new(size_t size) { +#if defined(CHECK_NEW_TIME) + static int ftick; + ftick = GpTickCountGet(); +#endif // printf("BP:operator new(%d)", size); - void *ptr = malloc(size); + void *ptr = gp_malloc(size); #if defined(CLEAN_MEMORY_WITH_0xE7) if(ptr != NULL) { - memset(ptr, 0xE7, size); + gp_memset(ptr, 0xE7, size); } #endif -#if defined(CHECK_FREE_MEMORY) +#if defined(CHECK_USED_MEMORY) // Check free memory. gUsedMem = ((int)(ptr) + size) - 0xc000000; sprintf(usedMemStr, "%8d", gUsedMem); - //TODO: draw softkeyboard gp_fillRect(frameBuffer1, 0, 0, 64, 12, 0); gp_textOut(frameBuffer1, 0, 0, usedMemStr, 0xfffff); #endif - +#if defined(CHECK_NEW_TIME) + sprintf(usedMemStr, "%2d", GpTickCountGet() - ftick); + gp_fillRect(frameBuffer1, 72, 0, 24, 12, 0); + gp_textOut(frameBuffer1, 72, 0, usedMemStr, 0xfffff); +#endif return ptr; } void operator delete(void *ptr) { // printf("operator delete(%x)", ptr); - free(ptr); + gp_free(ptr); } //////////////////// @@ -400,7 +408,7 @@ char *gp_strdup(const char *str) { if (!str) return NULL; - if (memory = (char *)malloc(strlen(str) + 1)) + if (memory = (char *)gp_malloc(strlen(str) + 1)) return gp_strcpy(memory, str); return NULL; |