Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

equivalent of time for memory checking

Tags:

we can use time in a unix environment to see how long something took...

shell> time some_random_command
real    0m0.709s
user    0m0.008s
sys     0m0.012s

is there an equivalent for recording memory usage of the process(es)?

in particular i'm interested in peak allocation.

like image 389
mat kelcey Avatar asked Oct 16 '08 08:10

mat kelcey


People also ask

How do I check memory utilization at a specific time?

Check Computer Memory Usage EasilyTo open up Resource Monitor, press Windows Key + R and type resmon into the search box. Resource Monitor will tell you exactly how much RAM is being used, what is using it, and allow you to sort the list of apps using it by several different categories.

What is the command to check memory usage?

Entering cat /proc/meminfo in your terminal opens the /proc/meminfo file. This is a virtual file that reports the amount of available and used memory. It contains real-time information about the system's memory usage as well as the buffers and shared memory used by the kernel.


1 Answers

Check the man page for time. You can specify a format string where it is possible to output memory information. For example:

>time -f"mem: %M" some_random_command
mem: NNNN

will output maximum resident set size of the process during its lifetime, in Kilobytes.

like image 190
Mathias Avatar answered Oct 02 '22 19:10

Mathias