Create perftool.php
This commit is contained in:
parent
44c025dc29
commit
afd3e5d566
20
helper/perftool.php
Normal file
20
helper/perftool.php
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
/**
|
||||
* @file perftool.php
|
||||
* @created_on 2020-02-19
|
||||
* @updated_on 2020-02-19
|
||||
* @author Go Namhyeon <gnh1201@gmail.com>
|
||||
* @brief PerfTool helper
|
||||
*/
|
||||
|
||||
if(!is_fn("get_cpu_idle")) {
|
||||
function get_cpu_idle() {
|
||||
$idle = 100.0;
|
||||
|
||||
if(loadHelper("exectool")) {
|
||||
$idle = floatval(trim(exec_command("top -n 1 | grep -i Cpu\(s\) | awk '{print \$8}'")));
|
||||
}
|
||||
|
||||
return $idle;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user