mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
added execution-time measurement
This commit is contained in:
@@ -9,7 +9,7 @@ ini_set('serialize_precision', 4);
|
|||||||
require('includes/defines.php');
|
require('includes/defines.php');
|
||||||
require('config/config.php');
|
require('config/config.php');
|
||||||
|
|
||||||
$e = $AoWoWconf['debug'] === true ? (E_ALL & ~(E_DEPRECATED|E_USER_DEPRECATED|E_STRICT)) : 0;
|
$e = !!$AoWoWconf['debug'] ? (E_ALL & ~(E_DEPRECATED|E_USER_DEPRECATED|E_STRICT)) : 0;
|
||||||
error_reporting($e);
|
error_reporting($e);
|
||||||
|
|
||||||
require('includes/Smarty-2.6.26/libs/Smarty.class.php'); // Libraray: http://www.smarty.net/
|
require('includes/Smarty-2.6.26/libs/Smarty.class.php'); // Libraray: http://www.smarty.net/
|
||||||
@@ -18,6 +18,9 @@ require('includes/utilities.php');
|
|||||||
require('includes/class.user.php');
|
require('includes/class.user.php');
|
||||||
require('includes/class.database.php');
|
require('includes/class.database.php');
|
||||||
|
|
||||||
|
// debug: measure execution times
|
||||||
|
Util::execTime(!!$AoWoWconf['debug']);
|
||||||
|
|
||||||
// Setup Smarty
|
// Setup Smarty
|
||||||
class Smarty_AoWoW extends Smarty
|
class Smarty_AoWoW extends Smarty
|
||||||
{
|
{
|
||||||
@@ -141,6 +144,8 @@ if (isset($_COOKIE[COOKIE_AUTH]))
|
|||||||
else
|
else
|
||||||
User::init(0);
|
User::init(0);
|
||||||
|
|
||||||
|
User::setLocale();
|
||||||
|
|
||||||
// assign lang/locale, userdata, characters and custom profiles
|
// assign lang/locale, userdata, characters and custom profiles
|
||||||
User::assignUserToTemplate($smarty, true);
|
User::assignUserToTemplate($smarty, true);
|
||||||
|
|
||||||
|
|||||||
@@ -233,6 +233,23 @@ class Util
|
|||||||
'large' => 'style="background-image: url(/images/icons/large/%s.jpg)"',
|
'large' => 'style="background-image: url(/images/icons/large/%s.jpg)"',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
private static $execTime = 0.0;
|
||||||
|
|
||||||
|
public static function execTime($set = false)
|
||||||
|
{
|
||||||
|
if ($set)
|
||||||
|
{
|
||||||
|
self::$execTime = microTime(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$newTime = microTime(true);
|
||||||
|
$tDiff = $newTime - self::$execTime;
|
||||||
|
self::$execTime = $newTime;
|
||||||
|
|
||||||
|
return self::formatTime($tDiff * 1000, true);
|
||||||
|
}
|
||||||
|
|
||||||
public static function colorByRarity($idx)
|
public static function colorByRarity($idx)
|
||||||
{
|
{
|
||||||
if (!isset(self::$rarityColorStings))
|
if (!isset(self::$rarityColorStings))
|
||||||
@@ -293,8 +310,8 @@ class Util
|
|||||||
$sec -= $time['s'];
|
$sec -= $time['s'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sec % 1)
|
if (($sec * 1000) % 1000)
|
||||||
$time['ms'] = $sec * 1000;
|
$time['ms'] = (int)($sec * 1000);
|
||||||
|
|
||||||
return $time;
|
return $time;
|
||||||
}
|
}
|
||||||
@@ -328,7 +345,7 @@ class Util
|
|||||||
if (isset($s['s']))
|
if (isset($s['s']))
|
||||||
$fmt[] = $s['s']." ".Lang::$main['seconds'];
|
$fmt[] = $s['s']." ".Lang::$main['seconds'];
|
||||||
if (isset($s['ms']))
|
if (isset($s['ms']))
|
||||||
$fmt[] = $s['ms']." ".Lang::$main['milliseconds'];
|
$fmt[] = $s['ms']." ".Lang::$main['millisecs'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return implode(' ', $fmt);
|
return implode(' ', $fmt);
|
||||||
|
|||||||
Reference in New Issue
Block a user