From owner-freebsd-current@FreeBSD.ORG Sat Jan 15 06:10:24 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A004106566C; Sat, 15 Jan 2011 06:10:24 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.208.78.105]) by mx1.freebsd.org (Postfix) with ESMTP id DDC408FC1C; Sat, 15 Jan 2011 06:10:23 +0000 (UTC) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.4/8.14.4) with ESMTP id p0F6ANi7041582; Fri, 14 Jan 2011 22:10:23 -0800 (PST) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.4/8.14.4/Submit) id p0F6ANQO041581; Fri, 14 Jan 2011 22:10:23 -0800 (PST) (envelope-from sgk) Date: Fri, 14 Jan 2011 22:10:23 -0800 From: Steve Kargl To: George Neville-Neil Message-ID: <20110115061023.GA41547@troutmask.apl.washington.edu> References: <20110113171139.GA32250@troutmask.apl.washington.edu> <20110114040549.GA36430@troutmask.apl.washington.edu> <1D4725BB-0A0A-44FB-9FF1-23969C469AA6@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1D4725BB-0A0A-44FB-9FF1-23969C469AA6@freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: freebsd-current@freebsd.org, Ryan Stone Subject: Re: Profiling code execution on amd64? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Jan 2011 06:10:24 -0000 On Fri, Jan 14, 2011 at 03:40:46PM -0500, George Neville-Neil wrote: > > On Jan 13, 2011, at 23:05 , Steve Kargl wrote: > > > On Thu, Jan 13, 2011 at 10:08:30PM -0500, Ryan Stone wrote: > >> I would suggest using hwpmc for profiling: > >> > >> # kldload hwpmc > >> # pmcstat -S unhalted-cycles -O /tmp/samples.out ../penetration > >> # pmcstat -R /tmp/samples.out -G /tmp/penetration.txt > >> > >> > >> You can also get pmcstat to generate gprof-compatible output with -g, > >> but I never use the mode so I'm really not sure what it gives you. I > >> think that you have to run gprof on the output or something, but don't > >> hold me to that. > > > > > > Thanks. I'll give it a try, but my initial attempt seems to > > indicate that one needs to be root to use hwpmc. > > > > laptop:kargl[210] pmcstat -S unhalted-cycles -O /tmp/samples.out ../penetration > > pmcstat: ERROR: Cannot allocate system-mode pmc with specification > > "unhalted-cycles": Operation not permitted > > > > You only need to be root to profile the kernel or someone else's process. > > This tutorial might help: > > www.dcbsdcon.org/speakers/slides/neville-neil_dcbsdcon2009.pdf > Thanks. I'll look at the tutorial. Meanwhile, should gprof be removed from the base system because it appears broken? -- Steve