Closed noahwaldner closed 7 years ago
You need to first call determineCPUPercentage() before running getInfo(). Something like the following should work:
$linfo = new \Linfo\Linfo;
$linfo->getParser()->determineCPUPercentage();
$linfo->getInfo();
require_once dirname(FILE).'/init.php';
$linfo = new Linfo; $linfo->getParser()->determineCPUPercentage(); $linfo->scan(); $values = $linfo->getInfo();
in $values the CPU Usage Field is empty.
Just looked into this. The following works for me:
<?php
require_once __DIR__ . '/standalone_autoload.php';
$linfo = new \Linfo\Linfo;
$parser = $linfo->getParser();
$parser->determineCPUPercentage();
var_dump($parser->getCPU());
And then:
$ php foo.php
array(4) {
[0]=>
array(4) {
["usage_percentage"]=>
float(5)
["Vendor"]=>
string(12) "GenuineIntel"
["Model"]=>
string(39) "Intel(R) Core(TM) i5-4590 CPU @ 3.30GHz"
["MHz"]=>
string(8) "3594.937"
}
Admittedly the API could be cleaner but it works.
Cant get the Value of "cpuUsage", its empty.