Re: Profiling applications

From: Cy Schubert <Cy.Schubert_at_cschubert.com>
Date: Sat, 03 Feb 2024 07:14:28 UTC
On Fri, 02 Feb 2024 16:16:26 -0800
"Chuck Tuffli" <chuck@tuffli.net> wrote:

> What is the recommended way of profiling applications on FreeBSD these days? I’m looking for information like “28% of the execution time is spent in function X”.
> 
> —chuck 

Try DTrace. The DTrace book (if you can get your hands on it) is a good
source of information about profiling. Oracle (formerly Sun) has some
good resources. https://ekamperi.github.io/Geant4/dtrace.html may
provide some pointers. Brendan Gregg's (Brendan wrote DTrace) flame
FlameGraph is another option, though it displays hot PIDs, probably not
what you're looking for.

The DTrace Tookit is in ports. There are some DTrace code samples there.

Once you know where your app is spending its time you can add USDT
probes to allow you to capture snapshots of data structures at points
in time.

-- 
Cheers,
Cy Schubert <Cy.Schubert@cschubert.com>
FreeBSD UNIX:  <cy@FreeBSD.org>   Web:  https://FreeBSD.org
NTP:           <cy@nwtime.org>    Web:  https://nwtime.org

			e^(i*pi)+1=0