1
0
mirror of https://github.com/php/doc-ru.git synced 2026-03-26 00:32:15 +01:00
Files
archived-doc-ru/reference/hrtime/examples.xml
Sergey Panteleev daef8df962 Обнуление тега Reviewed (#364)
[skip-lint]
[skip-spellcheck]
2021-11-16 13:03:53 +03:00

62 lines
1.7 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: dc49857b7c13a7d4fdd7b258827de941f4e3d297 Maintainer: rjhdby Status: ready -->
<!-- Reviewed: no -->
<chapter xml:id="hrtime.examples" xmlns="http://docbook.org/ns/docbook">
&reftitle.examples;
<section xml:id="hrtime.example.basic">
<title>Основы использования</title>
<para>
Этот пример демонстрирует базовое использование класса StopWatch
</para>
<example>
<title>Замеряем время исполнения нескольких блоков кода</title>
<programlisting role="php">
<![CDATA[
<?php
$c = new HRTime\StopWatch;
$c->start();
/* Замеряем время выполнения этого блока кода */
for ($i = 0; $i < 1024*1024; $i++);
$c->stop();
$elapsed0 = $c->getLastElapsedTime(HRTime\Unit::NANOSECOND);
/* Тут не замеряем*/
for ($i = 0; $i < 1024*1024; $i++);
$c->start();
/* А тут снова замеряем время выполнения этого блока кода */
for ($i = 0; $i < 1024*1024; $i++);
$c->stop();
$elapsed1 = $c->getLastElapsedTime(HRTime\Unit::NANOSECOND);
$elapsed_total = $c->getElapsedTime(HRTime\Unit::NANOSECOND);
?>
]]>
</programlisting>
</example>
</section>
</chapter>
<!-- 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
indent-tabs-mode:nil
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
-->