linux/unix 进程的峰值内存使用量 [英] Peak memory usage of a linux/unix process

查看:32
本文介绍了linux/unix 进程的峰值内存使用量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种工具可以运行命令行并报告峰值 RAM 使用总量?

Is there a tool that will run a command-line and report the peak RAM usage total?

我正在想象类似于/usr/bin/time 的东西

I'm imagining something analogous to /usr/bin/time

推荐答案

这是一个单行程序,不需要任何外部脚本或实用程序,也不需要您通过其他程序(如 Valgrind 或时间)启动流程,所以你可以将它用于任何已经在运行的进程:

Here's a one-liner that doesn't require any external scripts or utilities and doesn't require you to start the process via another program like Valgrind or time, so you can use it for any process that's already running:

grep ^VmPeak /proc/$PID/status

(将 $PID 替换为您感兴趣的进程的 PID)

(replace $PID with the PID of the process you're interested in)

这篇关于linux/unix 进程的峰值内存使用量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