Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 03 Feb 2024 07:48:32 +0000
From:      "Poul-Henning Kamp" <phk@phk.freebsd.dk>
To:        "Chuck Tuffli" <chuck@tuffli.net>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Profiling applications 
Message-ID:  <202402030748.4137mWtA030834@critter.freebsd.dk>
In-Reply-To: <efe56bdc-b4a8-4452-add3-a5b01c8a856a@app.fastmail.com>
References:  <efe56bdc-b4a8-4452-add3-a5b01c8a856a@app.fastmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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=
.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202402030748.4137mWtA030834>