Date: Sun, 20 Dec 1998 19:12:39 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Agent Drek cc: djgpp AT delorie DOT com Subject: Re: cpu eater In-Reply-To: <367D11FB.121968AC@monsterbymistake.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com On Sun, 20 Dec 1998, Agent Drek wrote: > main() > { > while(1) > { > /* Poll render queue file */ > /* _curr = brqe(); */ > printf("%u\n",_curr); > sleep (15); > } > } > > that still measured 100% CPU on the NT (with the Task Manager) This is exactly like the program I used (except that I also had a call to kbhit() inside the loop). And I didn't see any change in the CPU usage (it was about 11% before I run the program, and the same 11% when it runs). Is it possible you are using some version of `sleep' other than the one from the library? If not, it seems that either (1) some other process is eating the CPU cycles on your system; or (2) there's something in how your system is set up that is different from the one I tested that on. In any case, this is not the problem with the program, but with your system, or so it seems. > are there options I could pass to gcc? GCC options cannot usually affect CPU usage by a program. For the record: I compiled with "gcc -Wall -g -O" (the last one is the capital letter O, not a zero). > (maybe it's because some debugging stuff is going on?) What debugging stuff? Did you run that from RHIDE, or some other debugger? I just ran the program from the DOS prompt in a DOS box. If you run the program from RHIDE, or some other program, then that other program could be eating the CPU cycles. > or could it be the while? My program also used while. > I am just confused because the same code works great on my SGI. It also works great on my NT and on Windows 9X as well.