<?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>Made of Everything You&#039;re Not &#187; xdebug</title>
	<atom:link href="http://blog.ericlamb.net/tag/xdebug/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ericlamb.net</link>
	<description>Thoughts on programming, people and life</description>
	<lastBuildDate>Thu, 27 Oct 2011 01:29:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Using Xdebug Profiler on Vista</title>
		<link>http://blog.ericlamb.net/2009/02/using-xdebug-profiler-on-vista/</link>
		<comments>http://blog.ericlamb.net/2009/02/using-xdebug-profiler-on-vista/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 20:00:23 +0000</pubDate>
		<dc:creator>Eric Lamb</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[WinCacheGrind]]></category>
		<category><![CDATA[xdebug]]></category>

		<guid isPermaLink="false">http://blog.ericlamb.net/?p=835</guid>
		<description><![CDATA[One of the coolest features of Xdebug is the Profiler. By enabling the Profiler you can generate what are essentially full traces about your php scripts that are invaluable in fine tuning your code and isolating problem areas effectively. According to the official page on the xdebug Profiler: Xdebug&#8217;s built-in profiler allows you to find [...]]]></description>
			<content:encoded><![CDATA[<p>One of the coolest features of <a href="http://www.xdebug.org/" onclick="return TrackClick('http%3A%2F%2Fwww.xdebug.org%2F','Download+xdebug')" onclick="return TrackClick('http%3A%2F%2Fwww.xdebug.org%2F','Xdebug')" title="Xdebug" target="_blank">Xdebug</a> is the <a href="http://www.xdebug.org/docs/profiler" onclick="return TrackClick('http%3A%2F%2Fwww.xdebug.org%2Fdocs%2Fprofiler','Xdebug+Profiler')" title="Xdebug Profiler" target="_blank">Profiler</a>. By enabling the Profiler you can generate what are essentially full traces about your php scripts that are invaluable in fine tuning your code and isolating problem areas effectively. </p>
<div id="attachment_843" class="wp-caption aligncenter" style="width: 210px"><a href="http://blog.ericlamb.net/wp-content/uploads/2009/02/xdebug-logo.png" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2Fwp-content%2Fuploads%2F2009%2F02%2Fxdebug-logo.png','Xdebug')"><img src="http://blog.ericlamb.net/wp-content/uploads/2009/02/xdebug-logo.png" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2Fwp-content%2Fuploads%2F2009%2F02%2Fxdebug-logo.png','Xdebug')" alt="Xdebug" title="Xdebug" width="200" height="116" class="size-full wp-image-843" /></a><p class="wp-caption-text">Xdebug</p></div>
<p>According to the official page on the xdebug Profiler:</p>
<blockquote><p>
Xdebug&#8217;s built-in profiler allows you to find bottlenecks in your script and visualize those with an external tool such as KCacheGrind or WinCacheGrind. Xdebug&#8217;s Profiler is a powerful tool that gives you the ability to analyze your PHP code and determine bottlenecks or generally see which parts of your code are slow and could use a speed boost.
</p></blockquote>
<p>There&#8217;s some serious information in these little files too. By importing the debug files into a tool called <a href="http://sourceforge.net/projects/wincachegrind/" onclick="return TrackClick('http%3A%2F%2Fsourceforge.net%2Fprojects%2Fwincachegrind%2F','WinCacheGrind+Project+Page')" title="WinCacheGrind Project Page" title="_blank">WinCacheGrind</a> you can view the files in a format that won&#8217;t make you stick a knife in your eyes. </p>
<p>Here&#8217;s a small example of the exported data:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">version<span style="color: #339933;">:</span> 0<span style="color: #339933;">.</span>9<span style="color: #339933;">.</span>6
cmd<span style="color: #339933;">:</span> C<span style="color: #339933;">:</span>ProjectFilescat_v2index<span style="color: #339933;">.</span>php
part<span style="color: #339933;">:</span> <span style="color: #cc66cc;">1</span>
&nbsp;
events<span style="color: #339933;">:</span> <span style="color: #990000;">Time</span>
&nbsp;
fl<span style="color: #339933;">=</span>php<span style="color: #339933;">:</span>internal
fn<span style="color: #339933;">=</span>php<span style="color: #339933;">::</span><span style="color: #990000;">define</span>
<span style="color: #cc66cc;">3</span> <span style="color: #cc66cc;">7</span>
&nbsp;
fl<span style="color: #339933;">=</span>php<span style="color: #339933;">:</span>internal
fn<span style="color: #339933;">=</span>php<span style="color: #339933;">::</span><span style="color: #990000;">get_include_path</span>
<span style="color: #cc66cc;">4</span> <span style="color: #cc66cc;">6</span>
&nbsp;
fl<span style="color: #339933;">=</span>php<span style="color: #339933;">:</span>internal
fn<span style="color: #339933;">=</span>php<span style="color: #339933;">::</span><span style="color: #990000;">set_include_path</span>
<span style="color: #cc66cc;">4</span> <span style="color: #cc66cc;">5</span></pre></div></div>

<p>To get started first make sure you have Xdebug 2.0 installed. To check, execute the below in a dos prompt:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">php <span style="color: #339933;">-</span>v</pre></div></div>

<p>You should see something like the below:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">PHP 5<span style="color: #339933;">.</span>2<span style="color: #339933;">.</span>6 <span style="color: #000;">&#40;</span>cli<span style="color: #000;">&#41;</span> <span style="color: #000;">&#40;</span>built<span style="color: #339933;">:</span> May  <span style="color: #cc66cc;">2</span> <span style="color: #cc66cc;">2008</span> <span style="color: #cc66cc;">18</span><span style="color: #339933;">:</span><span style="color: #208080;">02</span><span style="color: #339933;">:</span><span style="color: #208080;">07</span><span style="color: #000;">&#41;</span>
Copyright <span style="color: #000;">&#40;</span>c<span style="color: #000;">&#41;</span> <span style="color: #cc66cc;">1997</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">2008</span> The PHP Group
Zend Engine v2<span style="color: #339933;">.</span>2<span style="color: #339933;">.</span>0<span style="color: #339933;">,</span> Copyright <span style="color: #000;">&#40;</span>c<span style="color: #000;">&#41;</span> <span style="color: #cc66cc;">1998</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">2008</span> Zend Technologies
with Xdebug v2<span style="color: #339933;">.</span>0<span style="color: #339933;">.</span>3<span style="color: #339933;">,</span> Copyright <span style="color: #000;">&#40;</span>c<span style="color: #000;">&#41;</span> <span style="color: #cc66cc;">2002</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">2007</span><span style="color: #339933;">,</span> by Derick Rethans</pre></div></div>

<p>If not, you&#8217;ll need to download and install <a href="http://www.xdebug.org/" onclick="return TrackClick('http%3A%2F%2Fwww.xdebug.org%2F','Download+xdebug')" onclick="return TrackClick('http%3A%2F%2Fwww.xdebug.org%2F','Xdebug')" title="Download xdebug">Xdebug</a>. </p>
<p>If you do have Xdebug, modify your php.ini to include the below after the Xdebug init call:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">xdebug<span style="color: #339933;">.</span>profiler_enable <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span>
xdebug<span style="color: #339933;">.</span>profiler_output_dir <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;C:/path/to/profiler/storage&quot;</span></pre></div></div>

<p>Once you&#8217;ve configured php you might need to restart your server depending on how php is implemented. Either way, to generate a profile output just execute a script; the output should be written to the directory you set in the xdebug.profiler_output_dir.</p>
<p>All that&#8217;s left is to open the profile output in WinCacheGrind. </p>
<div id="attachment_836" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.ericlamb.net/wp-content/uploads/2009/02/wincachegrindmain.jpg" onclick="return TrackClick('http%3A%2F%2Fblog.ericlamb.net%2Fwp-content%2Fuploads%2F2009%2F02%2Fwincachegrindmain.jpg','WinCacheGrind')"><img class="size-medium wp-image-836" title="WinCacheGrind" src="http://blog.ericlamb.net/wp-content/uploads/2009/02/wincachegrindmain-300x206.jpg" alt="WinCacheGrind" width="300" height="206" /></a><p class="wp-caption-text">WinCacheGrind</p></div>
<p>Notes:<br />
The profilers seems to only record data if the script is executed from the command line.<br />
<a href="http://superb-west.dl.sourceforge.net/sourceforge/wincachegrind/wincachegrind-1.0.0.12.exe" onclick="return TrackClick('http%3A%2F%2Fsuperb-west.dl.sourceforge.net%2Fsourceforge%2Fwincachegrind%2Fwincachegrind-1.0.0.12.exe','Download+WinCacheGrind')" title="Download WinCacheGrind">Download WinCacheGrind</a></p>
<div><a class="addthis_button" href="http://blog.ericlamb.net//addthis.com/bookmark.php?v=250" addthis:url='http://blog.ericlamb.net/2009/02/using-xdebug-profiler-on-vista/' addthis:title='Using Xdebug Profiler on Vista '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>]]></content:encoded>
			<wfw:commentRss>http://blog.ericlamb.net/2009/02/using-xdebug-profiler-on-vista/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

