Re: Re : Solaris Performance - Profiling

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Mark kirkwood <markir(at)slingshot(dot)co(dot)nz>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Re : Solaris Performance - Profiling
Date: 2002-03-29 14:44:28
Message-ID: 850.1017413068@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Mark kirkwood <markir(at)slingshot(dot)co(dot)nz> writes:
> I will confess to being a bit of a profile newbie... so if I missed something
> important, please dont hesitate to put me right.

It looks like you profiled the postmaster (parent process), not the
backend you were interested in. I'm aware of two ways to make that
sort of mistake:

1. Backends will drop their gmon.out files into the database
subdirectory they connect to ($PGDATA/base/nnn/gmon.out).
Any gmon.out you see in the top-level directory is from the postmaster
itself or a checkpoint process --- neither of which are likely to be
interesting.

2. I dunno if Solaris has this problem, but on Linux profiling is not
inherited across fork(), so the postmaster's children fail to collect
useful data at all. There is a patch in current sources to work around
this by explicitly re-enabling the ITIMER_PROF interrupt after fork.
If this seems like the problem then try the attached (slightly old)
patch.

regards, tom lane

*** src/backend/postmaster/postmaster.c.orig Wed Dec 12 14:52:03 2001
--- src/backend/postmaster/postmaster.c Mon Dec 17 19:38:29 2001
***************
*** 1823,1828 ****
--- 1823,1829 ----
{
Backend *bn; /* for backend cleanup */
pid_t pid;
+ struct itimerval svitimer;

/*
* Compute the cancel key that will be assigned to this backend. The
***************
*** 1858,1869 ****
--- 1859,1874 ----
beos_before_backend_startup();
#endif

+ getitimer(ITIMER_PROF, &svitimer);
+
pid = fork();

if (pid == 0) /* child */
{
int status;

+ setitimer(ITIMER_PROF, &svitimer, NULL);
+
free(bn);
#ifdef __BEOS__
/* Specific beos backend startup actions */

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Fran Fabrizio 2002-03-29 14:54:18 plperlu
Previous Message Mark kirkwood 2002-03-29 07:24:30 Re : Solaris Performance - Profiling

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-03-29 15:01:02 Re: Bug or feature in 7.3?
Previous Message Thomas Lockhart 2002-03-29 14:29:49 Re: Mailing List Question