Tweaking a C Function I wrote

Поиск
Список
Период
Сортировка
Искать

Tweaking a C Function I wrote

От:
Adam Palmblad <adam@aers.ca>
Дата:
I wanted to see if I could squeeze any more performance out of a C set 
returning function I wrote.  As such, I looked to a profiler.  Is it 
possible to get profile information on the function I wrote?  I've got 
postmaster and my function compiled with profiling support, and can find 
the gmon.out files... can I actually look at the call tree that occurs 
when my function is being executed or will I be limited to viewing calls 
to functions in the postmaster binary?

-Adam

Re: Tweaking a C Function I wrote

От:
Neil Conway <neilc@samurai.com>
Дата:
Adam Palmblad wrote:
> can I actually look at the call tree that occurs when my function is
> being executed or will I be limited to viewing calls to functions in
> the postmaster binary?

You're the one with the gprof data, you tell us :)

It wouldn't surprise me if gprof didn't get profiling data for dlopen'ed 
shared libraries (I haven't checked), but I think both oprofile and 
callgrind should be able to.

(If you do decide to use gprof and you're on Linux, be sure to compile 
Postgres with CFLAGS="-DLINUX_PROFILE", to get valid profiling data.)

-Neil

Re: Tweaking a C Function I wrote

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Neil Conway  writes:
> It wouldn't surprise me if gprof didn't get profiling data for dlopen'ed 
> shared libraries (I haven't checked), but I think both oprofile and 
> callgrind should be able to.

None of the platforms I use are very good at this :-(.  Consider
building a special backend binary with the functions of interest
statically linked into it...

			regards, tom lane
FAQ