C ++ that can connect to a running process?

I have a program written in C ++ that I want to profile, and I want to avoid restarting it when starting and stop profiling. Ideally, I would profile both CPU usage and memory allocation. Is there any tool that will allow me to do this? I work on Linux.

+4
source share
5 answers

Free

Not for free

+4
source

My recommendation would be Zoom from RotateRight - you can download a free 30-day rating from your website.

+2
source

If you can get by using simple indicators, in the past I implemented a simple profiler. Track your memory and time. Track the start and stop of each function, print a line at the start and stop. Track your memory before and after if it matters. All this is due to a run-time variable that you can change from the outside. In a web application, this may be an optional post / get parameter. In a thick client program, this may be an additional key.

Then at runtime you can start collecting data. In the past, I added several layers to provide selective and then more detailed data collection.

Good luck.

0
source

You can try valgrind. This is a bunch of different modules assembled in a neat package.

0
source

Add metrics to your code. Profile with gprof http://linuxgazette.tuwien.ac.at/100/vinayak.html .

0
source

Source: https://habr.com/ru/post/1308093/


All Articles