| Summary: | SDL_delay is a cpu hog | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Sylvain Bougerel <sylvain.bougerel.devel> |
| Component: | timer | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED WORKSFORME | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | 1.2.12 | ||
| Hardware: | x86 | ||
| OS: | Linux | ||
|
Description
Sylvain Bougerel
2007-09-28 19:44:12 UTC
Hi, I just realized that there is a small range of values that doesn't hog the CPU: from 33 to 41 milliseconds exactly; 41 resulting in the lowest CPU usage (~4%); 33 the highest CPU usage (~60%). Outside this range, CPU usage is at 100%. I get the feeling that these values depend on my machine. Is there a way to make this portable to other machines (including windows platforms)? Have you tried inserting debug output to see what's going on? If you want, I can log in and see if I can help debug this. Please send me e-mail directly at slouken@libsdl.org if you would like me to check it out on your system. I have a suspicion that this happens with the CK kernel patches. We saw similar things in the Call of Duty 4 and Unreal Tournament 3 dedicated servers; they should use around 0% CPU when no one is playing on the box, but the CK patches were running at around 75% CPU for this idle state. My guess is that it decides to "idle" a process when waiting on i/o, but just reschedules the process immediately if there's nothing to do and it's otherwise sleeping...it probably results in better performance (that is, lower latency) at the cost of cooking the CPU more. This is just a guess, though. --ryan. Resolving bug as WORKSFORME...I'm sticking with my guess that it was a CK scheduler. --ryan. |