Is there something like `time` that also records I/O and CPU?
look at the time man page on your system, some implementations have format options to include I/O, CPU and Memory stats (-f).
For instance, GNU time
, with -v
will show all available info (here on Linux):
/usr/bin/time -v ls
Command being timed: "ls"
User time (seconds): 0.00
System time (seconds): 0.00
Percent of CPU this job got: 0%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.00
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 3664
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 273
Voluntary context switches: 2
Involuntary context switches: 2
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
On BSDs
, use -l
instead.
Note that this is the actual /usr/bin/time
program, not the keyword that some shells like bash
provide which you invoke with time pipeline
.
The command strace
can be useful, you can limit the trace to only count -c
or a subset of system calls,
-e trace=set
Trace only the specified set of system calls. The -c option is
useful for determining which system calls might be useful to
trace. For example, trace=open,close,read,write means to only
trace those four system calls. Be careful when making inferences
about the user/kernel boundary if only a subset of system calls
are being monitored. The default is trace=all.
In this answer, I use it to count the number of system calls. I don't know if anything will give you a summary breakdown of throughput, however strace can produce the figures for something like awk
to summarise.