OpenSwoole\Coroutine::getElapsed(int $cid = 0)

Latest version: pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5

Declaration

<?php OpenSwoole\Coroutine::getElapsed(int $cid = 0)

Parameters

cid

Coroutine ID. By default, use the ID of current coroutine.

Return

elapsed

The elasped time of a coroutine

Description

Get the elapsed execution duration of a coroutine by coroutine ID.

Example

<?php
co::run(function () {
      co::sleep(2);
    echo OpenSwoole\Coroutine::getElapsed();
});
Last updated on September 1, 2022