Home > Backend Development > PHP Tutorial > php怎么获取centos的cpu当前使用率

php怎么获取centos的cpu当前使用率

WBOY
Release: 2016-06-13 11:37:49
Original
1379 people have browsed it

php如何获取centos的cpu当前使用率
如题。

我用
$str = shell_exec('more /proc/stat');
或者
popen('top -b -n 2 | grep -E "(Cpu)"',"r");
取的好象都不准确,每次都是0.4%,但在服务器上用top查看 变化是0.7,1.0,14.....

一般如何快速获取啊

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template