php-doc-en/reference/mongo/mongodb/setprofilinglevel.xml
2013-07-30 06:39:35 +00:00

106 lines
2.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mongodb.setprofilinglevel" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoDB::setProfilingLevel</refname>
<refpurpose>Sets this database&apos;s profiling level</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>int</type><methodname>MongoDB::setProfilingLevel</methodname>
<methodparam><type>int</type><parameter>level</parameter></methodparam>
</methodsynopsis>
<para>
This changes the current database profiling level.
</para>
<para>
This function is equivalent to running:
<programlisting role="php">
<![CDATA[
<?php
public function setProfilingLevel($level) {
return $this->command(array('profile' => $level));
}
?>
]]>
</programlisting>
</para>
<para>
The options for level are 0 (off), 1 (queries > 100ms), and 2 (all queries).
If you would like to profile queries that take longer than another time
period, use the database command and pass it a second option, the number of
milliseconds. For example, to profile all queries that take longer than one
second, run:
<programlisting role="php">
<![CDATA[
<?php
$result = $this->command(array('profile' => 1, 'slowms' => 1000));
?>
]]>
</programlisting>
</para>
<para>
Profiled queries will appear in the <literal>system.profile</literal>
collection of this database.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term>
<parameter>level</parameter>
</term>
<listitem>
<para>
Profiling level.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the previous profiling level.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member>MongoDB core docs on <link xlink:href="&url.mongodb.dochub.profiling;">profiling</link></member>
<member><methodname>MongoDB::getProfilingLevel</methodname></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->