From owner-freebsd-current@FreeBSD.ORG Fri Jan 14 22:00:50 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 E43911065674 for ; Fri, 14 Jan 2011 22:00:50 +0000 (UTC) (envelope-from gnn@freebsd.org) Received: from vps.hungerhost.com (vps.hungerhost.com [216.38.53.176]) by mx1.freebsd.org (Postfix) with ESMTP id B98C18FC18 for ; Fri, 14 Jan 2011 22:00:50 +0000 (UTC) Received: from smtp.hudson-trading.com ([209.249.190.9] helo=gnnmac.hudson-trading.com) by vps.hungerhost.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) (envelope-from ) id 1PdqRy-0007p8-UX; Fri, 14 Jan 2011 15:40:46 -0500 Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: George Neville-Neil In-Reply-To: <20110114040549.GA36430@troutmask.apl.washington.edu> Date: Fri, 14 Jan 2011 15:40:46 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <1D4725BB-0A0A-44FB-9FF1-23969C469AA6@freebsd.org> References: <20110113171139.GA32250@troutmask.apl.washington.edu> <20110114040549.GA36430@troutmask.apl.washington.edu> To: Steve Kargl X-Mailer: Apple Mail (2.1082) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vps.hungerhost.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - freebsd.org 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: Fri, 14 Jan 2011 22:00:51 -0000 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: >>=20 >> # kldload hwpmc >> # pmcstat -S unhalted-cycles -O /tmp/samples.out ../penetration >> # pmcstat -R /tmp/samples.out -G /tmp/penetration.txt >>=20 >>=20 >> 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. >=20 >=20 > Thanks. I'll give it a try, but my initial attempt seems to > indicate that one needs to be root to use hwpmc. =20 >=20 > 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 >=20 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 Best, George