I have created a benchmark class that allows the user to insert for example
$timer->checkpoint('1');
to check out some code for time,memory consumption and such.... and at the end of the code if she/he wants to test it she/he has to insert
$result=$timer->result();
this gives out some data to public function result() like e.g. memory usage (using memory_get_peak_usage) and time consumption (microtime()).
This all works just fine for me.
But how can I use the combination of existing built-in php functions to get a value that can be considered a CPU consumption?
It has been quite easy to calculate how much time has been spent on a certain piece of code using the built-in functions, but I've been having trouble thinking of a way how to get the CPU consumption for a certain piece of code.