diff options
author | Max Lingua | 2014-01-23 01:29:30 -0500 |
---|---|---|
committer | Max Lingua | 2014-01-23 18:34:44 -0500 |
commit | c16c6653a112307d4f5ded3c3533f9621a945cb3 (patch) | |
tree | 9eea49b9f03cb9795602640f00d7a643c3f1e37f /backends/platform/ps2/systemps2.cpp | |
parent | ab3a1b5e0cfa2090cb0c9df3cf18dfc3fb057bc9 (diff) | |
download | scummvm-rg350-c16c6653a112307d4f5ded3c3533f9621a945cb3.tar.gz scummvm-rg350-c16c6653a112307d4f5ded3c3533f9621a945cb3.tar.bz2 scummvm-rg350-c16c6653a112307d4f5ded3c3533f9621a945cb3.zip |
PS2: Improved support for profiling (gprof) build
Diffstat (limited to 'backends/platform/ps2/systemps2.cpp')
-rw-r--r-- | backends/platform/ps2/systemps2.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp index e800c6cb21..f3807ea91f 100644 --- a/backends/platform/ps2/systemps2.cpp +++ b/backends/platform/ps2/systemps2.cpp @@ -150,6 +150,10 @@ extern "C" int main(int argc, char *argv[]) { g_systemPs2->quit(); +#ifdef ENABLE_PROFILING + // make sure we can flush "gmon.out" + fileXioSetBlockMode(FXIO_WAIT); +#endif // control never gets here return res; } @@ -467,15 +471,25 @@ void OSystem_PS2::initTimer(void) { _timerStack = (uint8 *)memalign(64, TIMER_STACK_SIZE); _soundStack = (uint8 *)memalign(64, SOUND_STACK_SIZE); + // gprof doesn't cope with higher thread priority too well + #ifdef ENABLE_PROFILING + timerThread.initial_priority = thisThread.current_priority; + #else // give timer thread a higher priority than main thread timerThread.initial_priority = thisThread.current_priority - 1; + #endif timerThread.stack = _timerStack; timerThread.stack_size = TIMER_STACK_SIZE; timerThread.func = (void *)systemTimerThread; timerThread.gp_reg = &_gp; + // gprof doesn't cope with higher thread priority too well + #ifdef ENABLE_PROFILING + soundThread.initial_priority = thisThread.current_priority; + #else // soundthread's priority is higher than main- and timerthread soundThread.initial_priority = thisThread.current_priority - 2; + #endif soundThread.stack = _soundStack; soundThread.stack_size = SOUND_STACK_SIZE; soundThread.func = (void *)systemSoundThread; @@ -883,7 +897,10 @@ void OSystem_PS2::quit(void) { printf("OSystem_PS2::quit called\n"); if (_bootDevice == HOST_DEV) { printf("OSystem_PS2::quit (HOST)\n"); + #ifndef ENABLE_PROFILING SleepThread(); + #endif + // exit(0); } else { printf("OSystem_PS2::quit (bootdev=%d)\n", _bootDevice); if (_useHdd) { |