沃梦达 / 编程问答 / php问题 / 正文

如何获得 CPU 和内存使用率

How can I get the CPU and Memory useage(如何获得 CPU 和内存使用率)

本文介绍了如何获得 CPU 和内存使用率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道 php 中的内存和 CPU 使用情况,因为我使用 cronejobs 有时 CPU 过载,所以在这种情况下我不想启动更多进程,我只想跳过这个 cron.

I want to know the memory and CPU usage in php, because I'm using cronejobs sometimes the CPU is overloaded so in this case I don't wan to start more process, I just want to skip this cron.

推荐答案

我认为更好的方法是获取 load avarage,因为它不仅取决于 CPU,还取决于 HDD 速度.

I think better way is get load avarage, because it depends not only on CPU, but on HDD speed also.

这是一个文档:http://php.net/manual/en/function.sys-getloadavg.php

这篇关于如何获得 CPU 和内存使用率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:如何获得 CPU 和内存使用率

基础教程推荐