Re: Roundtrip in gdk_flush()



Soeren Sandmann <sandmann daimi au dk> writes:

> I had gdk_flush() show up with around 25% in a profile, and I noticed
> this in gdkevents-x11.c:
> 
>         void
>         gdk_flush (void)
>         {
>           XSync (gdk_display, False);
>         }
> 
> XSync() waits for all requests to be completed before returning, ie,
> it is a round-trip. Is there any reason this isn't an XFlush() (which
> just flushes XLib's buffers and returns)?

Because we use it all over the place as a sync. :-)

(I think the reason for the name is that Peter started off with only
flushing, but then realized that he needed to sync in a lot of places
so, instead of changing all those places, he changed what gdk_flush()
did.)

I think except on SMP machines, the 25% in gdk_flush() doesn't
indicate any real problems... we are just waiting for the X server to
catch up.  (Even in SMP cases, I don't think there is any point in
getting ahead of the X server; we'd just end up blocking with full
request queues a little later anyways.)

It's not like we call gdk_flush() a lot; the reason that it shows up
is that the gdk_flush() that we do gdk_window_process_all_updates() is
just about the _only_ round trip to the server we do.

Regards,
                                           Owen



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]