I created a test class that allows the user to embed, for example,
$timer->checkpoint('1');
to check the code for time, memory consumption, etc. and at the end of the code, if he / she wants to test it, he / she should insert
$result=$timer->result();
this gives some data for the result of the public function (), for example, for example. memory usage (using memory_get_peak_usage) and time consumption (microtime ()).
All of this works great for me.
But how can I use a combination of existing built-in php functions to get a value that can be considered processor consumption ?
It was pretty easy to calculate how much time was spent on a specific piece of code using the built-in functions, but I had trouble thinking about how to get CPU consumption for a specific piece of code.
source share