muzzlefork/timer

v0.1.0 2013-07-29 12:34 UTC

This package is not auto-updated.

Last update: 2024-09-24 03:28:35 UTC


README

PHP的基本composer包,允许您对动作进行计时。

安装: composer require "muzzlefork/timer 0.1.*"

用法

$t = MuzzleFork\Timer::get('x'); // Timers are inactive when started
$t->resume('Starting API call');
// do some heavy work
$t->pause('API command completed');
// go and do something else
$t->resume('Starting new API call');
$t->pause('Some other message');
	
echo $t->getTotal();

值得注意

  • 当您创建一个定时器时,它处于非活动状态,因此您应该 ->start() 或 ->resume() 它。
  • 您可以将消息传递给 ->resume($msg) 和 ->pause($msg),这在获取完整列表时可能很有用。