<?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>Undocumented Matlab &#187; callstats</title> <atom:link href="http://undocumentedmatlab.com/blog/tag/callstats/feed/" rel="self" type="application/rss+xml" /><link>http://undocumentedmatlab.com</link> <description>Charting Matlab's unsupported hidden underbelly</description> <lastBuildDate>Thu, 17 May 2012 12:01:26 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.1.1</generator> <item><title>Undocumented profiler options</title><link>http://undocumentedmatlab.com/blog/undocumented-profiler-options/</link> <comments>http://undocumentedmatlab.com/blog/undocumented-profiler-options/#comments</comments> <pubDate>Thu, 02 Apr 2009 22:24:25 +0000</pubDate> <dc:creator>Yair Altman</dc:creator> <category><![CDATA[Desktop]]></category> <category><![CDATA[Medium risk of breaking in future versions]]></category> <category><![CDATA[Memory]]></category> <category><![CDATA[Stock Matlab function]]></category> <category><![CDATA[callstats]]></category> <category><![CDATA[Performance]]></category> <category><![CDATA[Profiler]]></category><guid
isPermaLink="false">http://undocumentedmatlab.com/?p=143</guid> <description><![CDATA[The Matlab profiler has some undocumented options that facilitate debugging memory bottlenecks and JIT (Just-In-Time Java compilation) problems.<pre> </pre>Related posts:<ol><li><a
href='http://undocumentedmatlab.com/blog/more-undocumented-timing-features/' rel='bookmark' title='More undocumented timing features'>More undocumented timing features</a> <small>There are several undocumented ways in Matlab to get CPU and clock data...</small></li><li><a
href='http://undocumentedmatlab.com/blog/undocumented-scatter-plot-behavior/' rel='bookmark' title='Undocumented scatter plot behavior'>Undocumented scatter plot behavior</a> <small>The scatter plot function has an undocumented behavior when plotting more than 100 points: it returns a single unified patch object handle, rather than a patch handle for each specific...</small></li><li><a
href='http://undocumentedmatlab.com/blog/tic-toc-undocumented-option/' rel='bookmark' title='tic / toc &#8211; undocumented option'>tic / toc &#8211; undocumented option</a> <small>Matlab's built-in tic/toc functions have an undocumented option enabling multiple nested clockings...</small></li><li><a
href='http://undocumentedmatlab.com/blog/ismembc-undocumented-helper-function/' rel='bookmark' title='ismembc &#8211; undocumented helper function'>ismembc &#8211; undocumented helper function</a> <small>Matlab has several undocumented internal helper functions that can be useful on their own in some cases. This post presents the ismembc function....</small></li></ol><pre> </pre>]]></description> <content:encoded><![CDATA[<p>The Matlab profiler is a powerful tool for debugging performance-related issues in Matlab applications. However, it also has some undocumented options that facilitate other forms of debugging, namely memory bottlenecks and JIT (Just-In-Time compilation) problems.</p><p>To turn on memory stats in the profile report, run this (only once is necessary &#8211; will be remembered for future profiling runs):</p><blockquote><pre>profile -memory on;
profile(<span style="color: #800080;">'-memory','on'</span>);  <span style="color: #008000;">% an alternative</span></pre></blockquote><p>To turn on JIT information, run this (again, only once is necessary, prior to profile report):</p><blockquote><pre>setpref(<span style="color: #800080;">'profiler','showJitLines'</span>,1);</pre></blockquote><p>You will then see additional JIT and memory (allocated, freed and peak) information displayed in the profile report, as well as the options to sort by allocated, freed and peak memory:</p><div
class="wp-caption aligncenter" style="width: 460px"><br
/> <img
title="Profile report with memory &amp; JIT info" src="http://undocumentedmatlab.com/images/profile2d_450.png" alt="Profile report with memory &amp; JIT info" width="450" /><img
title="Profile report with memory &amp; JIT info" src="http://undocumentedmatlab.com/images/profile2c_450.png" alt="Profile report with memory &amp; JIT info" width="450" /></p><p><img
title="Profile report with memory &amp; JIT info" src="http://undocumentedmatlab.com/images/profile2.png" alt="Profile report with memory &amp; JIT info" width="416" /></p><p><p
class="wp-caption-text">Profile report with memory &amp; JIT info</p></div><p>For those interested, the references to these two options appear within the code of profview.m (line 1199 on R2007b), for the JIT option:</p><blockquote><pre>showJitLines = getpref(<span style="color: #800080;">'profiler','showJitLines'</span>,false);</pre></blockquote><p>&#8230;and profile.m (lines 163-165 on R2007b), for the memory option:</p><blockquote><pre><span style="color: #0000ff;">if</span> memory ~= -1
    callstats(<span style="color: #800080;">'memory'</span>, memory);
