1

Before someone tells me to go RTM or JGI, believe me I have.

I have a site.

I simply want to see a list of functions that are executed on page load, with the time it takes for each function to run to identify the bottle necks.

I've successfully installed Xdebug and have tried webgrind and codebug (mac app). But either I am looking at the wrong thing or they are not suitable. What I want is really simple, yet I can't seem to figure it out.

In an idea road I want to:

  • Load webpage
  • Alt tab back to some profiling app and see

    function foo()      | taken 300 ms
    function bar()      | taken 1200 ms
    function fid()      | taken 1200 ms
    function sticks()   | taken 31200 ms
    function lde()      | taken 1200 ms
    

Then I can go to sticks() and see what the hell it's doing and making my site slow.

Thanks in advanced.

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
Nadine
  • 777
  • 1
  • 11
  • 24
  • or, show the `sticks()` code here and someone might be able to see why it's slow ;) – James Aug 29 '13 at 14:29
  • 2
    But that's the problem. I don't know which one is the offending function, hence why I need to profile the code. – Nadine Aug 29 '13 at 14:29
  • 1
    @James I think OP trying to find the bottleneck himself/herself is way more elegant than posting a bunch of code for SO to debug :] – Carrie Kendall Aug 29 '13 at 14:31
  • 1
    in xdebug it's called profiler. You need an extra program to see the profiling output. Look [here](http://www.xdebug.org/docs/profiler) – bitWorking Aug 29 '13 at 14:35
  • When you say "time it takes for each function to run" you mean what? Total time in function plus callees, summed over all invocations of function? Average inclusive time per invocation? Including or excluding I/O? Percent inclusive wall clock time? Etc. etc. If you're not sure, you're not alone. Regardless, I just do [*random pausing*](http://stackoverflow.com/a/378024/23771). It's easy in php, and goes straight to the problem. – Mike Dunlavey Aug 29 '13 at 15:18
  • The "idiots" way would be to simply `error_log` manually through a predefined call stack. – nietonfir Oct 31 '13 at 21:45

1 Answers1

0

Try looking into XDebug:

https://code.google.com/p/webgrind/

I think it will do what you're looking for.

kevmor
  • 172
  • 1
  • 11