Re: [pgsql-patches] Patch to avoid gprof profiling overwrites

From: Mark Kirkwood <markir(at)paradise(dot)net(dot)nz>
To: korryd(at)enterprisedb(dot)com
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-patches(at)postgresql(dot)org
Subject: Re: [pgsql-patches] Patch to avoid gprof profiling overwrites
Date: 2007-02-01 01:17:24
Message-ID: 45C13FA4.3050800@paradise.net.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

korryd(at)enterprisedb(dot)com wrote:
>> And the patch is where?
>
> You caught me; guess I'd better make something up fast, huh?
>
> Here it is, thanks.
>
> -- Korry
>
>>
>> ---------------------------------------------------------------------------
>>
>> korryd(at)enterprisedb(dot)com <mailto:korryd(at)enterprisedb(dot)com> wrote:
>> > It's difficult to profile a backend server process (using gprof)
>> > because each process overwrites any earlier profile as it exits.
>> >
>> > It is especially tricky to nab a useful profile if you happen to have
>> > autovacuum enabled.
>> >
>> > This patch reduces the problem by forcing the backend to 'cd' to a new
>> > directory ($PGDATA/gprof/pid) just before calling exit(), but only if
>> > the backend was compiled with -DLINUX_PROFILE.
>> >

Nice addition - tested on FreeBSD 6.2, works great!

The name for the define variable could perhaps be better - feels silly
adding -DLINUX_PROFILE on Freebsd! (maybe just PROFILE or GPROF_PROFILE?).

Cheers

Mark

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Koichi Suzuki 2007-02-01 02:07:27 Full page writes improvement
Previous Message korryd 2007-01-31 22:59:21 Re: Patch to avoid gprof profiling overwrites