📄 profiledata.html
字号:
<span class="regex">s/([a-z_]+)(\d{$opt{n},})/$1.('N' x length($2))/ieg</span> <span class="keyword">if</span> <span class="variable">$opt</span><span class="operator">{</span><span class="string">n</span><span class="operator">}</span><span class="operator">;</span>
<span class="comment"># abbreviate massive "in (...)" statements and similar</span>
<span class="regex">s!(([NS],){100,})!sprintf("$2,{repeated %d times}",length($1)/2)!eg</span><span class="operator">;</span>
<span class="operator">}</span>
</pre>
</dd>
<dd>
<p>It's often better to perform this kinds of normalization in the DBI while the
data is being collected, to avoid too much memory being used by storing profile
data for many different SQL statement. See <a href="../../lib/DBI/Profile.html">the DBI::Profile manpage</a>.</p>
</dd>
</li>
<dt><strong><a name="item_clone">$copy = $prof->clone();</a></strong>
<dd>
<p>Clone a profile data set creating a new object.</p>
</dd>
</li>
<dt><strong><a name="item_header">$header = $prof->header();</a></strong>
<dd>
<p>Returns a reference to a hash of header values. These are the key
value pairs included in the header section of the DBI::ProfileDumper
data format. For example:</p>
</dd>
<dd>
<pre>
<span class="variable">$header</span> <span class="operator">=</span> <span class="operator">{</span>
<span class="string">Path</span> <span class="operator">=></span> <span class="operator">[</span> <span class="string">'!Statement'</span><span class="operator">,</span> <span class="string">'!MethodName'</span> <span class="operator">]</span><span class="operator">,</span>
<span class="string">Program</span> <span class="operator">=></span> <span class="string">'t/42profile_data.t'</span><span class="operator">,</span>
<span class="operator">}</span><span class="operator">;</span>
</pre>
</dd>
<dd>
<p>Note that modifying this hash will modify the header data stored
inside the profile object.</p>
</dd>
</li>
<dt><strong><a name="item_nodes">$nodes = $prof-><code>nodes()</code></a></strong>
<dd>
<p>Returns a reference the sorted nodes array. Each element in the array
is a single record in the data set. The first seven elements are the
same as the elements provided by DBI::Profile. After that each key is
in a separate element. For example:</p>
</dd>
<dd>
<pre>
<span class="variable">$nodes</span> <span class="operator">=</span> <span class="operator">[</span>
<span class="operator">[</span>
<span class="number">2</span><span class="operator">,</span> <span class="comment"># 0, count</span>
<span class="number">0</span><span class="operator">.</span><span class="number">0312958955764771</span><span class="operator">,</span> <span class="comment"># 1, total duration</span>
<span class="number">0</span><span class="operator">.</span><span class="number">000490069389343262</span><span class="operator">,</span> <span class="comment"># 2, first duration</span>
<span class="number">0</span><span class="operator">.</span><span class="number">000176072120666504</span><span class="operator">,</span> <span class="comment"># 3, shortest duration</span>
<span class="number">0</span><span class="operator">.</span><span class="number">00140702724456787</span><span class="operator">,</span> <span class="comment"># 4, longest duration</span>
<span class="number">1023115819.83019</span><span class="operator">,</span> <span class="comment"># 5, time of first event</span>
<span class="number">1023115819.86576</span><span class="operator">,</span> <span class="comment"># 6, time of last event</span>
<span class="string">'SELECT foo FROM bar'</span> <span class="comment"># 7, key1</span>
<span class="string">'execute'</span> <span class="comment"># 8, key2</span>
<span class="comment"># 6+N, keyN</span>
<span class="operator">]</span><span class="operator">,</span>
<span class="comment"># ...</span>
<span class="operator">]</span><span class="operator">;</span>
</pre>
</dd>
<dd>
<p>Note that modifying this array will modify the node data stored inside
the profile object.</p>
</dd>
</li>
<dt><strong><a name="item_count">$count = $prof-><code>count()</code></a></strong>
<dd>
<p>Returns the number of items in the profile data set.</p>
</dd>
</li>
<dt><strong><a name="item_sort">$prof->sort(field => "field")</a></strong>
<dt><strong>$prof->sort(field => "field", reverse => 1)</strong>
<dd>
<p>Sorts data by the given field. Available fields are:</p>
</dd>
<dd>
<pre>
longest
total
count
shortest</pre>
</dd>
<dd>
<p>The default sort is greatest to smallest, which is the opposite of the
normal Perl meaning. This, however, matches the expected behavior of
the dbiprof frontend.</p>
</dd>
</li>
<dt><strong><a name="item_exclude">$count = $prof->exclude(key2 => "disconnect")</a></strong>
<dt><strong>$count = $prof->exclude(key2 => "disconnect", case_sensitive => 1)</strong>
<dt><strong>$count = $prof->exclude(key1 => qr/^SELECT/i)</strong>
<dd>
<p>Removes records from the data set that match the given string or
regular expression. This method modifies the data in a permanent
fashion - use <a href="#item_clone"><code>clone()</code></a> first to maintain the original data after
exclude(). Returns the number of nodes left in the profile data set.</p>
</dd>
</li>
<dt><strong><a name="item_match">$count = $prof->match(key2 => "disconnect")</a></strong>
<dt><strong>$count = $prof->match(key2 => "disconnect", case_sensitive => 1)</strong>
<dt><strong>$count = $prof->match(key1 => qr/^SELECT/i)</strong>
<dd>
<p>Removes records from the data set that do not match the given string
or regular expression. This method modifies the data in a permanent
fashion - use <a href="#item_clone"><code>clone()</code></a> first to maintain the original data after
match(). Returns the number of nodes left in the profile data set.</p>
</dd>
</li>
<dt><strong><a name="item_data">$Data = $prof-><code>Data()</code></a></strong>
<dd>
<p>Returns the same Data hash structure as seen in DBI::Profile. This
structure is not sorted. The <a href="#item_nodes"><code>nodes()</code></a> structure probably makes more
sense for most analysis.</p>
</dd>
</li>
<dt><strong><a name="item_format">$text = $prof->format($nodes->[0])</a></strong>
<dd>
<p>Formats a single node into a human-readable block of text.</p>
</dd>
</li>
<dt><strong><a name="item_report">$text = $prof->report(number => 10)</a></strong>
<dd>
<p>Produces a report with the given number of items.</p>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="author">AUTHOR</a></h1>
<p>Sam Tregar <<a href="mailto:sam@tregar.com">sam@tregar.com</a>></p>
<p>
</p>
<hr />
<h1><a name="copyright_and_license">COPYRIGHT AND LICENSE</a></h1>
<p>Copyright (C) 2002 Sam Tregar</p>
<p>This program is free software; you can redistribute it and/or modify
it under the same terms as Perl 5 itself.</p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -