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
|
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
-
- This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
- project.
-
- Copyright (C) 1998-2018 OpenLink Software
-
- This project is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; only version 2 of the License, dated June 1991.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-
-->
<refentry id="fn_prof_sample">
<refmeta>
<refentrytitle>prof_sample</refentrytitle>
<refmiscinfo>admin</refmiscinfo>
</refmeta>
<refnamediv>
<refname>prof_sample</refname>
<refpurpose>Adds a profiling sample to a profile being accumulated.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis id="fsyn_prof_sample">
<funcprototype id="fproto_prof_sample">
<funcdef><function>prof_sample</function></funcdef>
<paramdef>in <parameter>desc</parameter> varchar</paramdef>
<paramdef>in <parameter>time_spent</parameter> integer</paramdef>
<paramdef>in <parameter>flag</parameter> integer</paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1 id="desc_prof_sample"><title>Description</title>
<para><function>prof_sample</function> is used to adds a profiling
sample to a profile being accumulated.</para>
<para>The first argument is the name of the sampled section, the times called and
cumulative times will be totaled under this heading. The second argument is the
time in milliseconds. The third argument is a flag indicating whether the
section was successfully executed. 0 indicates success, 1 indicates execute of
the statement, 2 indicates fetch on a statement's resultset, 4 indicates error.
For more description of profiling capabilities see the section about
<link linkend="EfficientSQL">SQL Execution Profiling</link>
in <link linkend="ptune">Performance tuning</link> part of
Virtuoso documentation.</para>
</refsect1>
<refsect1 id="params_prof_enable"><title>Parameters</title>
<refsect2><title>desc</title>
<para>A <type>VARCHAR</type>. Name of the sampled section.</para>
</refsect2>
<refsect2><title>time_spent</title>
<para>An <type>INTEGER</type>. Time in milliseconds.</para>
</refsect2>
<refsect2><title>flag</title>
<para>An <type>INTEGER</type>. flag indicating whether the
section was successfully executed. 0 - success, 1 - execute of
statement, 2 - fetch on a statement's resultset, 4 - error.</para>
</refsect2>
</refsect1>
<refsect1 id="ret_prof_sample"><title>Return Types</title>
<para>None.</para>
</refsect1>
<example id="ex_prof_sample">
<title>Example</title>
<programlisting>
<![CDATA[create procedure do_prof_sample()
{
declare stime integer;
for(declare i integer;i < 5;i := i + 1){
stime := msec_time();
for(select * from Demo.demo.Customers) do sprintf('1');
for(select * from Demo.demo.Employees) do sprintf('1');
for(select * from Demo.demo.Order_Details) do sprintf('1');
prof_sample('3 selects execute',msec_time() - stime,1);
};
};
prof_enable(1);
select do_prof_sample();
prof_enable(0);]]>
</programlisting>
<para>This will produce virtprof.out file of the sort:</para>
<programlisting>
Query Profile (msec)
Real 168, client wait 313, avg conc 1.863095 n_execs 6 avg exec 52
100 % under 1 s
0 % under 2 s
0 % under 5 s
0 % under 10 s
0 % under 30 s
2 stmts compiled 1 msec, 0 % prepared reused.
% total n-times n-errors
50 % 157 1 0 select do_prof_sample
49 % 156 5 0 3 selects execute
</programlisting>
</example>
<!-- <refsect1 id="errors_prof_enable"><title>Errors</title>
<para>No errors are signalled by <function>prof_enable</function></para>
<table><title>Errors signalled by</title>
<tgroup cols="4">
<thead><row><entry>SQLState</entry><entry>Error Code</entry><entry>Error Text</entry><entry>Description</entry></row></thead>
<tbody>
<row>
<entry><errorcode></errorcode></entry>
<entry><errorcode></errorcode></entry>
<entry><errorname></errorname></entry>
<entry></entry>
</row>
</tbody>
</tgroup>
</table>
</refsect1> -->
<!--<refsect1 id="examples_prof_enable"><title>Examples</title>
<example id="ex_prof_enable"><title>Simple example</title>
<para>Enable profiling.</para>
<screen>SQL> prof_enable(1);
</screen>
</example>
</refsect1>-->
<refsect1 id="seealso_prof_enable"><title>See Also</title>
<para><link linkend="EfficientSQL">SQL Execution profiling.</link></para>
<para><link linkend="fn_prof_enable">prof_enable()</link></para>
</refsect1>
</refentry>
|