芝麻web文件管理V1.00
编辑当前文件:/home/mgatv524/vendashop.mgaplay.com.br/lib/Helper/Profiler.php
. */ namespace Xibo\Helper; /** * Class Profiler * @package Xibo\Helper */ class Profiler { private static $profiles = []; /** * @param $key * @param null $logger */ public static function start($key, $logger = null) { $start = microtime(true); self::$profiles[$key] = $start; if ($logger !== null) { $logger->debug('PROFILE: ' . $key . ' - start: ' . $start); } } /** * @param $key * @param null $logger */ public static function end($key, $logger = null) { $start = self::$profiles[$key] ?? 0; $end = microtime(true); unset(self::$profiles[$key]); if ($logger !== null) { $logger->debug('PROFILE: ' . $key . ' - end: ' . $end . ', duration: ' . ($end - $start)); } } }