From nobody Sat Feb 03 07:48:32 2024 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TRlBf3LHXz58qnT for ; Sat, 3 Feb 2024 07:48:42 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4TRlBf0ZRPz4JKv for ; Sat, 3 Feb 2024 07:48:41 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Authentication-Results: mx1.freebsd.org; none Received: from critter.freebsd.dk (unknown [192.168.55.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by phk.freebsd.dk (Postfix) with ESMTPS id 480FC89284; Sat, 3 Feb 2024 07:48:33 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.17.1/8.16.1) with ESMTPS id 4137mWB5030835 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 3 Feb 2024 07:48:33 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.17.1/8.16.1/Submit) id 4137mWtA030834; Sat, 3 Feb 2024 07:48:32 GMT (envelope-from phk) Message-Id: <202402030748.4137mWtA030834@critter.freebsd.dk> To: "Chuck Tuffli" cc: freebsd-hackers@freebsd.org Subject: Re: Profiling applications In-reply-to: From: "Poul-Henning Kamp" References: List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <30832.1706946512.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Sat, 03 Feb 2024 07:48:32 +0000 X-Rspamd-Queue-Id: 4TRlBf0ZRPz4JKv X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:1835, ipnet:130.225.0.0/16, country:EU] Chuck Tuffli writes: > What is the recommended way of profiling applications on FreeBSD these d= ays? > I'm looking for information like '28% of the execution time is spent in = function X'. I would start with basic-block profiling: gcov(1)/llvm-cov(1) It will not give you the /time/ spent in your functions, but it will tell you how many times each unbranched sequence of code was executed. I personally find that to be much more valuable information than time spent, because it also reveals a lot about the data being processed, average operations to find things in trees/lists etc. Here's an example of that: http://varnish-cache.org/gcov/bin/varnishd/cache/cache_esi_parse.c.html That is from the gcov which is part of Varnish Cache CI: http://varnish-cache.org/gcov/ (The python3 scripts to make HTML out of the gcov output are our own and know a lot about the Varnish source tree, but it can undoubtedly be adapted.) -- = Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe = Never attribute to malice what can adequately be explained by incompetence= .