相当于内存检查的时间

时间:2021-02-08 20:19:45

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

我们可以在unix环境中使用时间看看有多长时间......

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.

特别是我对峰值分配感兴趣。

2 个解决方案

#1


5  

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.

将在Kilobytes中输出该过程在其生命周期内的最大驻留集大小。

#2


0  

Can you not use ps? e.g. ps v <pid> will return memory information.

你能用ps吗?例如ps v 将返回内存信息。

#1


5  

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.

将在Kilobytes中输出该过程在其生命周期内的最大驻留集大小。

#2


0  

Can you not use ps? e.g. ps v <pid> will return memory information.

你能用ps吗?例如ps v 将返回内存信息。