Performance issues with XDefineCursor and XtAddTimeOut

walter harms wharms at bfs.de
Fri Mar 4 08:52:48 PST 2011



Am 04.03.2011 14:52, schrieb Guy Léonis:
> Hello,
> 
> I went through all FAQ and Archives without being able to find anything about my performances issues.
> I apologize in case I did my searches the wrong way.
> If you need more information on my side, I will do my best to provide you with the requested files and logs.

> Issue 2 (info):
> ===============
> In the frame of the same application, there are 2 threads. The first thread, which is totally free of X calls, manages a PCMCIA MIL-1553-STD bus card and stores uploaded data. The second thread, which gather all X calls, displays uploaded data. The X thread polls the data buffer every millisecond thanks to XtAddTimeOut(1,...).
> On the old A31P, this was perfect (no performance issue, CPU use of 0.1% or so). To be honest, the TO callback was actually activated only every 10 milliseconds.
> On the T61p with RHEL or FC14, this is not nice. This time, the TO callback is activated every millisecond but the X thread consume 100% of the CPU time provided by one core.
> I have used XtAddTimeOut(10,...) instead, and the CPU load goes down to ~4% without visible impact at user level. This is a fine work around for our application.
> In any cases (i.e. any CPU load), this is not a true problem, the X thread being fully responsive to user actions, display updates and (fixed) cursor moves. By the way, 100%, 4% or even a lower CPU load doesn't impact the cursor issue (see Issue 1).
> I have attached a minimum code example to evidence the issue (usage: xtoperfo #loop interval), together with files created by gprof under FC14 showing that each call to XtAddTimeOut generates about 150 loops within XtMainLoop (shorter interval means more loops!). See attached fc14.xtoperfo*log files as examples (10000 loops with both 1 and 10 ms intervals).
> It should be possible to suppress much of this overhead (e.g. see RHEL 3.0 implementation) and then to avoid having a 100% CPU load.
> 
> 

hi,
did some tests with your programm on my desktop an it seems to work as expected.
I made my own version and i get compareable results (code attached).

How do you monitor cpuload ? the linux kernel has changed in the last versions
(e.g. tickless) and this will result in different measures.
that you see 100% cpu utilisation may simply down to better measurements.
When i run my test several times i used /usr/bin/time to measure execution time
and that behaves as expected.

re,
 wh

-------------- next part --------------
A non-text attachment was scrubbed...
Name: xtoperfo2
Type: application/octet-stream
Size: 13546 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20110304/6d6254e7/attachment.obj>


More information about the xorg mailing list