本文整理汇总了PHP中getMicroTime函数的典型用法代码示例。如果您正苦于以下问题:PHP getMicroTime函数的具体用法?PHP getMicroTime怎么用?PHP getMicroTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getMicroTime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compile
/**
* @brief 주어진 tpl파일의 컴파일
**/
function compile($tpl_path, $tpl_filename, $tpl_file = '')
{
// 디버그를 위한 컴파일 시작 시간 저장
if (__DEBUG__ == 3) {
$start = getMicroTime();
}
// 변수 체크
if (substr($tpl_path, -1) != '/') {
$tpl_path .= '/';
}
if (substr($tpl_filename, -5) != '.html') {
$tpl_filename .= '.html';
}
// tpl_file 변수 생성
if (!$tpl_file) {
$tpl_file = $tpl_path . $tpl_filename;
}
// tpl_file이 비어 있거나 해당 파일이 없으면 return
if (!$tpl_file || !file_exists(FileHandler::getRealPath($tpl_file))) {
return;
}
$this->tpl_path = preg_replace('/^\\.\\//', '', $tpl_path);
$this->tpl_file = $tpl_file;
// compiled된(or 될) 파일이름을 구함
$compiled_tpl_file = FileHandler::getRealPath($this->_getCompiledFileName($tpl_file));
// 일단 컴파일
$buff = $this->_compile($tpl_file, $compiled_tpl_file);
// Context와 compiled_tpl_file로 컨텐츠 생성
$output = $this->_fetch($compiled_tpl_file, $buff, $tpl_path);
if (__DEBUG__ == 3) {
$GLOBALS['__template_elapsed__'] += getMicroTime() - $start;
}
return $output;
}
示例2: printHTMLfooter
function printHTMLfooter($scriptName, $startTime)
{
$endTime = getMicroTime();
$totalTime = $endTime - $startTime;
printf("<br><hr>RUBBoS (C) Rice University/INRIA<br><i>Page generated by {$scriptName} in %.3f seconds</i><br>\n", $totalTime);
print "</body>\n";
print "</html>\n";
}
示例3: view
public function view($fileName, $context = array())
{
$filePath = null;
$cached = false;
$fileSource = $this->getTemplateFile($fileName, $filePath);
$filePath = str_replace(ROOT, '', $filePath);
// Process plugins hook.
// It is DI for Plugins::intercept() method.
if (!empty($this->loader->pluginsCallback) && is_callable($this->loader->pluginsCallback)) {
$fileSource = call_user_func($this->loader->pluginsCallback, 'before_view', $fileSource);
}
$start = getMicroTime();
$data = $this->parseTemplate($fileSource, $context, $filePath, $cached);
$took = getMicroTime($start);
call_user_func($this->loader->debugCallback, array('Templates', 'Compile time', 'Cached'), array($filePath, $took, $cached ? 'From cache' : 'Compiled'));
return $data;
}
示例4: tf
function tf($page, &$startTime, &$endTime)
{
global $xcludeContent;
//The new parser strips all \r and lets \n do all the line break work
$syntax = $page['data'];
$syntax = str_replace("\r", '', $syntax);
// Determine the page syntax type
$is_html = isset($page['is_html']) ? $page['is_html'] == 1 : false;
$parser = new JisonParser_Wiki_Handler();
$WysiwygParser = new JisonParser_WikiCKEditor_Handler();
$parserHtmlToWiki = new JisonParser_Html_Handler();
// Parse
$startTime = getMicroTime();
if (!$is_html) {
$wikiSyntax = $syntax;
$html = $WysiwygParser->parse($wikiSyntax);
$wiki = $parserHtmlToWiki->parse($html);
} else {
$htmlSyntax = $syntax;
$wikiSyntax = $parserHtmlToWiki->parse($htmlSyntax);
$html = $WysiwygParser->parse($wikiSyntax);
$wiki = $parserHtmlToWiki->parse($html);
}
$endTime = getMicroTime();
$success = $wikiSyntax == $wiki;
if ($success == false && !$xcludeContent) {
echo "\n";
echo '"' . $wikiSyntax . '"';
echo "\n---------------------" . mb_detect_encoding($wikiSyntax) . "-------------------------\n";
echo $html;
echo "\n----------------------------------------------\n";
echo '"' . $wiki . '"';
echo "\n----------------------" . mb_detect_encoding($wiki) . "------------------------\n";
}
echo $success ? "\tSUCCESS" : "\tFAILURE";
unset($parser);
unset($WysiwygParser);
unset($parserHtmlToWiki);
unset($html);
return $success;
}
示例5: parse
/**
* @brief xml 파싱
**/
function parse($input = '')
{
// 디버그를 위한 컴파일 시작 시간 저장
if (__DEBUG__ == 3) {
$start = getMicroTime();
}
$this->lang = Context::getLangType();
$this->input = $input ? $input : $GLOBALS['HTTP_RAW_POST_DATA'];
// 지원언어 종류를 뽑음
preg_match_all("/xml:lang=\"([^\"].+)\"/i", $this->input, $matches);
// xml:lang이 쓰였을 경우 지원하는 언어종류를 뽑음
if (count($matches[1]) && ($supported_lang = array_unique($matches[1]))) {
// supported_lang에 현재 접속자의 lang이 없으면 en이 있는지 확인하여 en이 있으면 en을 기본, 아니면 첫번째것을..
if (!in_array($this->lang, $supported_lang)) {
if (in_array('en', $supported_lang)) {
$this->lang = 'en';
} else {
$this->lang = array_shift($supported_lang);
}
}
// 특별한 언어가 지정되지 않았다면 언어체크를 하지 않음
} else {
unset($this->lang);
}
$this->oParser = xml_parser_create('UTF-8');
xml_set_object($this->oParser, $this);
xml_set_element_handler($this->oParser, "_tagOpen", "_tagClosed");
xml_set_character_data_handler($this->oParser, "_tagBody");
xml_parse($this->oParser, $this->input);
xml_parser_free($this->oParser);
if (!count($this->output)) {
return;
}
$output = array_shift($this->output);
// 디버그를 위한 컴파일 시작 시간 저장
if (__DEBUG__ == 3) {
$GLOBALS['__xmlparse_elapsed__'] += getMicroTime() - $start;
}
return $output;
}
示例6: output_page
function output_page ( )
{
global $abs, $tpl, $pageTmr, $sql, $_CACHE;
$tpl->gotoBlock ( "_ROOT" );
# Timers
$totalTime = getMicroTime ( ) - $pageTmr;
$sqlTime = $sql->getSqlTime ( );
$phpTime = $totalTime - $sqlTime;
$tpl->assign ( array (
"totTmr" => round ( $totalTime, 4 ),
"phpTmr" => round ( $phpTime, 4 ),
"sqlTmr" => round ( $sqlTime, 4 ),
"dag" => date ( "d" ),
"maand" => date ( "m" ),
"jaar" => date ( "y" )
) );
if ( false )
{
# Cache deze pagina
$html = $tpl->getOutputContent ( );
$file = $abs . "cache/" . $_CACHE['file_hash'] . ".txt";
$handle = fopen ( $file, 'w' );
fwrite ( $handle, $html );
fclose ( $handle );
}
$tpl->printToScreen ( );
}
示例7: display_follow_up
function display_follow_up($cid, $level, $display, $filter, $link, $comment_table)
{
$follow = mysql_query("SELECT story_id,id,subject,writer,date FROM {$comment_table} WHERE parent={$cid}", $link) or die("ERROR: Query failed");
while ($follow_row = mysql_fetch_array($follow)) {
for ($i = 0; $i < $level; $i++) {
printf("   ");
}
print "<a href=\"ViewComment.php?comment_table={$comment_table}&storyId=" . $follow_row["story_id"] . "&commentId=" . $follow_row["id"] . "&filter={$filter}&display={$display}\">" . $follow_row["subject"] . "</a> by " . getUserName($follow_row["writer"], $link) . " on " . $follow_row["date"] . "<br>\n";
if ($follow_row["childs"] > 0) {
display_follow_up($follow_row["id"], $level + 1, $display, $filter, $link, $comment_table);
}
}
}
$scriptName = "ViewStory.php";
include "PHPprinter.php";
$startTime = getMicroTime();
// Check parameters
$storyId = $HTTP_POST_VARS['storyId'];
if ($storyId == null) {
$storyId = $HTTP_GET_VARS['storyId'];
if ($storyId == null) {
printError($scriptName, $startTime, "Viewing story", "You must provide a story identifier!<br>");
exit;
}
}
getDatabaseLink($link);
$result = mysql_query("SELECT * FROM stories WHERE id={$storyId}") or die("ERROR: Query failed");
if (mysql_num_rows($result) == 0) {
$result = mysql_query("SELECT * FROM old_stories WHERE id={$storyId}") or die("ERROR: Query failed");
$comment_table = "old_comments";
} else {
示例8: Auth
die;
}
}
$page_title = $VAR['page_title'];
$auth = new Auth($db, 'login.php', 'secret');
require INCLUDE_URL . SEP . 'acl.php';
require 'modules/core/translate.php';
############################
# Debuging #
############################
function getMicroTime()
{
list($usec, $sec) = explode(" ", microtime());
return (double) $usec + (double) $sec;
}
$start = getMicroTime();
// If log off is set then we log off
if (isset($VAR['action']) && $VAR['action'] == 'logout') {
$auth->logout('login.php');
}
/* get company info for defaults */
$q = 'SELECT * FROM ' . PRFX . 'TABLE_COMPANY, ' . PRFX . 'VERSION ORDER BY ' . PRFX . 'VERSION.`VERSION_INSTALLED` DESC LIMIT 1';
if (!($rs = $db->execute($q))) {
force_page('core', 'error&error_msg=MySQL Error: ' . $db->ErrorMsg() . '&menu=1&type=database');
exit;
}
$smarty->assign('version', $rs->fields['VERSION_NAME']);
$smarty->assign('company_name', $rs->fields['COMPANY_NAME']);
$smarty->assign('company_address', $rs->fields['COMPANY_ADDRESS']);
$smarty->assign('company_city', $rs->fields['COMPANY_CITY']);
$smarty->assign('company_state', $rs->fields['COMPANY_STATE']);
示例9: actDBClassFinish
/**
* Finish recording DBClass log
* @return void
*/
function actDBClassFinish()
{
if (!$this->query) {
return;
}
$this->act_dbclass_finish = getMicroTime();
$elapsed_dbclass_time = $this->act_dbclass_finish - $this->act_dbclass_start;
$this->elapsed_dbclass_time = $elapsed_dbclass_time;
$GLOBALS['__dbclass_elapsed_time__'] += $elapsed_dbclass_time;
}
示例10: _debugOutput
/**
* Print debugging message to designated output source depending on the value set to __DEBUG_OUTPUT_. \n
* This method only functions when __DEBUG__ variable is set to 1.
* __DEBUG_OUTPUT__ == 0, messages are written in ./files/_debug_message.php
* @return void
*/
function _debugOutput()
{
if (!__DEBUG__) {
return;
}
$end = getMicroTime();
// Firebug console output
if (__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) {
static $firephp;
if (!isset($firephp)) {
$firephp = FirePHP::getInstance(true);
}
if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) {
$firephp->fb('Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php', 'The IP address is not allowed.');
return;
}
// display total execution time and Request/Response info
if (__DEBUG__ & 2) {
$firephp->fb(array('Request / Response info >>> ' . $_SERVER['REQUEST_METHOD'] . ' / ' . Context::getResponseMethod(), array(array('Request URI', 'Request method', 'Response method', 'Response contents size', 'Memory peak usage'), array(sprintf("%s:%s%s%s%s", $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING'] ? '?' : '', $_SERVER['QUERY_STRING']), $_SERVER['REQUEST_METHOD'], Context::getResponseMethod(), $this->content_size . ' byte', FileHandler::filesize(memory_get_peak_usage())))), 'TABLE');
$firephp->fb(array('Elapsed time >>> Total : ' . sprintf('%0.5f sec', $end - __StartTime__), array(array('DB queries', 'class file load', 'Template compile', 'XmlParse compile', 'PHP', 'Widgets', 'Trans Content'), array(sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']), sprintf('%0.5f sec', $GLOBALS['__elapsed_class_load__']), sprintf('%0.5f sec (%d called)', $GLOBALS['__template_elapsed__'], $GLOBALS['__TemplateHandlerCalled__']), sprintf('%0.5f sec', $GLOBALS['__xmlparse_elapsed__']), sprintf('%0.5f sec', $end - __StartTime__ - $GLOBALS['__template_elapsed__'] - $GLOBALS['__xmlparse_elapsed__'] - $GLOBALS['__db_elapsed_time__'] - $GLOBALS['__elapsed_class_load__']), sprintf('%0.5f sec', $GLOBALS['__widget_excute_elapsed__']), sprintf('%0.5f sec', $GLOBALS['__trans_content_elapsed__'])))), 'TABLE');
}
// display DB query history
if (__DEBUG__ & 4 && $GLOBALS['__db_queries__']) {
$queries_output = array(array('Result/' . PHP_EOL . 'Elapsed time', 'Query ID', 'Query'));
foreach ($GLOBALS['__db_queries__'] as $query) {
$queries_output[] = array($query['result'] . PHP_EOL . sprintf('%0.5f', $query['elapsed_time']), str_replace(_XE_PATH_, '', $query['called_file']) . PHP_EOL . $query['called_method'] . '()' . PHP_EOL . $query['query_id'], $query['query']);
}
$firephp->fb(array('DB Queries >>> ' . count($GLOBALS['__db_queries__']) . ' Queries, ' . sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']), $queries_output), 'TABLE');
}
// dislpay the file and HTML comments
} else {
$buff = array();
// display total execution time and Request/Response info
if (__DEBUG__ & 2) {
if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) {
return;
}
// Request/Response information
$buff[] = "\n- Request/ Response info";
$buff[] = sprintf("\tRequest URI \t\t\t: %s:%s%s%s%s", $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING'] ? '?' : '', $_SERVER['QUERY_STRING']);
$buff[] = sprintf("\tRequest method \t\t\t: %s", $_SERVER['REQUEST_METHOD']);
$buff[] = sprintf("\tResponse method \t\t: %s", Context::getResponseMethod());
$buff[] = sprintf("\tResponse contents size\t: %d byte", $this->content_size);
// total execution time
$buff[] = sprintf("\n- Total elapsed time : %0.5f sec", $end - __StartTime__);
$buff[] = sprintf("\tclass file load elapsed time \t: %0.5f sec", $GLOBALS['__elapsed_class_load__']);
$buff[] = sprintf("\tTemplate compile elapsed time\t: %0.5f sec (%d called)", $GLOBALS['__template_elapsed__'], $GLOBALS['__TemplateHandlerCalled__']);
$buff[] = sprintf("\tXmlParse compile elapsed time\t: %0.5f sec", $GLOBALS['__xmlparse_elapsed__']);
$buff[] = sprintf("\tPHP elapsed time \t\t\t\t: %0.5f sec", $end - __StartTime__ - $GLOBALS['__template_elapsed__'] - $GLOBALS['__xmlparse_elapsed__'] - $GLOBALS['__db_elapsed_time__'] - $GLOBALS['__elapsed_class_load__']);
$buff[] = sprintf("\tDB class elapsed time \t\t\t: %0.5f sec", $GLOBALS['__dbclass_elapsed_time__'] - $GLOBALS['__db_elapsed_time__']);
// widget execution time
$buff[] = sprintf("\tWidgets elapsed time \t\t\t: %0.5f sec", $GLOBALS['__widget_excute_elapsed__']);
// layout execution time
$buff[] = sprintf("\tLayout compile elapsed time \t: %0.5f sec", $GLOBALS['__layout_compile_elapsed__']);
// Widgets, the editor component replacement time
$buff[] = sprintf("\tTrans Content \t\t\t\t\t: %0.5f sec", $GLOBALS['__trans_content_elapsed__']);
}
// DB Logging
if (__DEBUG__ & 4) {
if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) {
return;
}
if ($GLOBALS['__db_queries__']) {
$buff[] = sprintf("\n- DB Queries : %d Queries. %0.5f sec", count($GLOBALS['__db_queries__']), $GLOBALS['__db_elapsed_time__']);
$num = 0;
foreach ($GLOBALS['__db_queries__'] as $query) {
if ($query['result'] == 'Success') {
$query_result = "Query Success";
} else {
$query_result = sprintf("Query {$s} : %d\n\t\t\t %s", $query['result'], $query['errno'], $query['errstr']);
}
$buff[] = sprintf("\t%02d. %s\n\t\t%0.6f sec. %s.", ++$num, $query['query'], $query['elapsed_time'], $query_result);
$buff[] = sprintf("\t\tConnection: %s.", $query['connection']);
$buff[] = sprintf("\t\tQuery ID: %s", $query['query_id']);
$buff[] = sprintf("\t\tCalled: %s. %s()", str_replace(_XE_PATH_, '', $query['called_file']), $query['called_method']);
}
}
}
// Output in HTML comments
if ($buff && __DEBUG_OUTPUT__ == 1 && Context::getResponseMethod() == 'HTML') {
$buff = implode("\r\n", $buff);
$buff = sprintf("[%s %s:%d]\r\n%s", date('Y-m-d H:i:s'), $file_name, $line_num, print_r($buff, true));
if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) {
$buff = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php';
}
return "<!--\r\n" . $buff . "\r\n-->";
}
// Output to a file
if ($buff && __DEBUG_OUTPUT__ == 0) {
$debug_file = _XE_PATH_ . 'files/_debug_message.php';
$buff = implode(PHP_EOL, $buff);
$buff = sprintf("[%s]\n%s", date('Y-m-d H:i:s'), print_r($buff, true));
$buff = str_repeat('=', 80) . "\n" . $buff . "\n" . str_repeat('-', 80);
$buff = "\n<?php\n/*" . $buff . "*/\n?>\n";
//.........这里部分代码省略.........
示例11: _debugOutput
/**
* @brief 디버그 모드일 경우 디버깅 메시지 출력
*
* __DEBUG__ 값이 1 이상이면 __DEBUG_OUTPUT__ 값에 따라 메시지 출력.
* __DEBUG__를 세팅하고, __DEBUG_OUTPUT__ == 0 이면
* tail -f ./files/_debug_message.php로 하여 console로 확인하면 편리함
**/
function _debugOutput()
{
if (!__DEBUG__) {
return;
}
$end = getMicroTime();
// Firebug 콘솔 출력
if (__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '5.2.0', '>=')) {
static $firephp;
if (!isset($firephp)) {
$firephp = FirePHP::getInstance(true);
}
if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) {
$firephp->fb('Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php', 'The IP address is not allowed.');
return;
}
// 전체 실행 시간 출력, Request/Response info 출력
if (__DEBUG__ & 2) {
$firephp->fb(array('Request / Response info >>> ' . $_SERVER['REQUEST_METHOD'] . ' / ' . Context::getResponseMethod(), array(array('Request URI', 'Request method', 'Response method', 'Response contents size'), array(sprintf("%s:%s%s%s%s", $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING'] ? '?' : '', $_SERVER['QUERY_STRING']), $_SERVER['REQUEST_METHOD'], Context::getResponseMethod(), $this->content_size . ' byte'))), 'TABLE');
$firephp->fb(array('Elapsed time >>> Total : ' . sprintf('%0.5f sec', $end - __StartTime__), array(array('DB queries', 'class file load', 'Template compile', 'XmlParse compile', 'PHP', 'Widgets', 'Trans Content'), array(sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']), sprintf('%0.5f sec', $GLOBALS['__elapsed_class_load__']), sprintf('%0.5f sec (%d called)', $GLOBALS['__template_elapsed__'], $GLOBALS['__TemplateHandlerCalled__']), sprintf('%0.5f sec', $GLOBALS['__xmlparse_elapsed__']), sprintf('%0.5f sec', $end - __StartTime__ - $GLOBALS['__template_elapsed__'] - $GLOBALS['__xmlparse_elapsed__'] - $GLOBALS['__db_elapsed_time__'] - $GLOBALS['__elapsed_class_load__']), sprintf('%0.5f sec', $GLOBALS['__widget_excute_elapsed__']), sprintf('%0.5f sec', $GLOBALS['__trans_content_elapsed__'])))), 'TABLE');
}
// DB 쿼리 내역 출력
if (__DEBUG__ & 4 && $GLOBALS['__db_queries__']) {
$queries_output = array(array('Query', 'Elapsed time', 'Result'));
foreach ($GLOBALS['__db_queries__'] as $query) {
array_push($queries_output, array($query['query'], sprintf('%0.5f', $query['elapsed_time']), $query['result']));
}
$firephp->fb(array('DB Queries >>> ' . count($GLOBALS['__db_queries__']) . ' Queries, ' . sprintf('%0.5f sec', $GLOBALS['__db_elapsed_time__']), $queries_output), 'TABLE');
}
// 파일 및 HTML 주석으로 출력
} else {
// 전체 실행 시간 출력, Request/Response info 출력
if (__DEBUG__ & 2) {
// 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->content_size);
// 전체 실행 시간
$buff .= sprintf("\n- Total elapsed time : %0.5f sec\n", $end - __StartTime__);
$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 (%d called)\n", $GLOBALS['__template_elapsed__'], $GLOBALS['__TemplateHandlerCalled__']);
$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\tWidgets elapsed time \t\t: %0.5f sec", $GLOBALS['__widget_excute_elapsed__']);
// 레이아웃 실행 시간
$buff .= sprintf("\n\tLayout compile elapsed time \t: %0.5f sec", $GLOBALS['__layout_compile_elapsed__']);
// 위젯, 에디터 컴포넌트 치환 시간
$buff .= sprintf("\n\tTrans Content \t\t\t: %0.5f sec\n", $GLOBALS['__trans_content_elapsed__']);
}
// DB 로그 작성
if (__DEBUG__ & 4) {
if ($GLOBALS['__db_queries__']) {
$buff .= sprintf("\n- DB Queries : %d Queries. %0.5f sec\n", count($GLOBALS['__db_queries__']), $GLOBALS['__db_elapsed_time__']);
$num = 0;
foreach ($GLOBALS['__db_queries__'] as $query) {
$buff .= sprintf("\t%02d. %s\n\t\t%0.6f sec. ", ++$num, $query['query'], $query['elapsed_time']);
if ($query['result'] == 'Success') {
$buff .= "Query Success\n";
} else {
$buff .= sprintf("Query {$s} : %d\n\t\t\t %s\n", $query['result'], $query['errno'], $query['errstr']);
}
}
}
}
// HTML 주석으로 출력
if (__DEBUG_OUTPUT__ == 1 && Context::getResponseMethod() == 'HTML') {
$buff = sprintf("[%s %s:%d]\n%s\n", date('Y-m-d H:i:s'), $file_name, $line_num, print_r($buff, true));
if (__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) {
$buff = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php';
}
return "<!--\r\n" . $buff . "\r\n-->";
}
// 파일에 출력
if (__DEBUG_OUTPUT__ == 0) {
$debug_file = _XE_PATH_ . 'files/_debug_message.php';
$buff = sprintf("[%s %s:%d]\n%s\n", date('Y-m-d H:i:s'), $file_name, $line_num, print_r($buff, true));
$buff = str_repeat('=', 40) . "\n" . $buff . str_repeat('-', 40);
$buff = "\n<?php\n/*" . $buff . "*/\n?>\n";
if (@(!($fp = fopen($debug_file, 'a')))) {
return;
}
fwrite($fp, $buff);
fclose($fp);
}
}
}
示例12: getMicroTime
/**
* It creates a module instance
* @param string $module module name
* @param string $type instance type, (e.g., view, controller, model)
* @param string $kind admin or svc
* @return ModuleObject module instance (if failed it returns null)
* @remarks if there exists a module instance created before, returns it.
* */
function &getModuleInstance($module, $type = 'view', $kind = '')
{
if (__DEBUG__ == 3) {
$start_time = getMicroTime();
}
$parent_module = $module;
$kind = strtolower($kind);
$type = strtolower($type);
$kinds = array('svc' => 1, 'admin' => 1);
if (!isset($kinds[$kind])) {
$kind = 'svc';
}
$key = $module . '.' . ($kind != 'admin' ? '' : 'admin') . '.' . $type;
if (is_array($GLOBALS['__MODULE_EXTEND__']) && array_key_exists($key, $GLOBALS['__MODULE_EXTEND__'])) {
$module = $extend_module = $GLOBALS['__MODULE_EXTEND__'][$key];
}
// if there is no instance of the module in global variable, create a new one
if (!isset($GLOBALS['_loaded_module'][$module][$type][$kind])) {
ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
if ($extend_module && (!is_readable($high_class_file) || !is_readable($class_file))) {
$module = $parent_module;
ModuleHandler::_getModuleFilePath($module, $type, $kind, $class_path, $high_class_file, $class_file, $instance_name);
}
// Check if the base class and instance class exist
if (!class_exists($module, true)) {
return NULL;
}
if (!class_exists($instance_name, true)) {
return NULL;
}
// Create an instance
$oModule = new $instance_name();
if (!is_object($oModule)) {
return NULL;
}
// Load language files for the class
Context::loadLang($class_path . 'lang');
if ($extend_module) {
Context::loadLang(ModuleHandler::getModulePath($parent_module) . 'lang');
}
// Set variables to the instance
$oModule->setModule($module);
$oModule->setModulePath($class_path);
// If the module has a constructor, run it.
if (!isset($GLOBALS['_called_constructor'][$instance_name])) {
$GLOBALS['_called_constructor'][$instance_name] = TRUE;
if (@method_exists($oModule, $instance_name)) {
$oModule->{$instance_name}();
}
}
// Store the created instance into GLOBALS variable
$GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule;
}
if (__DEBUG__ == 3) {
$GLOBALS['__elapsed_class_load__'] += getMicroTime() - $start_time;
}
// return the instance
return $GLOBALS['_loaded_module'][$module][$type][$kind];
}
示例13: ini_set
<?php
ini_set('include_path', ini_get('include_path') . ':../:');
require_once "design.inc.php";
$title = "Probe overview";
doHeader($title, array('calender' => TRUE));
echo "<h1>{$title}</h1>";
require_once "functions.inc.php";
#$displayTiming = TRUE;
$starttime = getMicroTime();
db_connect();
$probes = probes_info_query();
echo "\n<h4>Please select a probe:</h4>\n";
probes_info_form_tabel($probes, $probeid);
# Trick incl the graph php script
#include("../include/graph_probe_drops_bar01.php");
include "../include/graph_probe_drops_bar02.php";
include "../staging/pie01.php";
db_disconnect();
doFooter();
displayTimingInfo($starttime, getMicroTime(), $displayTiming, "php done");
示例14: getMicroTime
/**
* @brief 모듈 객체를 생성함
**/
function &getModuleInstance($module, $type = 'view', $kind = '')
{
$class_path = ModuleHandler::getModulePath($module);
if (!is_dir(_XE_PATH_ . $class_path)) {
return NULL;
}
if (__DEBUG__ == 3) {
$start_time = getMicroTime();
}
if ($kind != 'admin') {
$kind = 'svc';
}
// global 변수에 미리 생성해 둔 객체가 없으면 새로 생성
if (!$GLOBALS['_loaded_module'][$module][$type][$kind]) {
/**
* 모듈의 위치를 파악
**/
// 상위 클래스명 구함
if (!class_exists($module)) {
$high_class_file = sprintf('%s%s%s.class.php', _XE_PATH_, $class_path, $module);
if (!file_exists($high_class_file)) {
return NULL;
}
require_once $high_class_file;
}
// 객체의 이름을 구함
switch ($type) {
case 'controller':
if ($kind == 'admin') {
$instance_name = sprintf("%sAdmin%s", $module, "Controller");
$class_file = sprintf('%s%s%s.admin.%s.php', _XE_PATH_, $class_path, $module, $type);
} else {
$instance_name = sprintf("%s%s", $module, "Controller");
$class_file = sprintf('%s%s%s.%s.php', _XE_PATH_, $class_path, $module, $type);
}
break;
case 'model':
if ($kind == 'admin') {
$instance_name = sprintf("%sAdmin%s", $module, "Model");
$class_file = sprintf('%s%s%s.admin.%s.php', _XE_PATH_, $class_path, $module, $type);
} else {
$instance_name = sprintf("%s%s", $module, "Model");
$class_file = sprintf('%s%s%s.%s.php', _XE_PATH_, $class_path, $module, $type);
}
break;
case 'api':
$instance_name = sprintf("%s%s", $module, "API");
$class_file = sprintf('%s%s%s.api.php', _XE_PATH_, $class_path, $module);
break;
case 'wap':
$instance_name = sprintf("%s%s", $module, "WAP");
$class_file = sprintf('%s%s%s.wap.php', _XE_PATH_, $class_path, $module);
break;
case 'smartphone':
$instance_name = sprintf("%s%s", $module, "SPhone");
$class_file = sprintf('%s%s%s.smartphone.php', _XE_PATH_, $class_path, $module);
break;
case 'class':
$instance_name = $module;
$class_file = sprintf('%s%s%s.class.php', _XE_PATH_, $class_path, $module);
break;
default:
$type = 'view';
if ($kind == 'admin') {
$instance_name = sprintf("%sAdmin%s", $module, "View");
$class_file = sprintf('%s%s%s.admin.view.php', _XE_PATH_, $class_path, $module, $type);
} else {
$instance_name = sprintf("%s%s", $module, "View");
$class_file = sprintf('%s%s%s.view.php', _XE_PATH_, $class_path, $module, $type);
}
break;
}
// 클래스 파일의 이름을 구함
if (!file_exists($class_file)) {
return NULL;
}
// eval로 객체 생성
require_once $class_file;
$eval_str = sprintf('$oModule = new %s();', $instance_name);
@eval($eval_str);
if (!is_object($oModule)) {
return NULL;
}
// 해당 위치에 속한 lang 파일을 읽음
Context::loadLang($class_path . 'lang');
// 생성된 객체에 자신이 호출된 위치를 세팅해줌
$oModule->setModule($module);
$oModule->setModulePath($class_path);
// 요청된 module에 constructor가 있으면 실행
if (!isset($GLOBALS['_called_constructor'][$instance_name])) {
$GLOBALS['_called_constructor'][$instance_name] = true;
if (@method_exists($oModule, $instance_name)) {
$oModule->{$instance_name}();
}
}
// GLOBALS 변수에 생성된 객체 저장
$GLOBALS['_loaded_module'][$module][$type][$kind] = $oModule;
//.........这里部分代码省略.........
示例15: requestTime
/**
* Get the total execution time until this point
*
* @access public
* @return float elapsed time in seconds since script start.
* @static
*/
function requestTime()
{
$start = DebugKitDebugger::requestStartTime();
$now = getMicroTime();
return $now - $start;
}