3

Is there a Linux library that can run performance profiling within a running process?

I have a rather large linux program that is heavily script-based. Depending on the scripts, the program can have wildly different behaviors (and performance problems). What would be nice is a low-overhead performance library that I can embed in the same process that monitors and provides real-time feedback to the process about it's own performance.

Oprofile would be fantastic, if I could start it within the program and keep it isolated to only that program. From the documentation I've read, it doesn't appear possible.

Does anyone know of any such library?

Thanks!
Andrew Klofas

2 Answers 2

5

Check out gprof - it should do what you want.

Sign up to request clarification or add additional context in comments.

3 Comments

From the doc it appears that invoking the -g/-pg option will cause the program to run "slower than normal". Also, it appears that gprof can't provide real-time feedback to the process.
Anything you add to monitor your process is going to make it run "slower than normal". Why is it that you need real-time feedback?
Some overhead is okay, but it would be nice to have as minimal impact as possible. The reason im looking for realtime feedback is because there are some components of the program that are "soft realtime" constrained and it would be nice to defer/kill some tasks if the cpu is overloading
2

I think gperftools works well for profiling. The runtime performance penalty for CPU profile data is very small.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.