简体   繁体   English

测量从PHP启动的Shell脚本的内存使用情况

[英]Measure memory usage of shell script launched from PHP

I'm running some commands on the shell from PHP (such as ImageMagick's "convert" utility, among others), and I'd like to track the peak memory usage of those processes. 我正在PHP的Shell上运行一些命令(例如ImageMagick的“ convert”实用程序等),我想跟踪那些进程的峰值内存使用情况。 PHP has a pretty simple way of getting peak memory usage of the PHP script itself, and I'd like to augment that data with information about external scripts run by the PHP script. PHP有一种非常简单的方法来获取PHP脚本本身的峰值内存使用率,我想用有关PHP脚本运行的外部脚本的信息来扩充该数据。

Is there some way to do that? 有什么办法吗?

If you are running Linux you have 3 options: free , vmstat and top , depending on your specific needs use one or other. 如果您正在运行Linux,则有3个选项: freevmstattop ,根据您的特定需求使用一个或另一个。

But perhaps if you have very specific requirements the best is create your own C application that has more access to system memory space. 但是,也许如果您有非常特定的要求,最好的办法就是创建自己的C应用程序 ,该应用程序可以更多地访问系统内存空间。

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

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