Блог пользователя amit_dwivedi

Автор amit_dwivedi, история, 12 месяцев назад, По-английски

Could not make GNU gprof work on my mac. So I wrote my own profiler for C++.

It prints a neatly-indented time tree for every function's entry and exit.

Example.
Given a sample code like

this

It produces

this

I’ve pushed the code and usage details to to Github.

How to Run?

Command
At a glance
  • Zero code changes inside your solution.
  • Skip profiling all the std:: calls. (This was super tricky to achieve.)
  • Overhead ≈ 50–100 ns per call.
  • POSIX only (dladdr system call), Won't work in windows.
  • Tested on GCC 14.
  • Multithreaded code or recursion will be hard to analyse.

Feedback and pull requests are welcome.

Peace!

  • Проголосовать: нравится
  • +18
  • Проголосовать: не нравится