LDC2 and classic profiling

Johan Engelen j at j.nl
Sat May 11 09:12:24 UTC 2019


On Saturday, 11 May 2019 at 06:59:52 UTC, Denis Feklushkin wrote:
> On Saturday, 11 May 2019 at 05:46:29 UTC, Denis Feklushkin 
> wrote:
>
>> All another calls is made inside of this lambda - maybe 
>> lambdas is not traced by profiler?
>
> Tried to remove lambda with same result.
>
> Command:
>
> llvm-profdata show -all-functions -topn=100000 default.profdata
>
> returns huge amount of std*, core*, vibe* calls - it is all 
> used in my code. But here is no one my own function (except 
> "main").

Those calls are to templated functions I presume? (they are 
instantiated in your program and hence instrumented)

> Also I changed flags to "dflags-ldc": 
> ["-fprofile-instr-generate", "-O0"] - second flag disables 
> optimisation (I assumed that optimizations magically completely 
> remove calls to my functions. But this is probably not the 
> case.)

No, indeed, -O0 doesn't (shouldn't!) matter.

It is strange that you don't see calls to your functions. Just to 
verify, could you compile a simple program manually (without dub) 
and verify that you see calls to your own functions? Lambdas 
should also be instrumented, so please test that.

By the way, if you are on linux, then XRay should work like with 
clang ( -fxray-instrument )

-Johan



More information about the Digitalmars-d-learn mailing list