I am using Ubuntu 12.0.4 64 bit server edition and I have to measure the server performance for some specific programs.

Is there a way to record the total System resource usage by a specific command?

For example, I have some 10 commands in a perl script file. Can I measure the total (during total time consumed by the command) CPU run time, %CPU usage, Memory Usage, etc., for each of the 10 commands?


The time command (/usr/bin/time, not the shell builtin) can report these and a host of other statistics:

$ /usr/bin/time -f "Real time: %E\nCPU Usage: %P\nAverage Memory Usage: %t" some-command
Real time: 0:01.05
CPU Usage: 99%
Average Memory Usage: 0

See the manpage for more.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.