<!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 2.7.0 documentation</title> <link rel="stylesheet" href="_static/classic.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.7.0', 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="search" title="Search" href="search.html" /> <link rel="top" title="Bazaar 2.7.0 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 role="document"> <div class="related" role="navigation" aria-label="related navigation"> <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 class="nav-item nav-item-0"><a href="index.html">Developer Document Catalog (2.7.0)</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <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 <code class="docutils literal"><span class="pre">--lsprof</span></code> option can be used as shown below:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">bzr</span> <span class="o">--</span><span class="n">lsprof</span> <span class="o">...</span> </pre></div> </div> <p>This will dump the profiling information to stdout before exiting. Alternatively, the <code class="docutils literal"><span class="pre">--lsprof-file</span></code> 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 <code class="docutils literal"><span class="pre">.txt</span></code>, it will be dumped in a text format.</li> <li>if the filename either starts with <code class="docutils literal"><span class="pre">callgrind.out</span></code> or ends with <code class="docutils literal"><span class="pre">.callgrind</span></code>, 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 <code class="docutils literal"><span class="pre">callgrind.out</span></code> so the longer filename is usually preferable. Here is an example of how to use the <code class="docutils literal"><span class="pre">--lsprof-file</span></code> option in combination with KCacheGrind to visualize what the <code class="docutils literal"><span class="pre">status</span></code> command is doing:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">bzr</span> <span class="o">--</span><span class="n">lsprof</span><span class="o">-</span><span class="n">file</span> <span class="n">callgrind</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">st001</span> <span class="n">status</span> <span class="n">kcachegrind</span> <span class="n">callgrind</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">st001</span> <span class="o">&</span> </pre></div> </div> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">bzr also has a <code class="docutils literal"><span class="pre">--profile</span></code> 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 <code class="docutils literal"><span class="pre">--lsprof</span></code> you must install the lsprof module, which you can get with:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">svn</span> <span class="n">co</span> <span class="n">http</span><span class="p">:</span><span class="o">//</span><span class="n">codespeak</span><span class="o">.</span><span class="n">net</span><span class="o">/</span><span class="n">svn</span><span class="o">/</span><span class="n">user</span><span class="o">/</span><span class="n">arigo</span><span class="o">/</span><span class="n">hack</span><span class="o">/</span><span class="n">misc</span><span class="o">/</span><span class="n">lsprof</span> </pre></div> </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 <code class="docutils literal"><span class="pre">-Dlock</span></code> global option.</p> <p>This writes messages into <code class="docutils literal"><span class="pre">~/.bzr.log</span></code>. 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 <code class="docutils literal"><span class="pre">-Dhpss</span></code> global option will enable logging smart server requests, including the time spent in each request.</p> </div> </div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <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> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="_sources/profiling.txt" rel="nofollow">Show Source</a></li> </ul> </div> <div id="searchbox" style="display: none" role="search"> <h3>Quick search</h3> <form class="search" action="search.html" method="get"> <div><input type="text" name="q" /></div> <div><input type="submit" value="Go" /></div> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related" role="navigation" aria-label="related navigation"> <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 class="nav-item nav-item-0"><a href="index.html">Developer Document Catalog (2.7.0)</a> »</li> </ul> </div> <div class="footer" role="contentinfo"> © Copyright 2009-2011 Canonical Ltd. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.9. </div> </body> </html>