In Ubuntu, /usr/bin/time -v any-command
tells me the memory usage of any-command
and some information. (Source: https://stackoverflow.com/a/774601/2885946 )
I want to do the same thing in OS X/macOS.
Could you tell me how to get the memory usage of a process on OS X like /usr/bin/time -v
in Ubuntu?
You can use the Apple-supplied /usr/bin/time
as follows without installing anything:
/usr/bin/time -l <DO SOMETHING>
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
对我来说,下一个命令效果很好:
ps -axm -o %mem,rss,comm | grep <programm name>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.