I need some means of recording the performance of an application on a Linux machine. I won't have an IDE.
Ideally, I need an app that will attach to a process and log periodic snapshots of: memory usage number of threads CPU usage
Any ideas?
I need some means of recording the performance of an application on a Linux machine. I won't have an IDE.
Ideally, I need an app that will attach to a process and log periodic snapshots of: memory usage number of threads CPU usage
Any ideas?
Have you looked into gprof? You need to compile the code with the -pg option, which instruments the code. After that you can run the prorgam and use gprof to see the results.
You can use valgrind. It records data in a file which you can analyse later using a proper gui like KCacheGrind
A usage example would be :
valgrind --tool=callgrind --dump-instr=yes --simulate-cache=yes your_program
It'll generate a file called callgrind.out.xxx
where xxx is the pid of the program
edit: unlike gprof valgrind works with many different languages including java with some limitations.
Quoting Linus Torvalds himself:
"Don't use gprof. You're _much_ better off using the newish Linux 'perf' tool."
and later ...
"I can pretty much guarantee that once you start using it, you'll never use gprof or oprofile again."
See: http://marc.info/?l=git&m=126262088816902&w=2
Good luck!
If you are looking for things to do to possibly speed up the program, you need stackshots. A simple way to do this is to use the pstack utility, or lsstack if you can get it.
You can do better than gprof. If you want to use an official profiling tool, you want something that samples the call stack on wall-clock time and presents line-level cost, such as Oprofile or RotateRight/Zoom.