Determine how much resources a PHP script is using (CPU percentage and memory)

I am currently using the library xhproffor forked tideways.io to perform profiling myscript.php. From xhprofI can get walltime, cputime, memoryusageand peakmemoryusage. I am trying to test the symfony console - so I am adding TIDEWAYS_ENABLE()on my own ConsoleCommandEventand TIDEWAYS_DISABLEon ConsoleTerminateEvent.

Questions:

  • How can I determine if myscript.php, how many percent of the processor is consuming ? Can I just calculate the percentage cpuusage = cputime / realtimeas indicated here on serverfault ?
  • Given memoryusage (mu)and peakmemoryusage (pmu)from xhprofprofiler, how do I convert or calculate its use ram? (the topresult is much higher than memoryusage, but somehow close to the value peakmemoryusage, so can I say that the ramvalue is used peakmemoryusage?

Notes:

+6
source share
1 answer

, , (, " , 25% 10% " ) d , https://blackfire.io/.

. . , , .

, . blackfire - , . , ( 4 ?). , . , xdebug profiller.

0

All Articles