Get cpu percent usage in php

前端 未结 5 1381
生来不讨喜
生来不讨喜 2020-12-16 17:01

I want to show percent CPU usage in PHP. Is not important if get values by cron in shell > output to file > parse in PHP or directly get value in php. I try many solutions f

5条回答
  •  甜味超标
    2020-12-16 17:36

    I'm not 100% sure on what you're asking, but if I'm right, this answer might help you:

     -1)
            {
                $cpuUsage += floatval($cols[2]);
            }
        }
        print($cpuUsage);
    ?>
    

    The code provided was an answer from Devils Child for a similar question: https://stackoverflow.com/a/9846219/904242

提交回复
热议问题