edbizarro/timer

测量代码执行时间

v0.1.1 2018-06-20 15:04 UTC

README

Timer - 测量代码执行时间

以下是一些如何使用此包的示例

use Edbizarro\Timer\Timer;

$timer = Timer::start('timer01');
sleep(2);
$result = $timer->stop();

print_r($result);

// array:7 [                                                                                                                                                                                                
//   "start" => 1529506852.084                                                                                                                                                                              
//   "end" => 1529506854.0855                                                                                                                                                                               
//   "duration" => 2.0015239715576                                                                                                                                                                          
//   "milliseconds" => 2001.5239715576                                                                                                                                                                      
//   "seconds" => 2                                                                                                                                                                                         
//   "minutes" => 0                                                                                                                                                                                         
//   "hours" => 0                                                                                                                                                                                           
// ]    

安装

您可以通过composer安装此包

composer require edbizarro/timer

forthebadge