High CPU usage with tabs and GTK

2012-02-26 Thread Neil Whelchel
Hello,
I am working with a pygtk program that draws various forms for data input.
Any time that I use tabs, I end up with 100% CPU usage. As soon as I remove
the tabs, the CPU returns to idle. I did some research on the 'net and I
found a number of people complaining about slow rendering when tabs are
involved, however I think this might not be related. There seems to be no
noticeable effect on the speed of the application, it does not seem slow
when changing tabs, and all except for gtk.events_pending() never returning
false when any tabs are on the screen, it works as expected. I ran strace
on the app, and there is a huge amount of repeating chatter (below) between
X and the app over the socket when ever tabs are used. From the python end,
things are idle, so the chatter is likely generated somewhere within the
gtk main loop. gtk.pygtk_version(2, 24, 0) gtk.gtk_version(2, 24, 6)
X -version
X.Org X Server 1.10.4
Release Date: 2011-08-19
X Protocol Version 11, Revision 0
Build Operating System: Linux 2.6.24-29-server x86_64 Ubuntu
NVIDIA-Linux-x86_64-295.20

I was able to re-produce the problem with an older computer running the
same versions of the above except that it is a 32 bit Intel and the Nvidia
driver is 96.43.20.

Here is a cut and paste of what strace shows, the messages repeat about 90
times per second when tabs are active.
...
[pid 17723] writev(6, [{"5
\4\\"`\5.\"`\5\7\0\1\0H\2\r\\"`\5\10\0`\5\7\0\1\0"..., 244}, {NULL,
0}, {"", 0}], 3) = 244
[pid 17723] poll([{fd=6, events=POLLIN}], 1, -1) = 1 ([{fd=6,
revents=POLLIN}])
[pid 17723] read(6, "\1
\226\226\304\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"...,
4096) = 816
[pid 17723] read(6, 0x1e3a6c4, 4096)= -1 EAGAIN (Resource temporarily
unavailable)
[pid 17723] read(6, 0x1e3a6c4, 4096)= -1 EAGAIN (Resource temporarily
unavailable)
[pid 17723] poll([{fd=6, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=6,
revents=POLLOUT}])
[pid 17723] writev(6, [{"5
\4\0004\"`\0052\"`\5\2\0\1\0H\2\10\0004\"`\5\10\0`\5\2\0\1\0"..., 224},
{NULL, 0}, {"", 0}], 3) = 224
[pid 17723] poll([{fd=6, events=POLLIN}], 1, -1) = 1 ([{fd=6,
revents=POLLIN}])
[pid 17723] read(6, "\1
\241\226\304\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"...,
4096) = 816
[pid 17723] read(6, 0x1e3a6c4, 4096)= -1 EAGAIN (Resource temporarily
unavailable)
[pid 17723] read(6, 0x1e3a6c4, 4096)= -1 EAGAIN (Resource temporarily
unavailable)
[pid 17723] poll([{fd=6, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=6,
revents=POLLOUT}])
...

Fd 6 is the socket as described below:
socket(PF_FILE, SOCK_STREAM|SOCK_CLOEXEC, 0) = 6
connect(6, {sa_family=AF_FILE, path=@"/tmp/.X11-unix/X0"}, 20) = 0

Thanks in advance for any suggestions,
-Neil-
___
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.x.org/mailman/listinfo/xorg
Your subscription address: arch...@mail-archive.com

Re: High CPU usage with tabs and GTK

2012-02-29 Thread Neil Whelchel
Hello,
Thank you for pointing out xscope, I didn't know about it.
I ran my app under xscope and the first thing I noticed was that there were
many DAMAGE-Event related messages, about 90 groups of them per second. So
on a hunch, I disabled DAMAGE in X and the problem of the constant chatter
went away completely, the CPU went to 0%-1% with tabs in the app and
gtk.events_pending() returns False as soon as the window is rendered just
like I expect it to. The output of xscope is very verbose, so what
arguments do you recommend I use to narrow down the output to something
useful? I was attempting to find a repeating pattern that I could post
here, but the damage events all seemed to be mixed in with a lot of stuff
that doesn't have a short term repeat. So, here is a semi random excerpt
from the log that looked like it might apply:
Thank you,
-Neil-



 6.35:64 bytes <-- X11 Server
 ..EVENT: DAMAGE-Event
  detail: 02
data: 8b 09 20 06
8c 09
 ..REPLY: GetGeometry
   depth: 18
root: WIN 0043
   x: 4
   y: 25
   width: 00eb
  height: 02bd
border-width: 

6.33: Client -->  128 bytes
 REQUEST: XFIXES-Request
minor opcode: 05
data: (3)
 REQUEST: DAMAGE-Request
minor opcode: 03
data: (3)
 REQUEST: XFIXES-Request
minor opcode: 0a
data: (1)
 REQUEST: CreatePixmap
   depth: 18
   pixmap-id: PXM 06200d76
drawable: DWB 06200061
   width: 00ef
  height: 02c1
 REQUEST: RenderRequest
   RENDERREQUEST: RenderCreatePicture
 picture: PICTURE 06200d77
drawable: DWB 06200d76
  format: PICTFORMAT 0029
  value-mask: 0
 REQUEST: RenderRequest
   RENDERREQUEST: RenderFillRectangles
  op: Over
dest: PICTURE 06200d77
   color: COLOR r:d5d5 g:d1d1 b:cfcf a:
  rectangles: (1)
 REQUEST: GetProperty
  delete: False
  window: WIN 06200061
property: ATM 019d
type: 
 long-offset: 


On Mon, Feb 27, 2012 at 11:53 AM, Adam Jackson  wrote:

> On Fri, 2012-02-24 at 23:40 -0800, Neil Whelchel wrote:
>
> > Here is a cut and paste of what strace shows, the messages repeat
> > about 90 times per second when tabs are active.
>
> strace output is unpleasantly difficult to read for this purpose.  Try
> using xscope instead:
>
> http://cgit.freedesktop.org/xorg/app/xscope/
>
> - ajax
>
___
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.x.org/mailman/listinfo/xorg
Your subscription address: arch...@mail-archive.com