phpmodel-view-controllerxdebugprofilerkcachegrind

Is it possible to use the MVC path in XDebugs profiler outout filename?


I am using XDebug to profile a large MVC application and it would be much easier to profile individual requests by their URI rather than filename (.php) as several requests are made via internal functions, resulting in multiple grind files for a single page refresh.

I have seen %p = process ID, %t = Timestamp and %s = Script name ( var_path_to_example.php )

It would be much easier if the file could be named more like grind.{domain}{path}.%p

Is this possible? I havent been able to find any other string formatting replacers that may do what im after.

Single page refresh currently creates four grind files ( three for index, one is main request, other two are media compressors ) and one for img.php which is a media path rewriter and resizer.

All of this combined into a single www.example.com/path/to/controller.grind would be preferable for this situation.


Solution

  • The answer was to use %R - I found the list of string replacements here Xdebug Settings under the trace_output_name section. It seems that the same replacers can be used for the profiler output names as well.

    Name your files like this in the php.ini - "cachegrind.out.%R" to get the URI into the name with slashes replaced with underscores.

    Now my grind files look like cachegrind.out._page_minify_css and cachegrind.out._ ( Which would be the root of the domain - exactly what I was looking for in order to tie profiles to requests )

    The Short list is this

    %c = crc32 of CWD

    %p = PID

    %r = Random Number

    %s = Script Name ( only for profile output )

    %t = Timestamp ( seconds )

    %u = Timestamp ( microseconds )

    %H = Hostname

    %R = Request URI ( the one I was after )

    %U = Unique ID /9 only since 2.2 )

    %S = Session ID