0

I would like to visualize CPU usage of my Delphi application as a Flame Graph image. To make it work a periodical dump of the function names existing on the call stack is required. How can I make a dump of the application call stack in Delphi and map it to the function names?

I have tried to use the madStackTrace unit from madExcept but calling its stackTrace() function takes around 170ms on my computer which makes it a bad choice for taking probes multiple times per second. Maybe there is a way to dump the raw callstack adresses, and resolve them into function names in a later step?

blerontin
  • 2,892
  • 5
  • 34
  • 60
  • 1
    Use a profiler, for example the ones provided by Intel or AMD which have flame graphs – David Heffernan Aug 08 '23 at 11:29
  • I'm afraid a generic Windows profiler would not show Delphi function names on the callstack due to missing support for parsing the Delphi-specific "project.map" files. Or will they? – blerontin Aug 08 '23 at 13:03
  • 2
    They do if you use map2pdb, that's what I do. Writing a profiler is a huge task. Don't try. Use one that exists and does the job already. – David Heffernan Aug 08 '23 at 15:06
  • 1
    And just to complete Davids comment: https://en.delphipraxis.net/topic/4853-map2pdb-profiling-with-vtune/ – Sherlock70 Aug 09 '23 at 09:49

0 Answers0