Talk:How to debug
From MediaWiki.org
Any user names refer to users of that site, who are not necessarily users of MediaWiki.org (even if they share the same username).
Contents |
[edit] Dumping variables
Is there a dump routine in MediaWiki? Since MediaWiki stores HTML for output, var_dump isn't working for me. This is a useful topic for this page. -- skierpage 01:11, 29 April 2006 (UTC)
This information does not work for MediaWiki 1.9 using the provided example. Does anyone have an up to date instructions? It would also be helpful if version information was included when providing examples.
Note that the above conversation may have been edited or added to since the transfer. If in doubt, check the edit history.
- There is also the useful '$wgDebugComments' variable. [user:jldupont] 14:11, 1 July 2007 (UTC)
[edit] profileinfo.php
When I try to browse to /profileinfo.php, I get a blank page. Judging by the source of said file, even if profiling is disabled, there should still be something there. I don't even get any HTML let alone visible content. Any ideas? --Egingell (talk) 11:16, 9 August 2007 (UTC)
- See Manual:Errors and Symptoms#You see a Blank Page. Is that the problem? --Cneubauer 19:55, 29 May 2008 (UTC)
[edit] Stack Backtrace
Is there a way to get a full stack backtrace with MediaWiki, or do I have to use PHP's Advanced PHP debugger? —Sledged (talk) 16:54, 19 October 2007 (UTC)
- You can use the wfDebug functions
wfDebugDieBacktraceandwfDebugBacktrace. You basically put those in your code somewhere to get your backtrace. If you use the Die one, it will error out to the screen. The other writes to your debug log. See GlobalFunctions.php for more information. --Cneubauer 19:52, 29 May 2008 (UTC)
[edit] What are these table columns?
Has anyone ever bothered to document these table columns somewhere?:
Calls Total Each % Mem (and three more without headings)
- Is Calls DB calls, function calls, something else?
- Total what?
- What is the content of the three unlabelled columns?
--Michael Daly 06:18, 13 April 2008 (UTC)
- Just taking a shot at this, but it looks like Calls is the number of times a code block that is surrounded by a wfProfileIn/wfProfileOut pair is encountered. This roughly translates to function calls but in some cases may be smaller pieces like loops within functions that someone chose to add profile info to.
- Total is the time that it took to run through that part of the code. Not sure what the units are. Maybe microseconds as the profiler uses microtime. Each is the amount of time spent in one visit to that code. So Calls * Each = Total. % is the percent of total code execution spent in that code block. Mem is the amount of memory used in the code block? I get negative numbers for some of that column though so...
- The two numbers in parens seem to be the min and max of something. Possibly the min and max execution time for all runs through that Call. The last number is the overhead of something. Maybe of running the profiler? It would be great if the developers took time to write up some documentation on things like this but they are unfortunately pretty universally of the school that coding is more important then documenting. --Cneubauer 19:48, 29 May 2008 (UTC)

