0

Fetch information about memory and CPU usage in PHP

How to Get information about your memory and CPU usage in PHP

Here We’ll talk about how to get data about your memory utilization in PHP, It’ll help you streamline your script, You should have mindful about which script of your’s setting aside an excessive amount of opportunity to execute, Otherwise it’ll kill server memory and you may need to face server down time issue.

PHP has a junk jockey and a really complex memory director. The measure of memory being utilized by your script. can go here and there amid the execution of a script.To get the present memory utilization, we can utilize the memory_get_usage() work, and to get the most astounding measure of memory utilized anytime, we can utilize the memory_get_peak_usage() work.

See example.

CPU Usage Information

For getting CPU uses you can simply use getrusage() function in php It’ll return lot’s of CPU uses variables which help you to determine whats sources uses too much CPU resources.

Leave a Reply

Your email address will not be published. Required fields are marked *