From owner-freebsd-hackers Fri Oct 13 10:39:39 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id 1797E37B670 for ; Fri, 13 Oct 2000 10:39:36 -0700 (PDT) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id e9DHdVH19438; Fri, 13 Oct 2000 10:39:31 -0700 (PDT) Date: Fri, 13 Oct 2000 10:39:31 -0700 From: Alfred Perlstein To: Marc Tardif Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: profiling a daemon process Message-ID: <20001013103931.K272@fw.wintelcom.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.4i In-Reply-To: ; from intmktg@CAM.ORG on Fri, Oct 13, 2000 at 01:27:03PM -0400 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * Marc Tardif [001013 10:28] wrote: > I am trying to profile a daemon process, but no gmon.out > file is ever created on FreeBSD. When I brought my code > to Linux, I managed to get the graph profile file. > > First, I compiled everything with the -pg flag, as I would > any other program. Then, I run the program which is forked > to background and send a few queries to the daemon. Finally, > I kill the process using the TERM signal, which is caught > and closes everything nicely before exiting (main returns > 0). Yet, no profile seems to be created. > > I then proceeded to make a few changes to help the profiler. > First, I commented out the forking of the server process so > that the process could be kept in the foreground. Still no > profile. I then changed my program so that it doesn't exit > on a signal. Still no profile. > > So what could be the potential reasons for this problem > knowing the program doesn't fork and exits on '0'? I never have problems doing this, it might help to compile with -g flags, the only difference that I see between what we're doing is that I return from my signal handler after setting a global volatile variable to shutdown which my main loop polls, perhaps exiting from within a signal handler is causing you problems. -- -Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org] "I have the heart of a child; I keep it in a jar on my desk." To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message