<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Thomas Hambach - Web engineer &#187; xdebug</title>
	<atom:link href="http://www.rdlt.com/category/xdebug/feed" rel="self" type="application/rss+xml" />
	<link>http://www.rdlt.com</link>
	<description>Web development, Web design &#38; Usability</description>
	<lastBuildDate>Wed, 16 Jun 2010 09:10:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>xdebug trace file parser</title>
		<link>http://www.rdlt.com/xdebug-trace-file-parser.html</link>
		<comments>http://www.rdlt.com/xdebug-trace-file-parser.html#comments</comments>
		<pubDate>Wed, 18 Nov 2009 18:02:10 +0000</pubDate>
		<dc:creator>Thomas Hambach</dc:creator>
				<category><![CDATA[freebies]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[xdebug]]></category>

		<guid isPermaLink="false">http://www.rdlt.com/?p=241</guid>
		<description><![CDATA[When I am trying to optimize my PHP code, one of my prefered tools is xdebug. It provides me with excellent error messages, outputs code tracing files &#38; insight into memory usage. By using kcachegrind or webgrind &#8211; wincachegrind crashes *all* the time &#8211; to parse the cachegrind files created by xdebug, you get a [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-medium wp-image-243" title="xdebug_trace_preview" src="http://www.rdlt.com/wp-content/uploads/2009/11/xdebug_trace_preview-300x199.png" alt="xdebug_trace_preview" width="300" height="199" /></p>
<p>When I am trying to optimize my PHP code, one of my prefered tools is <a href="http://www.xdebug.org" target="_blank">xdebug</a>. It provides me with excellent error messages, outputs code tracing files &amp; insight into memory usage.</p>
<p>By using kcachegrind or <a href="http://code.google.com/p/webgrind/" target="_blank">webgrind</a> &#8211; wincachegrind crashes *all* the time &#8211; to parse the cachegrind files created by xdebug, you get a good idea of what your code is doing most of the time. It&#8217;ll show you which functions are called, by who, which arguments are passed and tons more. <a href="http://www.xdebug.org" target="_blank">Check it out. </a></p>
<p>Now, there was one small thing I couldn&#8217;t find anywhere. A program to parse the trace files that xdebug generates. True, xdebug already provides the option to output this information into HTML, but it&#8217;s not really what I was looking for. <strong>I want to get quick information in the blink of an eye! </strong>That&#8217;s why I have created my own trace file parser, based on PHP of course.</p>
<h3><span id="more-241"></span>What is it?</h3>
<p>This <strong>xdebug trace parser</strong> will show you, for each function:</p>
<ul>
<li>How much memory was used on entry &amp; exit</li>
<li>How much time it costed to execute the function</li>
<li>The exact line the function was called from plus insight into the code by clicking a link</li>
<li>Whether the function is native PHP or not</li>
</ul>
<p><a rel="lightbox" href="http://www.rdlt.com/wp-content/uploads/2009/11/xdebug_trace_warning.png"><img class="alignnone size-medium wp-image-245" title="xdebug_trace_warning" src="http://www.rdlt.com/wp-content/uploads/2009/11/xdebug_trace_warning-300x54.png" alt="xdebug_trace_warning" width="300" height="54" /></a></p>
<p>It also has a basic &#8220;alerting&#8221; feature, which will allow you to set triggers on memory usage &amp; execution time. You can specifiy that if the memory or time jump is greater than a certain value, to show this in the output.</p>
<h3>Requirements</h3>
<p>It should be obvious that you&#8217;ll need to install and configure xdebug for your PHP installation. See <a href="http://www.xdebug.org" target="_blank">http://www.xdebug.org</a> for more information on this.</p>
<p>Your xdebug config should look a bit like this, don&#8217;t forget to update your paths <img src='http://www.rdlt.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<pre><code>[XDebug]
;; Only Zend OR (!) XDebug
zend_extension_ts="\php\ext\php_xdebug-2.0.4-5.2.8.dll"
xdebug.auto_trace=1
xdebug.trace_format=1
xdebug.profiler_append=1
xdebug.profiler_enable=1
xdebug.profiler_enable_trigger=0
xdebug.collect_params=4
xdebug.collect_return=1
xdebug.trace_output_dir="D:\webserver\xdebug"
xdebug.trace_output_name= %t.trace
xdebug.profiler_output_name = %s.%t.profile
xdebug.profiler_output_dir="D:\webserver\xdebug"
</code></pre>
<h3>Download</h3>
<p>Now, give it a try and <a href="../wp-content/uploads/2009/11/trace.zip" target="_blank">downlod the xdebug trace file parser here!</a></p>
<h3>Usage</h3>
<p>Once you&#8217;ve downloaded the trace file parser, extract it to a directory inside your website root and surf to the URL. If everything works out you should be able to select trace files onceyou have ran an other PHP script on your server. This trace file parser will *not* show it&#8217;s own traces because that would make things even more complicated!</p>
<p>Comments &amp; suggestions! <img src='http://www.rdlt.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.rdlt.com/xdebug-trace-file-parser.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
