How can I get the CPU and Memory useage

前端 未结 4 1405
一整个雨季
一整个雨季 2020-12-16 05:51

I want to know the memory and CPU usage in php, because I\'m using cronejobs sometimes the CPU is overloaded so in this case I don\'t wan to start more process, I just want

4条回答
  •  长情又很酷
    2020-12-16 06:35

    Take a look at this library http://phpsysinfo.sourceforge.net/

    Demo: http://phpsysinfo.sourceforge.net/phpsysinfo/index.php?disp=dynamic

    Edit: This was taken from Stephen's comment. I put it here just so that it gets enough exposure for people to read.

    Just a note: this library isn't too snappy. I couldn't find a way to just return CPU or just ram, it returns EVERYTHING, hardware list, network stats, hd usage, os info, pretty much everything you can think of. This takes it about 4 seconds to complete so it may not be the best option if you want a constantly updating value using ajax or something of the sort.

提交回复
热议问题