I found that creating a flame graph helped considerably, and helped me track down specific places where I was using much more cpu time than I should have been.
in my case, it was
sprintf() for drawing user interface widgets that surprised me as the biggest culprit, but it did allow me to drill down and find specific issues.
dtrace to get my output (I’m on macOS), but you can also use
perf in linux (sorry, I don’t use windows, so can’t give you any ideas there).
https://github.com/brendangregg/FlameGraph has a great walkthrough on how to create flame graphs, as well as tools for creating them - in fact the massaging tools that take the output also help organizing the call data if you prefer to analyze by hand.
good luck! feel free to ask if you have any questions!
editing to add that I didn’t recommend
gprof as others have, and sometimes having a nice visual call graph that you can click into to see specific measurements helps a lot more.