[Xastir] Xastir -CPU

Henk de Groot henk.de.groot at hetnet.nl
Sat Sep 18 13:20:50 EDT 2004


At 19:17 16-9-2004 -0700, Curt Mills wrote:
>Henk de Groot has been keeping me informed of such things.  I think
>he may do a bit more work on getting that CPU usage down on Cygwin.
>I have a hard time finding test machines to do it with.

Unfortunately I'm a bit busy at work with courses and setting up a 
data-warehouse. All nice, but doesn't leave much room to do anything else.

>If you get a chance though, crank up "nexttime" in
>main.c:UpdateTime() to see if it helps on Cygwin.  Henk was doing
>some of that and got it down to 30% or so.  If you can do a bit more

I did some checking, executing usleep(2) for 10.000 times takes about 20 
seconds, so usleep(2) takes 2 ms. I checked with usleep(1000) and like I 
suspected that takes just as long.

So the two usleep calls add a 4 ms delay in the loop, so instead of 
sleeping on the job I changed nexttime to 6. This also gives 30% CPU load. 
When I shut down the ZoneAlarm firewall the load drops to 5%, but that of 
course leaves my PC wide open for attacks.

So the usleep function in Cygwin seems to have a granularity of 2ms. Each 
usleep seems to sleep for at least one timer-tick. Maybe Linux systems to 
the same, what granularity does their timer have?.

The big question is, what revolution time does UpdateTime actually require. 
The load is low when you assign 250 to the nexttime variable, but I wonder 
if a latency in handling the timers of 0.25 sec acceptable and if it 
doesn't create a backlog.

When putting a value like 6 then I get about 30% CPU load (according to 
XP's taskman program, I haven't looked with perfmon).

I see the value is now set to 200 and looks good now. Still I wonder what's 
causing the load and if it can be reduced another way.

Kind regards,

Henk.





More information about the Xastir mailing list