Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get CPU usage and RAM usage without exec?

How does VBulletin get the system information without the use of exec? Is there any other information I can get about the server without exec? I am interested in:

  • bandwidth used
  • system type
  • CPU speed/usage/count
  • RAM usage
like image 373
Rami Dabain Avatar asked Jan 16 '11 14:01

Rami Dabain


People also ask

How do I check my CPU and RAM usage?

Here's is how you can check your PC's system resource usage with Task Manager. Press CTRL + Shift + Esc to open Task Manager. Click the Performance tab. This tab displays your system's RAM, CPU, GPU, and disk usage, along with network info.

How can I monitor my RAM usage?

Press Ctrl + Shift + Esc to launch Task Manager. Or, right-click the Taskbar and select Task Manager. Select the Performance tab and click Memory in the left panel. The Memory window lets you see your current RAM usage, check RAM speed, and view other memory hardware specifications.

How can I get CPU and memory usage in PHP?

To get the current memory usage, we can use the memory_get_usage() function, and to get the highest amount of memory used at any point, we can use the memory_get_peak_usage() function.


1 Answers

Use PHPSysInfo library

phpSysInfo is a open source PHP script that displays information about the host being accessed. It will displays things like:

  • Uptime
  • CPU
  • Memory
  • SCSI, IDE, PCI
  • Ethernet
  • Floppy
  • Video Information

It directly parsed parses /proc and does not use exec.


Another way is to use Linfo. It is a very fast cross-platform php script that describes the host server in extreme detail, giving information such as ram usage, disk space, raid arrays, hardware, network cards, kernel, os, samba/cups/truecrypt status, temps, disks, and much more.

like image 79
shamittomar Avatar answered Oct 13 '22 20:10

shamittomar