delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/20/12:12:45

Date: Sun, 20 Dec 1998 19:12:39 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Agent Drek <drek AT monsterbymistake DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: cpu eater
In-Reply-To: <367D11FB.121968AC@monsterbymistake.com>
Message-ID: <Pine.SUN.3.91.981220190548.102A-100000@is>
MIME-Version: 1.0
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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019