git-svn-id: http://xe-core.googlecode.com/svn/trunk@1194 201d5d3c-b55e-5fd7-737f-ddc643e51545

This commit is contained in:
zero 2007-04-17 04:09:22 +00:00
parent 4ecfe64485
commit 4c123b4395
9 changed files with 63 additions and 34 deletions

View file

@ -652,7 +652,7 @@
* @brief HtmlHeader 추가
**/
function _addHtmlHeader($header) {
$this->html_header .= ($this->html_header?"\n":"").$header;
$this->html_header .= "\n".$header;
}
/**

View file

@ -118,14 +118,14 @@
* @brief 로그 남김
**/
function actStart($query) {
if(!__DEBUG__) return;
if(__DEBUG__ < 2) return;
$this->setError(0,'success');
$this->query = $query;
$this->act_start = getMicroTime();
}
function actFinish() {
if(!__DEBUG__ || !$this->query) return;
if(__DEBUG__ < 2 || !$this->query) return;
$this->act_finish = getMicroTime();
$elapsed_time = $this->act_finish - $this->act_start;
$GLOBALS['__db_elapsed_time__'] += $elapsed_time;

View file

@ -137,31 +137,44 @@
/**
* @brief 디버그 모드일 경우 디버기 메세지 출력
*
* __DEBUG__가 true경우 부분의 실행시간등을 debugPrint 함수를 이용해서 출력\n
* 개발시나 테스트시에 config/config.inc.php의 __DEBUG__를 true로 세팅하고\n
* __DEBUG__가 1이상경우 부분의 실행시간등을 debugPrint 함수를 이용해서 출력\n
* 개발시나 테스트시에 config/config.inc.php의 __DEBUG__를 세팅하고\n
* tail -f ./files/_debug_message.php로 하여 console로 확인하면 편리함\n
**/
function _debugOutput() {
if(!__DEBUG__) return;
$end = getMicroTime();
// debug string 작성 시작
$buff = "\n\n** Debug at ".date('Y-m-d H:i:s')." ************************************************************\n";
// Request/Response 정보 작성
$buff .= "\n- Request/ Response info\n";
$buff .= sprintf("\tRequest URI \t\t\t: %s:%s%s%s%s\n", $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING']?'?':'', $_SERVER['QUERY_STRING']);
$buff .= sprintf("\tRequest method \t\t\t: %s\n", $_SERVER['REQUEST_METHOD']);
$buff .= sprintf("\tResponse method \t\t: %s\n", Context::getResponseMethod());
$buff .= sprintf("\tResponse contents size\t\t: %d byte\n", $this->getContentSize());
if($GLOBALS['__db_queries__']) {
$buff .= "\n- DB Queries\n";
$buff .= $GLOBALS['__db_queries__'];
}
$buff .= "\n- Elapsed time\n";
if($GLOBALS['__db_elapsed_time__']) $buff .= sprintf("\tDB queries elapsed time\t\t: %0.5f sec\n", $GLOBALS['__db_elapsed_time__']);
$buff .= sprintf("\tclass file load elapsed time \t: %0.5f sec\n", $GLOBALS['__elapsed_class_load__']);
$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__']);
// DB 로그 작성
if(__DEBUG__>1) {
if($GLOBALS['__db_queries__']) {
$buff .= "\n- DB Queries\n";
$buff .= $GLOBALS['__db_queries__'];
}
$buff .= "\n- Elapsed time\n";
if($GLOBALS['__db_elapsed_time__']) $buff .= sprintf("\tDB queries elapsed time\t\t: %0.5f sec\n", $GLOBALS['__db_elapsed_time__']);
}
// 기타 로그 작성
if(__DEBUG__==3) {
$buff .= sprintf("\tclass file load elapsed time \t: %0.5f sec\n", $GLOBALS['__elapsed_class_load__']);
$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("\tTotal elapsed time \t\t: %0.5f sec", $end-__StartTime__);
debugPrint($buff, false);

View file

@ -241,7 +241,7 @@
$class_path = ModuleHandler::getModulePath($module);
if(!$class_path) return NULL;
if(__DEBUG__) $start_time = getMicroTime();
if(__DEBUG__==3) $start_time = getMicroTime();
// global 변수에 미리 생성해 둔 객체가 없으면 새로 생성
if(!$GLOBALS['_loaded_module'][$module][$type]) {
@ -298,7 +298,7 @@
$GLOBALS['_loaded_module'][$module][$type] = $oModule;
}
if(__DEBUG__) $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time;
if(__DEBUG__==3) $GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time;
// 객체 리턴
return $GLOBALS['_loaded_module'][$module][$type];

View file

@ -22,7 +22,7 @@
$this->tpl_path = $tpl_path;
// 디버그를 위한 컴파일 시작 시간 저장
if(__DEBUG__) $start = getMicroTime();
if(__DEBUG__==3) $start = getMicroTime();
// 변수 체크
$this->tpl_path = ereg_replace('(\/+)$', '', $this->tpl_path).'/';
@ -42,7 +42,7 @@
// 일단 컴파일
$buff = $this->_compile($tpl_file, $compiled_tpl_file);
if(__DEBUG__) $GLOBALS['__template_elapsed__'] += getMicroTime() - $start;
if(__DEBUG__==3) $GLOBALS['__template_elapsed__'] += getMicroTime() - $start;
// Context와 compiled_tpl_file로 컨텐츠 생성
$output = $this->_fetch($compiled_tpl_file, $buff);

View file

@ -35,7 +35,7 @@
**/
function parse($input = '') {
// 디버그를 위한 컴파일 시작 시간 저장
if(__DEBUG__) $start = getMicroTime();
if(__DEBUG__==3) $start = getMicroTime();
$this->lang = Context::getLangType();
@ -74,7 +74,7 @@
$output = array_shift($this->output);
// 디버그를 위한 컴파일 시작 시간 저장
if(__DEBUG__) $GLOBALS['__xmlparse_elapsed__'] += getMicroTime() - $start;
if(__DEBUG__==3) $GLOBALS['__xmlparse_elapsed__'] += getMicroTime() - $start;
return $output;
}