From 46ceabcbb9d1b82482d52f90a0a3cc23c9f71a73 Mon Sep 17 00:00:00 2001 From: zero Date: Wed, 18 Apr 2007 01:12:09 +0000 Subject: [PATCH] git-svn-id: http://xe-core.googlecode.com/svn/trunk@1199 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- classes/display/DisplayHandler.class.php | 13 +++++++++++++ classes/plugin/PluginHandler.class.php | 12 ++++++++++-- classes/template/TemplateHandler.class.php | 5 ++--- classes/xml/XmlJsFilter.class.php | 3 +-- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/classes/display/DisplayHandler.class.php b/classes/display/DisplayHandler.class.php index 909c29274..cc4cc4e9e 100644 --- a/classes/display/DisplayHandler.class.php +++ b/classes/display/DisplayHandler.class.php @@ -31,6 +31,7 @@ Context::set('content', $content); // 레이아웃을 컴파일 + if(__DEBUG__==3) $start = getMicroTime(); require_once("./classes/template/TemplateHandler.class.php"); $oTemplate = new TemplateHandler(); @@ -39,10 +40,13 @@ if(!$layout_path) $layout_path = './common/tpl/'; if(!$layout_file) $layout_file = 'default_layout.html'; $zbxe_final_content = $oTemplate->compile($layout_path, $layout_file); + if(__DEBUG__==3) $GLOBALS['__layout_compile_elapsed__'] = getMicroTime()-$start; // 각 플러그인, 에디터 컴포넌트의 코드 변경 + if(__DEBUG__==3) $start = getMicroTime(); $oContext = &Context::getInstance(); $zbxe_final_content= $oContext->transContent($zbxe_final_content); + if(__DEBUG__==3) $GLOBALS['__trans_plugin_editor_elapsed__'] = getMicroTime()-$start; // 최종 결과를 common_layout에 넣어버림 Context::set('zbxe_final_content', $zbxe_final_content); @@ -172,6 +176,15 @@ $buff .= sprintf("\tTemplate compile elapsed time\t: %0.5f sec\n", $GLOBALS['__template_elapsed__']); $buff .= sprintf("\tXmlParse compile elapsed time\t: %0.5f sec\n", $GLOBALS['__xmlparse_elapsed__']); $buff .= sprintf("\tPHP elapsed time \t\t: %0.5f sec\n", $end-__StartTime__-$GLOBALS['__template_elapsed__']-$GLOBALS['__xmlparse_elapsed__']-$GLOBALS['__db_elapsed_time__']-$GLOBALS['__elapsed_class_load__']); + + // 플러그인 실행 시간 작성 + $buff .= sprintf("\n\tPlugins elapsed time \t\t: %0.5f sec", $GLOBALS['__plugin_excute_elapsed__']); + + // 레이아웃 실행 시간 + $buff .= sprintf("\n\tLayout compile elapsed time \t: %0.5f sec", $GLOBALS['__layout_compile_elapsed__']); + + // 플러그인, 에디터 컴포넌트 치환 시간 + $buff .= sprintf("\n\tTrans plugin&editor elapsed time: %0.5f sec\n\n", $GLOBALS['__trans_plugin_editor_elapsed__']); } // 전체 실행 시간 작성 diff --git a/classes/plugin/PluginHandler.class.php b/classes/plugin/PluginHandler.class.php index 45706e823..90371f3c0 100644 --- a/classes/plugin/PluginHandler.class.php +++ b/classes/plugin/PluginHandler.class.php @@ -14,12 +14,20 @@ *
태그 사용 templateHandler에서 PluginHandler::execute()를 실행하는 코드로 대체하게 된다 **/ function execute($plugin, $args) { + // 디버그를 위한 플러그인 실행 시간 저장 + if(__DEBUG__==3) $start = getMicroTime(); + // $plugin의 객체를 받음 $oPlugin = PluginHandler::getObject($plugin); - if(!$oPlugin) return; // 플러그인 실행 - return $oPlugin->proc($args); + if($oPlugin) { + $output = $oPlugin->proc($args); + } + + if(__DEBUG__==3) $GLOBALS['__plugin_excute_elapsed__'] += getMicroTime() - $start; + + return $output; } /** diff --git a/classes/template/TemplateHandler.class.php b/classes/template/TemplateHandler.class.php index 3aff364ab..407c31932 100644 --- a/classes/template/TemplateHandler.class.php +++ b/classes/template/TemplateHandler.class.php @@ -42,12 +42,11 @@ // 일단 컴파일 $buff = $this->_compile($tpl_file, $compiled_tpl_file); - if(__DEBUG__==3) $GLOBALS['__template_elapsed__'] += getMicroTime() - $start; - // Context와 compiled_tpl_file로 컨텐츠 생성 $output = $this->_fetch($compiled_tpl_file, $buff); - // 컴파일된 파일을 실행 + if(__DEBUG__==3) $GLOBALS['__template_elapsed__'] += getMicroTime() - $start; + return $output; } diff --git a/classes/xml/XmlJsFilter.class.php b/classes/xml/XmlJsFilter.class.php index de196f921..57e4cdb72 100644 --- a/classes/xml/XmlJsFilter.class.php +++ b/classes/xml/XmlJsFilter.class.php @@ -57,8 +57,7 @@ function compile() { if(!file_exists($this->xml_file)) return; if(!file_exists($this->js_file)) $this->_compile(); - if(filectime($this->xml_file)>filectime($this->js_file)) $this->_compile(); - $this->_compile(); + else if(filectime($this->xml_file)>filectime($this->js_file)) $this->_compile(); Context::addJsFile($this->js_file); }