Create perftool.php

This commit is contained in:
Namhyeon Go 2020-02-19 14:43:06 +09:00 committed by GitHub
parent 44c025dc29
commit afd3e5d566
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

20
helper/perftool.php Normal file
View 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;
}
}