<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Sat, 25 May 2013 22:53:04 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Kurt Payne's Blog: User register_tick_function to profile your code]]></title>
      <guid>http://www.phpdeveloper.org/news/17512</guid>
      <link>http://www.phpdeveloper.org/news/17512</link>
      <description><![CDATA[<p>
<i>Kurt Payne</i> has a new post to his blog showing how to <a href="http://kpayne.me/2012/02/04/use-register_tick_function-to-profile-your-code/">use register_tick_function</a> with a callback to help benchmark and profile your application to find its pain spots.
</p>
<blockquote>
A profiler gives you the ability to trace the performance of your code through every function call and create an overview of your system's performance over a certain time period and helps you make intelligent decisions about where to look for problems. [...] But what if you're in an environment where you can't install [the xdebug or xhprof] extension? Luckily, php has a built-in function called <a href="http://php.net/register_tick_function">register_tick_function</a> that gives you a way to hook in to every user function that's called.  With this, you can write a profiler yourself.
</blockquote>
<p>
A bit of sample code illustrates his method - it defines a "do_profile" function and assigns it with the <a href="http://php.net/register_tick_function">register_tick_function</a> call. This function generates a debug backtrace and echos out the function path it took to get to that spot (output is included). He provides code for a bit more useful profiling and points out that it could easily be graphed to help visualize the problems. Also included are a few caveats to watch out for when using this method of profiling.
</p>]]></description>
      <pubDate>Tue, 07 Feb 2012 13:26:23 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Dave Marshall's Blog: Log memory usage using declare and ticks in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/10202</guid>
      <link>http://www.phpdeveloper.org/news/10202</link>
      <description><![CDATA[<p>
Posted to his blog, <i>Dave Marshall</i> has <a href="http://www.davedevelopment.co.uk/2008/05/12/log-memory-usage-using-declare-and-ticks-in-php/">a tip</a> that uses declare and a trick or two to check out the memory usage of your scripts.
</p>
<blockquote>
As far as I know, there isn't any memory footprint profiling in Xdebug, I think there was at some point but they removed it because it was a little flaky. I like to monitor the memory usage within my scripts, and I've found this simple snippet can help.
</blockquote>
<p>
The script defines a log_memory function that pushes the memory and time information into a session value. The register_tick_function method is used to add log_memory to the handler and its called over and over from inside his for loop.
</p>
]]></description>
      <pubDate>Fri, 16 May 2008 12:05:37 -0500</pubDate>
    </item>
  </channel>
</rss>
