You can use the Apple-supplied /usr/bin/time
as follows without installing anything:
/usr/bin/time -l <DO SOMETHING>
It is important to use the full path /usr/bin/time
because time
calls bash and results in error: -bash: -l: command not found
Sample Output
0.04 real
0.00 user
0.00 sys
2830336 maximum resident set size <-- peak memory usage
0 average shared memory size
0 average unshared data size
0 average unshared stack size
462 page reclaims
253 page faults
0 swaps
13 block input operations
3 block output operations
0 messages sent
0 messages received
0 signals received
26 voluntary context switches
94 involuntary context switches