I want to see statistics of a small C program, but is a small program that begins and ends. (Not some program that is long time running). I want to improve this program in terms of access to memory, cache hits, context switches, and that sort of things.
The parameters in /proc/[pid]/status are great, but I cannot find the way to see them after execution.
How can I see this file after the proccess has finished execution?
Tossing this
system()call at the end of your program will print/proc/[pid]/statusto stdout at the very last moment before your program quits.+1 for external programs like
valgrind. You can trap your program’s exit with debugging utils and check complete statistics without modifying the program.