<span style="color: #0000ff;">end</span></pre></blockquote><p>Note that there appears to be two undocumented additional memory-related options in profile.m (lines 311-312):</p><blockquote><pre>options = {<span style="color: #800080;">'detail', 'timer', 'history', 'nohistory', 'historysize'</span>, ...
           <span style="color: #800080;">'timestamp', 'memory', 'callmemory', 'nomemory'</span> };</pre></blockquote><p>However, &#8216;-nomemory&#8217; appears to simply turn the memory stats collection off, and &#8216;-callmemory&#8217; is not recognized because of a bug in line 349, which looks for &#8216;call<strong>no</strong>memory&#8217;&#8230;:</p><blockquote><pre>    <span style="color: #0000ff;">case </span><span style="color: #800080;">'callnomemory'</span>   <span style="color: #008000;">% should be 'callmemory'</span>
           memory = 2;</pre></blockquote><p>When this bug is fixed, we see that we get only partial memory information, so the &#8216;-callmemory&#8217; option is really not useful &#8211; use &#8216;-memory&#8217; instead.</p><p><b><u>Addendum (Jan 31, 2011):</u> JIT information has been removed in Matlab 7.12 (R2011a). I assume that this was done so that programmers will not attempt to depend on JITC functionality in their code (see <a
href="http://undocumentedmatlab.com/blog/undocumented-profiler-options/#comment-64">Scott&#8217;s comment</a> below). It&#8217;s a good thing that the memory options remain, since these are quite useful in profiling memory-related bottlenecks.</b></p><p><pre> </pre>Related posts:<ol><li><a
href='http://undocumentedmatlab.com/blog/more-undocumented-timing-features/' rel='bookmark' title='More undocumented timing features'>More undocumented timing features</a> <small>There are several undocumented ways in Matlab to get CPU and clock data...</small></li><li><a
href='http://undocumentedmatlab.com/blog/undocumented-scatter-plot-behavior/' rel='bookmark' title='Undocumented scatter plot behavior'>Undocumented scatter plot behavior</a> <small>The scatter plot function has an undocumented behavior when plotting more than 100 points: it returns a single unified patch object handle, rather than a patch handle for each specific...</small></li><li><a
href='http://undocumentedmatlab.com/blog/tic-toc-undocumented-option/' rel='bookmark' title='tic / toc &#8211; undocumented option'>tic / toc &#8211; undocumented option</a> <small>Matlab's built-in tic/toc functions have an undocumented option enabling multiple nested clockings...</small></li><li><a
href='http://undocumentedmatlab.com/blog/ismembc-undocumented-helper-function/' rel='bookmark' title='ismembc &#8211; undocumented helper function'>ismembc &#8211; undocumented helper function</a> <small>Matlab has several undocumented internal helper functions that can be useful on their own in some cases. This post presents the ismembc function....</small></li></ol></p><pre> </pre>]]></content:encoded> <wfw:commentRss>http://undocumentedmatlab.com/blog/undocumented-profiler-options/feed/</wfw:commentRss> <slash:comments>13</slash:comments> </item> </channel> </rss>

<!-- W3 Total Cache: Minify debug info:
Engine:             disk: basic
Theme:              b7666
Template:           tag
-->
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: undocumentedmatlab.com @ 2012-05-21 19:42:06 -->

<!-- W3 Total Cache: Page cache debug info:
Engine:             disk: enhanced
Cache key:          blog/tag/callstats/feed/_index.xml_gzip
Caching:            enabled
Status:             not cached
Creation Time:      0.463s
Header info:
X-Pingback:         http://undocumentedmatlab.com/blog/xmlrpc.php
Set-Cookie:         wpgb_visit_last_php-default=1337654526; expires=Wed, 22-May-2013 02:42:06 GMT; path=/
Content-Type:       text/xml; charset=UTF-8
Last-Modified:      Tue, 22 May 2012 02:42:06 GMT
Vary:               Accept-Encoding, Cookie
Expires:            Tue, 22 May 2012 03:42:06 GMT
Pragma:             public
Cache-Control:      public, must-revalidate, proxy-revalidate
Etag:               106d0036d5c8aa7df0f7c28f3b35bf98
Content-Encoding:   gzip
-->
