Is there any command like time, but that reports more statistics? It would be great if I could do something like:
$ statistics some_command
time:
real 0m3.002s
user 0m0.000s
sys 0m0.000s
memory:
min 41K
peak 2.5M
mean 1.1M
. . .
If it could go even further, that would be great. Right now, for debugging, I either end up staring intently at top (actually glances), or sprinkling statements all through my code.
If there was something that I could pass a command to, that would be fantastic.
EDIT
I might have found a solution: perf in the package linux-tools and linux-tools-common on Ubuntu 12.04.
$ perf stat ./someprocess
Performance counter stats for './someprocess':
12007.384578 task-clock # 0.996 CPUs utilized
1,092 context-switches # 0.000 M/sec
16 CPU-migrations # 0.000 M/sec
295,102 page-faults # 0.025 M/sec
40,553,682,299 cycles # 3.377 GHz [83.33%]
18,400,458,723 stalled-cycles-frontend # 45.37% frontend cycles idle [83.35%]
8,356,832,355 stalled-cycles-backend # 20.61% backend cycles idle [66.64%]
56,930,684,595 instructions # 1.40 insns per cycle
# 0.32 stalled cycles per insn [83.34%]
9,083,443,825 branches # 756.488 M/sec [83.35%]
3,431,737 branch-misses # 0.04% of all branches [83.33%]
12.051963969 seconds time elapsed