<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Profiling — Bazaar v2.2.4 documentation</title> <link rel="stylesheet" href="_static/default.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '', VERSION: '2.2.4', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="_static/jquery.js"></script> <script type="text/javascript" src="_static/underscore.js"></script> <script type="text/javascript" src="_static/doctools.js"></script> <link rel="shortcut icon" href="_static/bzr.ico"/> <link rel="top" title="Bazaar v2.2.4 documentation" href="index.html" /> <link rel="next" title="Tracking Bugs in Bazaar" href="bug-handling.html" /> <link rel="prev" title="Bazaar Release Cycles" href="cycle.html" /> <link rel="stylesheet" href="_static/bzr-doc.css" type="text/css" /> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="bug-handling.html" title="Tracking Bugs in Bazaar" accesskey="N">next</a></li> <li class="right" > <a href="cycle.html" title="Bazaar Release Cycles" accesskey="P">previous</a> |</li> <li><a href="http://bazaar.canonical.com/"> <img src="_static/bzr icon 16.png" /> Home</a> | </li> <a href="http://doc.bazaar.canonical.com/en/">Documentation</a> | </li> <li><a href="index.html">Developer Document Catalog (2.2.4)</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="profiling"> <h1>Profiling<a class="headerlink" href="#profiling" title="Permalink to this headline">¶</a></h1> <div class="section" id="using-profilers"> <h2>Using profilers<a class="headerlink" href="#using-profilers" title="Permalink to this headline">¶</a></h2> <p>Bazaar has some built-in support for collecting and saving profiling information. In the simpliest case, the <tt class="docutils literal"><span class="pre">--lsprof</span></tt> option can be used as shown below:</p> <div class="highlight-python"><pre>bzr --lsprof ...</pre> </div> <p>This will dump the profiling information to stdout before exiting. Alternatively, the <tt class="docutils literal"><span class="pre">--lsprof-file</span></tt> option can be used to specify a filename to save the profiling data into to. By default, profiling data saved to a file is a pickled Python object making it possible to reload the data and do with it what you will. For convenience though:</p> <ul class="simple"> <li>if the filename ends in <tt class="docutils literal"><span class="pre">.txt</span></tt>, it will be dumped in a text format.</li> <li>if the filename either starts with <tt class="docutils literal"><span class="pre">callgrind.out</span></tt> or ends with <tt class="docutils literal"><span class="pre">.callgrind</span></tt>, it will be converted to a format loadable by the KCacheGrind visualization tool.</li> </ul> <p>Note that KCacheGrind’s Open Dialog has a default filter than only shows files starting with <tt class="docutils literal"><span class="pre">callgrind.out</span></tt> so the longer filename is usually preferable. Here is an example of how to use the <tt class="docutils literal"><span class="pre">--lsprof-file</span></tt> option in combination with KCacheGrind to visualize what the <tt class="docutils literal"><span class="pre">status</span></tt> command is doing:</p> <div class="highlight-python"><pre>bzr --lsprof-file callgrind.out.st001 status kcachegrind callgrind.out.st001 &</pre> </div> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">bzr also has a <tt class="docutils literal"><span class="pre">--profile</span></tt> option that uses the hotshot profiler instead of the lsprof profiler. The hotshot profiler can be useful though the lsprof one is generally recommended. See <a class="reference external" href="http://docs.python.org/lib/node795.html">http://docs.python.org/lib/node795.html</a>.</p> </div> <p>Note that to use <tt class="docutils literal"><span class="pre">--lsprof</span></tt> you must install the lsprof module, which you can get with:</p> <div class="highlight-python"><pre>svn co http://codespeak.net/svn/user/arigo/hack/misc/lsprof</pre> </div> </div> <div class="section" id="profiling-locks"> <h2>Profiling locks<a class="headerlink" href="#profiling-locks" title="Permalink to this headline">¶</a></h2> <p>Bazaar can log when locks are taken or released, which can help in identifying unnecessary lock traffic. This is activated by the <tt class="docutils literal"><span class="pre">-Dlock</span></tt> global option.</p> <p>This writes messages into <tt class="docutils literal"><span class="pre">~/.bzr.log</span></tt>. At present this only logs actions relating to the on-disk lockdir. It doesn’t describe actions on in-memory lock counters, or OS locks (which are used for dirstate.)</p> </div> <div class="section" id="profiling-hpss-requests"> <h2>Profiling HPSS Requests<a class="headerlink" href="#profiling-hpss-requests" title="Permalink to this headline">¶</a></h2> <p>When trying to improve network performance, it is often useful to know what requests are being made, and how long they are taking. The <tt class="docutils literal"><span class="pre">-Dhpss</span></tt> global option will enable logging smart server requests, including the time spent in each request.</p> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="index.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">Profiling</a><ul> <li><a class="reference internal" href="#using-profilers">Using profilers</a></li> <li><a class="reference internal" href="#profiling-locks">Profiling locks</a></li> <li><a class="reference internal" href="#profiling-hpss-requests">Profiling HPSS Requests</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="cycle.html" title="previous chapter">Bazaar Release Cycles</a></p> <h4>Next topic</h4> <p class="topless"><a href="bug-handling.html" title="next chapter">Tracking Bugs in Bazaar</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="_sources/profiling.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="search.html" method="get"> <input type="text" name="q" size="18" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="bug-handling.html" title="Tracking Bugs in Bazaar" >next</a></li> <li class="right" > <a href="cycle.html" title="Bazaar Release Cycles" >previous</a> |</li> <li><a href="http://bazaar.canonical.com/"> <img src="_static/bzr icon 16.png" /> Home</a> | </li> <a href="http://doc.bazaar.canonical.com/en/">Documentation</a> | </li> <li><a href="index.html">Developer Document Catalog (2.2.4)</a> »</li> </ul> </div> <div class="footer"> © Copyright 2009, Canonical Ltd. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7. </div> </body> </html>