Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucsd!cacilj!paul From: paul@cacilj.UUCP (Paul Close) Newsgroups: comp.windows.x Subject: How can I evaluate the performance/efficiency of my X program? Message-ID: <1377@cacilj.UUCP> Date: 2 Feb 90 00:26:34 GMT Reply-To: paul@cacilj.UUCP (Paul Close) Organization: CACI Products Company, La Jolla, CA Lines: 40 I have a graphics library which uses Xlib calls to do its work. The programs linked with this library run slower than the equivalent program run on SunView. I would expect some overhead due to communication between server and client, but I would like to examine the issue of performance/efficiency. I started by building a profiled version of Xlib. Unfortunately, most of the real work is being done by the server, as evidenced by the cpu time (around 5% utilized!). My profiled output at least tells me how many calls I am making. Is there some way to figure out how much time each Xlib call is really taking? My application involves animation, so there is a lot of polling, a lot of clipping, and a lot of drawing. Using the profiler, I found that some of the following calls are called the most (roughly in order): XPending (I have to poll for events) _XGenerateGCList _XFlushGCCache XDrawLines XSetForeground XSetClipRectangles XCopyArea XFillRectangle XFillPolygon XSetLineAttributes XSetFillStyle XSetDashes XAllocColor Is the high activity in _XGenerateGCList and _XFlushGCCache indicate that I am not using GCs effectively? I only have two GCs per window, and generally use calls like XSetForeground to set the drawing color before drawing part of an object. In fact, the three routines _XGenerateGCList, _XFlushGCCache, and XSetForeground all have roughly the same number of calls and are near or at the top of the list. Anyone care to comment? -- Paul Close paul@cacilj.CTS.COM ...!{uunet, ucsd, crash}!cacilj!paul The Obi-wan Kenobi method: "Use the Source, Luke" -Jim Fulton