[GRASS5] 5.7: XDRIVER modification - CPU load

Glynn Clements glynn.clements at virgin.net
Thu Mar 18 13:08:54 EST 2004

Markus Neteler wrote:

> > The XDRIVER should consume less CPU now when querying maps or
> > zooming into. I have added a nanosleep of 500 milliseconds.
> > We have to experiment with this value to find a good one
> > with respect to CPU power, operating system and sleepyness
> > of d.what.vect/d.zoom.
> > 
> > Let me know. The modified file is indicated below.
> Mhh. I just realized that the change is nice for d.what.vect,
> but makes d.zoom extremely slow. Suggestions welcome.

FWIW (and I accept that's probably next to nothing) I would suggest

1. Reverting the Get_location_with_* functions to the 5.3 versions,
and just accepting their limitations.

2. Getting rid of the Get_location_with_* functions altogether, making
the "display" API into a *display* API. Use a GUI toolkit if you want
interaction. [If you got rid of the resize handling at the same time,
the driver architecture (not just XDRIVER) would become vastly
simpler, as you wouldn't need to handle X events *at all*.]

In any case, a busy-wait (repeated non-blocking calls in a loop)
definitely isn't the solution. The only sensible approach is to use
select() on both the X descriptor and the driver socket. Get_Xevent()
already does this; I suggest using it; like 5.0/5.3 do.

Glynn Clements <glynn.clements at virgin.net>

More information about the grass-dev mailing list