%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
| Server IP : 14.207.165.8 / Your IP : 216.73.216.26 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/thread-self/root/var/www/html/old/libraries/kunena/ |
Upload File : |
<?php
/**
* Kunena Component
* @package Kunena.Framework
*
* @copyright (C) 2008 - 2014 Kunena Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @link http://www.kunena.org
**/
defined ( '_JEXEC' ) or die ();
jimport ('joomla.error.profiler');
/**
* Class KunenaProfiler
*/
class KunenaProfiler extends JProfiler {
protected static $_instances = array();
protected $_kstart = array();
/**
* @var array|KunenaProfilerItem[]
*/
protected $_heap = array();
/**
* @param string $prefix
*
* @return KunenaProfiler
*
* @fixme override getInstance() and fix the function into Joomla
*/
public static function instance($prefix = 'Kunena')
{
if (empty(self::$_instances[$prefix])) {
$c = __CLASS__;
self::$_instances[$prefix] = new $c($prefix);
}
return self::$_instances[$prefix];
}
public function start($name) {
$item = KunenaProfilerItem::getInstance($name);
$item->start($this->getmicrotime());
$this->_heap[] = $item;
}
public function getTime($name) {
$item = KunenaProfilerItem::getInstance($name);
return $this->getmicrotime() - $item->getStartTime();
}
public function stop($name) {
$item = array_pop($this->_heap);
if (!$item || $item->name != $name) {
trigger_error(__CLASS__.'::'.__FUNCTION__."('$name') is missing start()");
}
$delta = $item->stop($this->getmicrotime());
if (end($this->_heap)) {
$this->_heap[key($this->_heap)]->external($delta);
}
return $item;
}
public function getAll() {
return KunenaProfilerItem::getAll();
}
}
/**
* Class KunenaProfilerItem
*/
class KunenaProfilerItem {
/**
* @var array|KunenaProfilerItem[]
*/
protected static $_instances = array();
public $start = array();
public function __construct($name) {
$this->name = $name;
$this->calls = 0;
$this->total = 0.0;
$this->external = 0.0;
}
/**
* @param string $name
* @return KunenaProfilerItem
*/
public static function getInstance($name) {
if (empty(self::$_instances[$name])) {
self::$_instances[$name] = new KunenaProfilerItem($name);
}
return self::$_instances[$name];
}
public static function getAll() {
return self::$_instances;
}
public function getStartTime() {
return end($this->start);
}
public function getTotalTime() {
return $this->total;
}
public function getInternalTime() {
return $this->total - $this->external;
}
public function start($starttime) {
$this->calls++;
$this->start[] = $starttime;
}
public function stop($stoptime) {
$starttime = array_pop($this->start);
if (!$starttime || !$stoptime) return 0.0;
$delta = $stoptime - $starttime;
$this->total += $delta;
return $delta;
}
public function external($delta) {
$this->external += $delta;
}
}