58

I have setup xdebug and webgrind and I have generated a profile so I can start improving the speed of my code execution. I have displayed the profile in webgrind but I haven't got a clue what any of it means. All the googling I have done doesn't really explain any of it either.

Could someone please explain the basics of reading a webgrind report:

Invocation Count

Total Self Cost

Total Inclusive Cost

What the different colours mean

What the coloured bar means

Calls

Total Call Cost

Count

1 Answer 1

100

The basic output lists all the different functions, methods, and included/required files.

  • Invocation Count: The number of times the function has been called

  • Total Self Cost: The total time it took to execute the raw php in this function (time taken to execute your other custom functions is excluded.)

  • Total Inclusive Cost: Total time, including any other functions called (PHP internal, or your functions)

  • What the different colours mean?

    • Blue are PHP internal functions
    • Green are your class methods
    • Orange are procedural functions
    • Grey is time taken to include, or require .php files.
  • What the coloured bar means? Graphical display of breakdown of time for each type as above.

  • For the last ones, I assume you've clicked the arrow to open a particular function?

    • Calls: The functions/methods called in executing this function

    • Total Call Cost: The total time executing this function, when called from the parent function

    • Count: Number of times the parent calls the child.

7
  • 7
    Thanks for the explanation. Is the Self and Inclusive Cost already mulitplied by the Invocation Count? Or does it then need to be multiplied as well to get a real idea of how much time is spent?
    – David
    Aug 17, 2011 at 15:39
  • 3
    These colors represent the distribution of built-in PHP functions (blue), include/require functions (lavender), class methods (green) and procedural functions (orange).
    – bueltge
    Jan 30, 2012 at 12:40
  • 2
    And what does the @ symbol represent? E.g. php::spl_autoload_register @ 58
    – geoidesic
    Jan 30, 2014 at 16:12
  • 7
    Is the total inclusive cost in percent, when "in percent" selected? If so, how do I interpret values over 100? Apr 3, 2014 at 21:56
  • 1
    "@" symbol represents the line number in appropriate source file, from which the mentioned function is called.
    – userfuser
    May 26, 2015 at 13:55

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.