From owner-freebsd-hackers Fri Oct 13 14:10:46 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from karon.dynas.se (karon.dynas.se [192.71.43.4]) by hub.freebsd.org (Postfix) with SMTP id 5D4D037B502 for ; Fri, 13 Oct 2000 14:10:42 -0700 (PDT) Received: (qmail 61344 invoked from network); 13 Oct 2000 21:10:39 -0000 Received: from spirit.sto.dynas.se (HELO spirit.dynas.se) (172.16.1.10) by karon.sto.dynas.se with SMTP; 13 Oct 2000 21:10:39 -0000 Received: (qmail 2078 invoked from network); 13 Oct 2000 21:10:53 -0000 Received: from explorer.rsa.com (10.81.217.59) by spirit.dynas.se with SMTP; 13 Oct 2000 21:10:53 -0000 Received: (from mikko@localhost) by explorer.rsa.com (8.11.0/8.11.0) id e9DLAaE94356; Fri, 13 Oct 2000 14:10:36 -0700 (PDT) (envelope-from mikko) Date: Fri, 13 Oct 2000 14:10:36 -0700 (PDT) From: Mikko Tyolajarvi Message-Id: <200010132110.e9DLAaE94356@explorer.rsa.com> To: intmktg@CAM.ORG Cc: freebsd-hackers@freebsd.org Subject: Re: profiling a daemon process Newsgroups: local.freebsd-hackers References: X-Newsreader: NN version 6.5.6 (NOV) Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In local.freebsd-hackers you write: >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'? 1. Unable to create a file in the current directory. Try chdir("/tmp") before exiting. 2. Profiling data is written in an atexit() handler, so had you been using _exit(), there would be no output. Try truss or ktrace on the program, and see if that gives any hints. Try profiling a simpler program (hello.c ...), to make sure that works (it should). $.02, /Mikko -- Mikko Työläjärvi_______________________________________mikko@rsasecurity.com RSA Security To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message