Re: Where does the time go? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Where does the time go?
Date
Msg-id 12156.1143143736@sss.pgh.pa.us
Whole thread Raw
In response to Re: Where does the time go?  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
List pgsql-hackers
"Kevin Grittner" <Kevin.Grittner@wicourts.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-optionsmake 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


pgsql-hackers by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Static build of psql with readline support
Next
From: Andrew Dunstan
Date:
Subject: Re: Static build of psql with readline support