How to profile my C++ application on linux

前端 未结 9 1531
北海茫月
北海茫月 2021-01-04 04:27

I would like to profile my c++ application on linux. I would like to find out how much time my application spent on CPU processing vs time spent on block by IO/being idle.

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-04 05:03

    I can recommend valgrind's callgrind tool in conjunction with KCacheGrind for visualization. KCacheGrind makes it pretty easy to see where the hotspots are.

    Note: It's been too long since I used it, so I'm not sure if you'll be able to get I/O Wait time out of that. Perhaps in conjunction with iostat or pidstat you'll be able to see where all the time was spent.

提交回复
热议问题