Join 4,000+ others and never miss out on new tips, tutorials, and more.
25.x is outdated, please check the latest version 26.x
Latest version:
pecl install openswoole-26.2.0
<?php OpenSwoole\Coroutine::getElapsed(int $cid = 0)
Coroutine ID. By default, use the ID of current coroutine.
The elasped time of a coroutine
Get the elapsed execution duration of a coroutine by coroutine ID.
<?php
co::run(function () {
co::sleep(2);
echo OpenSwoole\Coroutine::getElapsed();
});