Opened 14 years ago

Closed 14 years ago

Last modified 5 years ago

#4733 closed defect

BS2: 100% CPU usage

Reported by: SF/flamingolof Owned by:
Priority: normal Component: Engine: Sword2
Version: Keywords:
Cc: Game: Broken Sword 2

Description

BS2 starts using 100% CPU after a while. I don't know if this is related but If I run it in fullscreen it drops back to windowed mode sometimes, and goes back to fullscreen after approximately a minute. This occurs every time I start the game Scumm version: 1.0.0 deb package Game language: English Version: CD? Platform: Ubuntu Karmic 64

Ticket imported from: #2921679. Ticket imported from: bugs/4733.

Change History (12)

comment:1 by eriktorbjorn, 14 years ago

I have no idea why it would do either of those, but I've never had the chance to try it on a 64-bit platform. Most of the time, it's drawing 12 frames per second, which I can't imagine causing much load on today's computers. (Unless maybe if you're using one of the fancier 2x or 3x graphics scalers.) The only exception should be while the screen is scrolling, because it outputs extra frames to make the movement smoother. But even then, it shouldn't go to 100%.

The only thing I can think of is to try and see if anything else is interacting badly with ScummVM. For instance, if you're using one of those fancy 3D accelerated desktops, you could try disabling that temporarily. But that's really just a shot in the dark.

comment:2 by SF/flamingolof, 14 years ago

Component: Engine: Sword2
Game: Broken Sword 2

comment:3 by SF/flamingolof, 14 years ago

Good idea, but disabling Compiz didn't improve anything. However, I must change the description a bit. It seems that the 100% cpu usage occurs as soon as I starter the launcher, without any game running

comment:4 by SF/flamingolof, 14 years ago

Downgrading to the rc1 version from the official repos didn't improve situation either. Can anyone provide me with some pointers for debugging this issue? I have never had problems with scumm on any platform in the last five years at least, so for me this feels like a real regression

comment:5 by eriktorbjorn, 14 years ago

> Can anyone provide me with some pointers for debugging this issue?

I'm not sure. The GUI's main event loop should be the GuiManager::runLoop() function in gui/GuiManager.cpp. There's a call there to _system->delayMillis(10). This tells the process to "sleep" for a while, which is what *should* keep it from hogging the CPU. You could try changing the 10 to 1000, which will make the GUI very unresponsive since it's only allowed to update the screen once every second.

If it still uses 100% CPU... well, there are one or two other threads running, I guess. There's the sound thread, which causes mixCallback() to be called periodically, and the timer thread which causes timer_handler() to be called periodically. Both these functions are defined in backends/platform/sdl/sdl.cpp. I guess that removing the calls to SDL_PauseAudio(0) and SDL_AddTimer() respectively will disable those. (ScummVM might break, but the GUI should still work.)

If it still uses 100% CPU, I have no idea.

comment:6 by fingolfin, 14 years ago

Summary: 100% CPU usageBS2: 100% CPU usage

comment:7 by fingolfin, 14 years ago

What is the status of this report?

Maybe you could use a profiler to figure out where it spends all that time?

comment:8 by fingolfin, 14 years ago

This tracker item is pending response by the submitter; we cannot continue processing it before that happens. As a consequence, its status has been set to "Pending". It will automatically revert to "Open" once a new comment is made to this item. If no response is made within 14 days, it will automatically be closed.

Thank you.

comment:9 by fingolfin, 14 years ago

Status: newpending

comment:10 by SF/sf-robot, 14 years ago

This Tracker item was closed automatically by the system. It was previously set to a Pending status, and the original submitter did not respond within 14 days (the time period specified by the administrator of this Tracker).

comment:11 by SF/sf-robot, 14 years ago

Status: pendingclosed

comment:12 by digitall, 5 years ago

Component: Engine: Sword2
Game: Broken Sword 2
Note: See TracTickets for help on using tickets.