Re: Where does the time go?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Where does the time go?
Date: 2006-03-23 19:55:36
Message-ID: 12156.1143143736@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

"Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> writes:
> I've never used gprof before, and from a quick scan of the info, it
> appears that I need to compile and link a special version of the
> software to generate the file that gprof needs. Is this correct? Does
> it work on a Windows build, or will I need to use Linux? Any tips?

I dunno anything about profiling on Windows. If you don't mind moving
the test case to Linux it's pretty easy:

./configure --enable-debug --whatever-other-options
make PROFILE="-pg -DLINUX_PROFILE"
install postgres executable

(On non-Linux Unixen you can omit that -D flag, but otherwise the recipe
is the same.)

Run the test case (you'll want a test script that does the same thing over
and over, enough times to build up a decent set of statistics; I like to
have about a minute's worth of accumulated CPU time in a profile run).
Exit the session --- the gmon.out file will only be dumped at backend
process exit. Then do

gprof /path/to/postgres-executable $PGDATA/gmon.out >outfile

BTW, in 8.1 you want to be sure to do this with autovacuum off, else
exit of the autovacuum process might clobber the gmon.out file before
you can run gprof.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2006-03-23 20:25:08 Re: Static build of psql with readline support
Previous Message Martijn van Oosterhout 2006-03-23 19:50:18 Re: Static build of psql with readline support

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2006-03-23 20:09:44 Re: predicate locking knowledge
Previous Message Martijn van Oosterhout 2006-03-23 19:47:04 Re: Where does the time go?