TIL there's another 'time' command that gives some pretty useful stats about the program's resource use
Posted by dtdisapointingresult@reddit | linux | View on Reddit | 2 comments
You may already know about "time some-command" shell command to measure how long a command took, but I found out distros ship with a superior alternative that has a handy verbose flag. You just gotta call it explicitly by using /usr/bin/time instead of time.
Example output:
$ /usr/bin/time -v make -j `nproc`
Command being timed: "make -j 8"
User time (seconds): 875.27
System time (seconds): 315.99
Percent of CPU this job got: 638%
Elapsed (wall clock) time (h:mm:ss or m:ss): 3:06.65
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): 608940
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 362743651
Voluntary context switches: 50611
Involuntary context switches: 72616
Swaps: 0
File system inputs: 0
File system outputs: 687952
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 2
I'm wondering though, what IS the default 'time' command in bash? It's not listed in the [bash doc's built-ins](https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html). Does using 'time' actually call /usr/bin/time somehow with different flags?
2 Comments
TDplay@reddit
Imaginary-Media-2570@reddit