Hi guys I have a weird question,
I have a cli php script runs on Centos 5.x which uses usleep (somtimes 1sec, sometimes 2sec, somtimes 100ms it depends) if there is some wait required, but what I have noticed its that once on usleep() it seems to use about 40% of idle CPU:
Cpu(s): 5.3%us, 21.3%sy, 0.0%ni, 57.2%id, 0.0%wa, 0.0%hi, 0.0%si, 16.1%st
any ideas ?
cheers
This doesn't happen for me with a very simple testcase. Try the following on your system to see if you still get the excessive CPU time.
Script test.php:
Then at the command line run:
time php test.php
My results are as follows:
You can see that the user and sys time are very very small in comparison to the real (or elapsed) time. i.e. CPU utilisation was very low.