简体   繁体   English

Linux:程序的CPU和内存使用情况

[英]Linux: CPU and memory usage for a program

I have a bash script that calls different c++ programs (some of them are multithread). 我有一个bash脚本,可以调用不同的c ++程序(其中一些是多线程的)。 I want to know what is the CPU and memory usage (maximum or average) during the execution of that script. 我想知道该脚本执行期间的CPU和内存使用量(最大或平均)是多少。 There is a special tool for that? 有专门的工具吗?

Thanks. 谢谢。

除非要深入研究/proc/<pid>/... (其中<pid>是已启动程序的进程ID),否则可以使用ps

如果您知道“程序”的进程名称:

ps -C "processName" -o %cpu,%mem

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM