Profiling with LDC

Dmitry Olshansky dmitry.olsh at gmail.com
Thu Apr 26 06:12:02 UTC 2018


On Wednesday, 25 April 2018 at 17:31:06 UTC, H. S. Teoh wrote:
> I'm trying to figure out how to do a traditional instrumented 
> profile with LDC.  All docs that I've managed to find so far 
> say to use -fprofile-instr-generate, but when I try that, I get 
> a ton of linker errors complaining of undefined reference to 
> the symbol:
>
> 	__llvm_profile_instrument_target
>
> What gives?  I'm guessing I need to specify some additional 
> LLVM libraries for this?

I’d suggest perf if you are on Linux. It also tracks kernel-land 
calls if you have permissions.

Just compile with debug symbols and run:

perf record -g ./app ...
perf report

Works for both DMD and LDC. It is sampling, so might not be 
accurate for short lived stuff.

>
> I'm using the official Debian ldc package, btw.  Is there 
> possibly a missing dependency on some llvm libraries?
>
>
> T




More information about the Digitalmars-d mailing list