View Full Version : problems with cpu usage while running linux
12-23-2003, 02:54 PM
I am having cpu usage problems when an application that uses opengl runs. When the application starts the cpu meter instantly reads 99%. I think an incompatibilty with the hardware and opengl is causing the problem. I think the memory is the reason of the incompatibility. The memory type is Kngston KHX 3200A. That is a 512 mb stick.
I will explain the reason I think that the memory is the cause for the incompatibility. When I use Windows the same thing happens. That means that it is not the Direct 3d so it must be OpenGL.
If I change the memory settings the cpu monitor displays different graphs but the cpu usage stays the same.
What I am asking is, will someone tell if there is a way to fix this incompatibility in Linux?
It is not an incompatibility nor is specific to OpenGL. Many many (many) games and some 3d applications use busy wait in their main rendering loop. They are not forced to do that, but it is simpler in many cases.
It looks like that :
If the scene is very simple, you will get hundreds of FramesPerSecond. You won't see then thought, most monitors can't go beyond 100Hz.
It the scene is complex, you will get few FPS. But in both cases your CPU will be used as much as possible. If the scene is very complex for the GPU but simple for the CPU though, you may have less than 100% cpu used. Or you can force vsync.
12-23-2003, 06:04 PM
I understand what you have written. That is not the case though. You are stating that the problem is being caused by the hardware being to slow or the application or video game using more memory then the video card has.
Though, what the problem is, is that Open GL is causing the cpu ussage to read 99% to 100% any time Open GL is used. So the second any Open GL application is the cpu usage goes to 99% using Linux and 50% using Windows with Hyper Threading Enabled or 100% with hyper threading disabled. This happens when using screen savers or games, ect. Therefore, it is apparently not the usage of video memory that is causing the problem.
If it helps the computer I am using has a Intel D875PBZ motherboard, Radeon 9800 pro 256mb, and the Kingston Hyper X. I am 90% sure that the memory is the cause of the problem.
12-23-2003, 08:34 PM
zbuffer_ is correct. Games (and most other graphics apps) spit out as many frames as possible. They use 100% CPU all the time.
It is not an OpenGL problem. It is not a Linux problem.
Try a Direct3D app in Windows. You will see the same behaviour.
Note that the new 2.6 kernel is preemptible and has an anticipatory O(1) scheduler. Desktop responsiveness is much better, even when an app is chewing up 100% cpu. Here's a HOWTO: http://kerneltrap.org/node/view/799
12-23-2003, 08:53 PM
I am positive it is not the games. Cannot use Open GL applications on Linux because cpu usage.
There are several reasons it is not the game. One reason is because the games would not use near that amount of cpu. Also when using any Open GL application the usage goes 00% and stays there. On windows with hyper threading enabled it stays at 50% and when hyper threading is disabled it stays at 100%. The games are not the causing the problem.
Have heard of the 2.6 kernel being released. That won't fix the problem, either. It does the same thing in Windows. Also, the chance of that being a problem with the kernel would be a low chance.
Does anybody know a way to correct this problem? Is there a quick fix that could be applied to the Open GL file/registry?
[This message has been edited by TmsM_374 (edited 12-23-2003).]
[This message has been edited by TmsM_374 (edited 12-23-2003).]
12-24-2003, 03:12 AM
It's neither opengl nor linux, as zbuffer said.
When you start your opengl app, it's simply claiming all the CPU time. Start another one, and each will get 50% of the CPU. This is how linux multitasking works.
If you want your app to use 50% CPU, you need to code it to use less CPU slot. One way would be to call your apps loop on a timer, rather than an idle callback.
On w2k with directx exactly the same thing will happen.
12-24-2003, 09:57 AM
Originally posted by TmsM_374:
There are several reasons it is not the game. One reason is because the games would not use near that amount of cpu.
Umm, yes they would. Almost all games do. There are very few games out there that call Sleep() during their main loop.
Originally posted by TmsM_374:
On windows with hyper threading enabled it stays at 50% and when hyper threading is disabled it stays at 100%. The games are not the causing the problem.
Hyper-threading simulates dual CPU on a single CPU machine. That's probably the behaviour that you are seeing when you say the cpu "stays at 50%".
Not sure why you don't believe the three posters that are refuting your claims. Once again, run a Direct3D app on Windows. You'll see the exact same behaviour.
You have to manage the CPU time with sleep(), usleep() or nanosleep(). In this way your application will sleep and will not use the CPU (so the CPU can be used by other applications running). If you want the highest fps in your OpenGL app you can't use the sleep sys call, but you will use all CPU time aviable!
HyperThreading, memory and other things cannot influence the CPU time used by your application (or minimally). It's a fact.
I am having same problem as TmsM_374. It is not the games that are causing the problem. The opengl apps are. If I run an application that uses over 20x the fps and and would use much more cpu, the cpu usage stays at 28%. If I run any opengl app. (screen saver, visual (doesn't matter which it is, if it is just a 2d ball bouncing over a white background), game etc in windowed mode or fullscreen the cpu immediately is 100%.
I also think it's an incompatibility with the memory (hyper x), but I think that the radeon and D875PBZ motherboard are part of the problem as well. I tried different memory settings and still got the same problem. The cpu graph did change though. I have tried different anounts of memory. I also returned the original hyper x stick for khx3200a, and still got the same problem. Is there an update or some type of a patch or fix?
What video card are TmsM_374 and steven using? Is direct rendering enabled (i.e., "glxinfo | grep -i direct")? If you're not getting direct rendering, all the rendering is done with the CPU, which will eat 100% CPU time. If you are getting direct rendering, some more information will be needed to diagnose things.
Like the other posters have said, it may just be that the programs are just rendering frames as fast as they can (faster than the monitor can display them). When a program runs without waiting, it will eat all the CPU time. It's the same as running gzip on a large file.
I am using a Radeon 9800 Pro. Direct rendering is not enabled. I have had problem with framerate, slow cards, slow processor, ect. in the past. I am using a Radeon 256mb and a P4 3.0g/800mhz.
The computer is plenty fast and when not using Open Gl will run full programs that use much more cpu and frame rate using around 7% of the cpu. When Open GL is enabled the computer usage immediately goes to 100% and stays there without moving. It doesn't matter the program that is used, if it is a writing document that uses Open Gl the computer usage will go to 100%.
both of you have a radeon 9800 pro ?? it should be the problem. more precisely, their (lack of) drivers.
No more ideas though.
The Radeon might be causing the problem. The reasons I think it isn't the Radeon is because.
-Many people use a Radeon and they do not have any problems. That means the chance of it being a Radeon is very rare.
-I have worked with it for a while and based on certain settings and other things I do not think that the Radeon, alone, is causing the problem.
These are the reasons I think the memory has something to do with the problem.
-When the memory timings change the way the cpu usage is being graphed changes.
-There are other reasons that I think the memory has something to do with the problem.
What I think is really causing the problem is an incompatibility with the memory and the Radeon, or the memory and the motherboard, or the memory, Radeon, and motherboard. There is probably an incompatibilty with the hardware I have and Open Gl. If you know how to completely uninstall Open Gl i Linux will you tell me?
Did you download and install ATI's drivers for that card? There are no open-source drivers (i.e., none included automatically with your XFree86 distributions) for that card. ATI has not released the needed documentation to make such a driver possible. You get 100% CPU usage becuase every pixel that is rendered is done with the CPU instead of the graphics card.
I have tried the ATI and Schneider Digital driver for Linux. On Windows I have tried the ATI driver alot. They all do the same thing. If you know will you tell me how to change it so the graphics card does the rendering and not the cpu?
01-26-2004, 06:26 AM
I'm having the same issue. When I start the pc my CPU usage automatically goes to 50%. I have the intel D875PBZ board and a P4 processor that has hyper-threading enabled. could it be the board, SP1, WinXP altogether, or hyper-threading?
01-26-2004, 10:48 PM
Originally posted by steven:
If you know will you tell me how to change it so the graphics card does the rendering and not the cpu?
I suggest you check your XFree86 startup log. /var/log/XFree86.0.log usually. If it says anything in there about "DRI initialization failed", you have a problem :)
The ATI driver will load and X will start but only for basic 2D support. Search the log for LoadModule messages and examine them and see if anything 'fails'.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.