added execution-time measurement
This commit is contained in:
parent
dee0139410
commit
7c723068f5
2 changed files with 26 additions and 4 deletions
|
|
@ -9,7 +9,7 @@ ini_set('serialize_precision', 4);
|
|||
require('includes/defines.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);
|
||||
|
||||
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.database.php');
|
||||
|
||||
// debug: measure execution times
|
||||
Util::execTime(!!$AoWoWconf['debug']);
|
||||
|
||||
// Setup Smarty
|
||||
class Smarty_AoWoW extends Smarty
|
||||
{
|
||||
|
|
@ -141,6 +144,8 @@ if (isset($_COOKIE[COOKIE_AUTH]))
|
|||
else
|
||||
User::init(0);
|
||||
|
||||
User::setLocale();
|
||||
|
||||
// assign lang/locale, userdata, characters and custom profiles
|
||||
User::assignUserToTemplate($smarty, true);
|
||||
|
||||
|
|
|
|||
|
|
@ -233,6 +233,23 @@ class Util
|
|||
'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)
|
||||
{
|
||||
if (!isset(self::$rarityColorStings))
|
||||
|
|
@ -293,8 +310,8 @@ class Util
|
|||
$sec -= $time['s'];
|
||||
}
|
||||
|
||||
if ($sec % 1)
|
||||
$time['ms'] = $sec * 1000;
|
||||
if (($sec * 1000) % 1000)
|
||||
$time['ms'] = (int)($sec * 1000);
|
||||
|
||||
return $time;
|
||||
}
|
||||
|
|
@ -328,7 +345,7 @@ class Util
|
|||
if (isset($s['s']))
|
||||
$fmt[] = $s['s']." ".Lang::$main['seconds'];
|
||||
if (isset($s['ms']))
|
||||
$fmt[] = $s['ms']." ".Lang::$main['milliseconds'];
|
||||
$fmt[] = $s['ms']." ".Lang::$main['millisecs'];
|
||||
}
|
||||
|
||||
return implode(' ', $fmt);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue