/usr/share/doc/python-werkzeug-doc/html/contrib/profiler.html is in python-werkzeug-doc 0.9.6+dfsg-1+deb8u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | <!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>WSGI Application Profiler — Werkzeug 0.9.6 documentation</title>
<link rel="stylesheet" href="../_static/werkzeug.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '0.9.6',
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="top" title="Werkzeug 0.9.6 documentation" href="../index.html" />
<link rel="up" title="Contributed Modules" href="index.html" />
<link rel="next" title="Lint Validation Middleware" href="lint.html" />
<link rel="prev" title="Fixers" href="fixers.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="lint.html" title="Lint Validation Middleware"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="fixers.html" title="Fixers"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">Werkzeug 0.9.6 documentation</a> »</li>
<li><a href="index.html" accesskey="U">Contributed Modules</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="module-werkzeug.contrib.profiler">
<span id="wsgi-application-profiler"></span><h1>WSGI Application Profiler<a class="headerlink" href="#module-werkzeug.contrib.profiler" title="Permalink to this headline">¶</a></h1>
<p>This module provides a simple WSGI profiler middleware for finding
bottlenecks in web application. It uses the <tt class="xref py py-mod docutils literal"><span class="pre">profile</span></tt> or
<tt class="xref py py-mod docutils literal"><span class="pre">cProfile</span></tt> module to do the profiling and writes the stats to the
stream provided (defaults to stderr).</p>
<p>Example usage:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">werkzeug.contrib.profiler</span> <span class="kn">import</span> <span class="n">ProfilerMiddleware</span>
<span class="n">app</span> <span class="o">=</span> <span class="n">ProfilerMiddleware</span><span class="p">(</span><span class="n">app</span><span class="p">)</span>
</pre></div>
</div>
<dl class="class">
<dt id="werkzeug.contrib.profiler.MergeStream">
<em class="property">class </em><tt class="descclassname">werkzeug.contrib.profiler.</tt><tt class="descname">MergeStream</tt><big>(</big><em>*streams</em><big>)</big><a class="headerlink" href="#werkzeug.contrib.profiler.MergeStream" title="Permalink to this definition">¶</a></dt>
<dd><p>An object that redirects <cite>write</cite> calls to multiple streams.
Use this to log to both <cite>sys.stdout</cite> and a file:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">f</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="s">'profiler.log'</span><span class="p">,</span> <span class="s">'w'</span><span class="p">)</span>
<span class="n">stream</span> <span class="o">=</span> <span class="n">MergeStream</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">stdout</span><span class="p">,</span> <span class="n">f</span><span class="p">)</span>
<span class="n">profiler</span> <span class="o">=</span> <span class="n">ProfilerMiddleware</span><span class="p">(</span><span class="n">app</span><span class="p">,</span> <span class="n">stream</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>
<dl class="class">
<dt id="werkzeug.contrib.profiler.ProfilerMiddleware">
<em class="property">class </em><tt class="descclassname">werkzeug.contrib.profiler.</tt><tt class="descname">ProfilerMiddleware</tt><big>(</big><em>app</em>, <em>stream=None</em>, <em>sort_by=('time'</em>, <em>'calls')</em>, <em>restrictions=()</em>, <em>profile_dir=None</em><big>)</big><a class="headerlink" href="#werkzeug.contrib.profiler.ProfilerMiddleware" title="Permalink to this definition">¶</a></dt>
<dd><p>Simple profiler middleware. Wraps a WSGI application and profiles
a request. This intentionally buffers the response so that timings are
more exact.</p>
<p>By giving the <cite>profile_dir</cite> argument, pstat.Stats files are saved to that
directory, one file per request. Without it, a summary is printed to
<cite>stream</cite> instead.</p>
<p>For the exact meaning of <cite>sort_by</cite> and <cite>restrictions</cite> consult the
<tt class="xref py py-mod docutils literal"><span class="pre">profile</span></tt> documentation.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.9: </span>Added support for <cite>restrictions</cite> and <cite>profile_dir</cite>.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>app</strong> – the WSGI application to profile.</li>
<li><strong>stream</strong> – the stream for the profiled stats. defaults to stderr.</li>
<li><strong>sort_by</strong> – a tuple of columns to sort the result by.</li>
<li><strong>restrictions</strong> – a tuple of profiling strictions, not used if dumping
to <cite>profile_dir</cite>.</li>
<li><strong>profile_dir</strong> – directory name to save pstat files</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="werkzeug.contrib.profiler.make_action">
<tt class="descclassname">werkzeug.contrib.profiler.</tt><tt class="descname">make_action</tt><big>(</big><em>app_factory</em>, <em>hostname='localhost'</em>, <em>port=5000</em>, <em>threaded=False</em>, <em>processes=1</em>, <em>stream=None</em>, <em>sort_by=('time'</em>, <em>'calls')</em>, <em>restrictions=()</em><big>)</big><a class="headerlink" href="#werkzeug.contrib.profiler.make_action" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a new callback for <tt class="xref py py-mod docutils literal"><span class="pre">werkzeug.script</span></tt> that starts a local
server with the profiler enabled.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">werkzeug.contrib</span> <span class="kn">import</span> <span class="n">profiler</span>
<span class="n">action_profile</span> <span class="o">=</span> <span class="n">profiler</span><span class="o">.</span><span class="n">make_action</span><span class="p">(</span><span class="n">make_app</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html">
<img class="logo" src="../_static/werkzeug.png" alt="Logo"/>
</a></p><h3>Related Topics</h3>
<ul>
<li><a href="../index.html">Documentation overview</a><ul>
<li><a href="index.html">Contributed Modules</a><ul>
<li>Previous: <a href="fixers.html" title="previous chapter">Fixers</a></li>
<li>Next: <a href="lint.html" title="next chapter">Lint Validation Middleware</a></li>
</ul></li>
</ul></li>
</ul>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/contrib/profiler.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" />
<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="footer">
© Copyright 2011, The Werkzeug Team.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
</div>
</body>
</html>
|