Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-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

pgsql-hackers by date

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

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group