www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/20/04:27:43

Date: Sun, 20 Dec 1998 11:27:44 +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: <36792993.F93B6D04@monsterbymistake.com>
Message-ID: <Pine.SUN.3.91.981220112541.27996G-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

On Thu, 17 Dec 1998, Agent Drek wrote:

> I am wondering why it appears that the sleep function with
> the code compiled under DJGPP on the NT seems to use 100% of my CPU???

Are you sure you are measuring the CPU load with a right tool?  I
compiled a program very similar to yours, and it uses a negligible
amount of CPU time while sleeping.  This is because the library
function `sleep' issues the __dpmi_yield call while it waits, which
should release the program's time slice to the OS.

I used the NT-standard Task Manager utility (Press Ctrl-Alt-Del, then 
click "Task manager" and choose Processes) to test this.

> while(1)
> {
> /* Poll render queue file */
> _curr = brqe();
> printf("%u\n",_curr);
> sleep (5);
> }

Could it be that the call to `brqe' is the one where all the CPU is
eaten up?  (Obviously, I couldn't test that, but I replaced it with a
call to `kbhit'.)

- Raw text -


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