www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - Profiling --fdmd-trace-functions

reply Paul <phshaffer gmail.com> writes:
Thanks in advance for any assistance.

As the subject line states I'm just now trying to learn 
profiling. I have a very small program with 1/2 dozen functions 
and would like to see where the cpu is spending the most time.

I've tried this:
ldc2 --fdmd-trace-functions myprog.d

The result is that no 'trace' files are generated....as far as I 
can tell. When I run myprog.exe it generates no errors, runs very 
quickly, and does not do what it previously was doing.

ldc2 --version
LDC - the LLVM D compiler (1.30.0-git-5fd86e5):
based on DMD v2.100.1 and LLVM 14.0.3
Apr 03 2023
parent reply max haughton <maxhaton gmail.com> writes:
On Monday, 3 April 2023 at 23:00:01 UTC, Paul wrote:
 Thanks in advance for any assistance.

 As the subject line states I'm just now trying to learn 
 profiling. I have a very small program with 1/2 dozen functions 
 and would like to see where the cpu is spending the most time.

 I've tried this:
 ldc2 --fdmd-trace-functions myprog.d

 The result is that no 'trace' files are generated....as far as 
 I can tell. When I run myprog.exe it generates no errors, runs 
 very quickly, and does not do what it previously was doing.

 ldc2 --version
 LDC - the LLVM D compiler (1.30.0-git-5fd86e5):
 based on DMD v2.100.1 and LLVM 14.0.3
What operating system are you using? If on Linux I highly recommend using perf to do profiling. https://youtu.be/6TDZa5LUBzY My DConf talk may be of use.
Apr 04 2023
parent reply Paul <phshaffer gmail.com> writes:
On Tuesday, 4 April 2023 at 09:30:43 UTC, max haughton wrote:
 What operating system are you using? If on Linux I highly 
 recommend using perf to do profiling.
I’m on Windows Max
Apr 04 2023
parent max haughton <maxhaton gmail.com> writes:
On Tuesday, 4 April 2023 at 17:10:23 UTC, Paul wrote:
 On Tuesday, 4 April 2023 at 09:30:43 UTC, max haughton wrote:
 What operating system are you using? If on Linux I highly 
 recommend using perf to do profiling.
I’m on Windows Max
The visual studio profiler is really good, worth a look at. Profilers that instrument the code rathe than using it unmodified should be used quite carefully (more detail in the talk)
Apr 04 2023