From owner-freebsd-toolchain@FreeBSD.ORG Tue Jan 18 16:02:53 2011 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3471D106566C; Tue, 18 Jan 2011 16:02:53 +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 EB41B8FC0A; Tue, 18 Jan 2011 16:02:52 +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 p0IG2q97010558; Tue, 18 Jan 2011 08:02:52 -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 p0IG2qjB010554; Tue, 18 Jan 2011 08:02:52 -0800 (PST) (envelope-from sgk) Date: Tue, 18 Jan 2011 08:02:52 -0800 From: Steve Kargl To: Roman Divacky Message-ID: <20110118160252.GA6506@troutmask.apl.washington.edu> References: <20110117184411.GA54556@troutmask.apl.washington.edu> <20110118143205.GA34216@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110118143205.GA34216@freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: freebsd-toolchain@freebsd.org Subject: Re: How to build an executable with profiling? X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Jan 2011 16:02:53 -0000 On Tue, Jan 18, 2011 at 03:32:05PM +0100, Roman Divacky wrote: > On Mon, Jan 17, 2011 at 10:44:11AM -0800, Steve Kargl wrote: > > How does one build an executable for profiling with clang? > > LLVM (and thus clang) does not support GPROF profiling. > > > clang -o testf -O2 -march=native -pipe -static -pg -I/usr/local/include -I../mp testf.c -L/usr/local/lib -L../mp -lsgk -lmpfr -lgmp -L/usr/home/kargl/work/lib -lm_clang_p > > clang: warning: the clang compiler does not support '-pg' > > > > I suppose it will be pointless to ask, but shouldn't clang > > support one of the most basic gcc compiler options if clang > > is to replace gcc as the base system compiler? > > is GPROF really needed at this point? we have HWPMC, isnt > it sufficient? > Well, I have not found a suitable command or commands to replace cc -o testf -O2 -march=native -pipe -static -pg testf.c -lm_p ./testf -s -n 10 10000000 expf calls in 1.846954 seconds. gprof -b -l ./testf testf.gmon | head -15 |tail -10 granularity: each sample hit covers 4 byte(s) for 0.01% of 1.84 seconds % cumulative self self total time seconds seconds calls ms/call ms/call name 55.8 1.03 1.03 0 100.00% _mcount [1] 22.9 1.45 0.42 10000000 0.00 0.00 t_expf [4] 12.9 1.68 0.24 1 236.65 709.57 main [2] 5.6 1.79 0.10 0 100.00% .mcount (29) 2.8 1.84 0.05 10000000 0.00 0.00 __fpclassifyf [5] 0.0 1.84 0.00 6 0.00 0.00 memchr [6] 0.0 1.84 0.00 6 0.00 0.00 memcpy [7] Not to mention, one needs to compile a kernel with hwpmc included whereas gprof does not require a special kernel device driver. -- Steve