[cairo] Re: [poppler] Re: poppler profiling on geode with
cairo backend
Jeff Muizelaar
jeff at infidigm.net
Tue Nov 14 17:19:36 PST 2006
On Tue, Nov 14, 2006 at 04:05:07PM -0800, Carl Worth wrote:
> I've attached the patch below, (Jeff, please advise me if the
> copyright line should be anything different before I include this in
> cairo itself). It's also in a branch named unaligned-clip in my
> personal tree.
That copyright line is fine.
> > On a slightly related note, to investigate this problem I made a library
> > that wraps all of the calls to cairo functions and logs them to stdout.
> > usage is something like the following:
> >
> > $ LD_PRELOAD=libcairowrap.so ./clip
> > cairo_image_surface_create(0, 100, 100)
> > cairo_create(0x80537b0)
>
> This kind of thing looks extremely interesting to me! I've often
> wanted something like this to be able to extract code snippets from
> programs. Here are a couple of things I'd like to see in addition:
>
> 1) It would be nice if it could log the return values from
> surface_create and cairo_create so they could be correlated with
> usage later.
I added this. Right now it prints the return value after the function
call like this:
cairo_image_surface_create(0, 100, 100) = 0x80537b0
cairo_create(0x80537b0) = 0x8053898
cairo_move_to(0x8053898, 50, 50)
Printing the value before might be better for turning the logs into
code, but this was easier for now.
>
> 2) It might be handy if there were an easy way to start and stop the
> logging so I could focus the extraction on one single chunk of a
> program's behavior.
Any idea's about a good way to do this?
The best I could come up with is to install a signal handler for
something like SIGUSR1 and when we get that signal turn on the logging.
If we get the signal again turn it off.
Control would then be like:
$ kill -USR1 [pid] # start logging
[do logging]
$ kill -USR1 [pid] # stop logging
The problem with this apporach is that it is sort of invasive and will
not work if the program actually uses or handles SIGUSR1. Nonetheless,
I'll try to implement it when I get the time.
In the mean time the first release is available at:
http://people.freedesktop.org/~jrmuizel/libcairowrap-0.1.tar.gz
-Jeff
More information about the cairo
mailing list