mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 16:51:40 +09:00
Remove all use of global variables as debug timers
This commit is contained in:
parent
f91bd86fb1
commit
23190bd2f5
5 changed files with 17 additions and 24 deletions
|
|
@ -183,7 +183,7 @@ class HTMLDisplayHandler
|
||||||
$pathInfo = pathinfo($layout_file);
|
$pathInfo = pathinfo($layout_file);
|
||||||
$onlyLayoutFile = $pathInfo['filename'];
|
$onlyLayoutFile = $pathInfo['filename'];
|
||||||
|
|
||||||
$GLOBALS['__layout_compile_elapsed__'] = microtime(true) - $start;
|
Rhymix\Framework\Debug::addTime('layout', microtime(true) - $start);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -297,7 +297,7 @@ class HTMLDisplayHandler
|
||||||
$output = preg_replace_callback('@<textarea[^>]*\sname="' . $keys . '".+</textarea>@isU', array(&$this, '_preserveTextAreaValue'), $output);
|
$output = preg_replace_callback('@<textarea[^>]*\sname="' . $keys . '".+</textarea>@isU', array(&$this, '_preserveTextAreaValue'), $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
$GLOBALS['__trans_content_elapsed__'] = microtime(true) - $start;
|
Rhymix\Framework\Debug::addTime('trans_content', microtime(true) - $start);
|
||||||
|
|
||||||
// Remove unnecessary information
|
// Remove unnecessary information
|
||||||
$output = preg_replace('/member\_\-([0-9]+)/s', 'member_0', $output);
|
$output = preg_replace('/member\_\-([0-9]+)/s', 'member_0', $output);
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,13 @@ class Debug
|
||||||
* Store timers here.
|
* Store timers here.
|
||||||
*/
|
*/
|
||||||
protected static $_timers = [
|
protected static $_timers = [
|
||||||
|
'query' => 0,
|
||||||
'session' => 0,
|
'session' => 0,
|
||||||
'remote' => 0,
|
'remote' => 0,
|
||||||
'query' => 0,
|
'layout' => 0,
|
||||||
|
'widget' => 0,
|
||||||
|
'template' => 0,
|
||||||
|
'trans_content' => 0,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -577,6 +581,8 @@ class Debug
|
||||||
);
|
);
|
||||||
|
|
||||||
self::$_widgets[] = $widget_object;
|
self::$_widgets[] = $widget_object;
|
||||||
|
self::$_timers['widget'] += $widget_object->widget_time;
|
||||||
|
|
||||||
if ($widget_object->widget_time && $widget_object->widget_time >= (self::$_config['log_slow_widgets'] ?? 1))
|
if ($widget_object->widget_time && $widget_object->widget_time >= (self::$_config['log_slow_widgets'] ?? 1))
|
||||||
{
|
{
|
||||||
self::$_slow_widgets[] = $widget_object;
|
self::$_slow_widgets[] = $widget_object;
|
||||||
|
|
@ -904,13 +910,12 @@ class Debug
|
||||||
'total' => sprintf('%0.4f sec', microtime(true) - \RX_MICROTIME),
|
'total' => sprintf('%0.4f sec', microtime(true) - \RX_MICROTIME),
|
||||||
'db_query' => sprintf('%0.4f sec (count: %d)', self::$_timers['query'], count(self::$_queries)),
|
'db_query' => sprintf('%0.4f sec (count: %d)', self::$_timers['query'], count(self::$_queries)),
|
||||||
'db_class' => sprintf('%0.4f sec', max(0, $db->getTotalElapsedTime() - self::$_timers['query'])),
|
'db_class' => sprintf('%0.4f sec', max(0, $db->getTotalElapsedTime() - self::$_timers['query'])),
|
||||||
'layout' => sprintf('%0.4f sec', $GLOBALS['__layout_compile_elapsed__'] ?? 0),
|
|
||||||
'widget' => sprintf('%0.4f sec', $GLOBALS['__widget_excute_elapsed__'] ?? 0),
|
|
||||||
'remote' => sprintf('%0.4f sec', self::$_timers['remote']),
|
|
||||||
'session' => sprintf('%0.4f sec', self::$_timers['session']),
|
'session' => sprintf('%0.4f sec', self::$_timers['session']),
|
||||||
'xmlparse' => sprintf('%0.4f sec', $GLOBALS['__xmlparse_elapsed__'] ?? 0),
|
'remote' => sprintf('%0.4f sec', self::$_timers['remote']),
|
||||||
'template' => sprintf('%0.4f sec (count: %d)', $GLOBALS['__template_elapsed__'] ?? 0, $GLOBALS['__TemplateHandlerCalled__'] ?? 0),
|
'layout' => sprintf('%0.4f sec', self::$_timers['layout']),
|
||||||
'trans' => sprintf('%0.4f sec', $GLOBALS['__trans_content_elapsed__'] ?? 0),
|
'widget' => sprintf('%0.4f sec', self::$_timers['widget']),
|
||||||
|
'template' => sprintf('%0.4f sec', self::$_timers['template']),
|
||||||
|
'trans' => sprintf('%0.4f sec', self::$_timers['trans_content']),
|
||||||
),
|
),
|
||||||
'entries' => array_values(self::$_entries),
|
'entries' => array_values(self::$_entries),
|
||||||
'errors' => array_values(self::$_errors),
|
'errors' => array_values(self::$_errors),
|
||||||
|
|
|
||||||
|
|
@ -378,13 +378,7 @@ class Template
|
||||||
$output = $this->execute();
|
$output = $this->execute();
|
||||||
|
|
||||||
// Record the time elapsed.
|
// Record the time elapsed.
|
||||||
$elapsed_time = microtime(true) - $start;
|
Debug::addTime('template', microtime(true) - $start);
|
||||||
if (!isset($GLOBALS['__template_elapsed__']))
|
|
||||||
{
|
|
||||||
$GLOBALS['__template_elapsed__'] = 0;
|
|
||||||
}
|
|
||||||
$GLOBALS['__template_elapsed__'] += $elapsed_time;
|
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,10 @@ Page Generation Time
|
||||||
Total Time: <?php echo $data->timing->total . "\n"; ?>
|
Total Time: <?php echo $data->timing->total . "\n"; ?>
|
||||||
DB Query Time: <?php echo $data->timing->db_query . "\n"; ?>
|
DB Query Time: <?php echo $data->timing->db_query . "\n"; ?>
|
||||||
DB Processing Time: <?php echo $data->timing->db_class . "\n"; ?>
|
DB Processing Time: <?php echo $data->timing->db_class . "\n"; ?>
|
||||||
|
Session Lock Wait Time: <?php echo $data->timing->session . "\n"; ?>
|
||||||
|
Remote Request Time: <?php echo $data->timing->remote . "\n"; ?>
|
||||||
Layout Processing Time: <?php echo $data->timing->layout . "\n"; ?>
|
Layout Processing Time: <?php echo $data->timing->layout . "\n"; ?>
|
||||||
Widget Processing Time: <?php echo $data->timing->widget . "\n"; ?>
|
Widget Processing Time: <?php echo $data->timing->widget . "\n"; ?>
|
||||||
Remote Request Time: <?php echo $data->timing->remote . "\n"; ?>
|
|
||||||
Session Lock Wait Time: <?php echo $data->timing->session . "\n"; ?>
|
|
||||||
XML Parsing Time: <?php echo $data->timing->xmlparse . "\n"; ?>
|
|
||||||
Template Compile Time: <?php echo $data->timing->template . "\n"; ?>
|
Template Compile Time: <?php echo $data->timing->template . "\n"; ?>
|
||||||
Content Transform Time: <?php echo $data->timing->trans . "\n"; ?>
|
Content Transform Time: <?php echo $data->timing->trans . "\n"; ?>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -730,11 +730,6 @@ class WidgetController extends Widget
|
||||||
|
|
||||||
// Debug widget creation time information added to the results
|
// Debug widget creation time information added to the results
|
||||||
$elapsed_time = microtime(true) - $start;
|
$elapsed_time = microtime(true) - $start;
|
||||||
if (!isset($GLOBALS['__widget_excute_elapsed__']))
|
|
||||||
{
|
|
||||||
$GLOBALS['__widget_excute_elapsed__'] = 0;
|
|
||||||
}
|
|
||||||
$GLOBALS['__widget_excute_elapsed__'] += $elapsed_time;
|
|
||||||
if (Rhymix\Framework\Debug::isEnabledForCurrentUser())
|
if (Rhymix\Framework\Debug::isEnabledForCurrentUser())
|
||||||
{
|
{
|
||||||
Rhymix\Framework\Debug::addWidget(array(
|
Rhymix\Framework\Debug::addWidget(array(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue