Unable to get CPU usage
SubrataM3 opened this issue · 4 comments
SubrataM3 commented
Code
$linfo = new \Linfo\Linfo;
$parser = $linfo->getParser();
$cpu = $parser->getCPUUsage();
var_dump($cpu);
Output
/home/www/html/test.php:104:boolean false
RAM usage,Uptime etc works fine though.
System Info
PHP => PHP 7.2.8 (cli) (built: Jul 17 2018 09:50:46) ( NTS )
OS => CentOS Linux release 7.5.1804 (Core)
Kernel => Linux localhost 3.10.0-862.9.1.el7.x86_64
Its a local virtual machine, so nothing is restricted on PHP side. Please let me know if you need any further information.
Thank you.
jrgp commented
Hey, thanks for reaching out.
Getting CPU usage is a kind of a tricky operation and requires a little bit more in terms of usage. I’ll reply back later with more details (on my phone now and can’t easily look trough things).
Regards
SubrataM3 commented
Hi, any update on this?
jrgp commented
Try
$linfo = new \Linfo\Linfo;
$parser = $linfo->getParser();
$parser->determineCPUPercentage();
$cpu = $parser->getCPUUsage();
var_dump($cpu);
SubrataM3 commented
That works perfectly ! Thank you. :-)