• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP xdebug_time_index函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中xdebug_time_index函数的典型用法代码示例。如果您正苦于以下问题:PHP xdebug_time_index函数的具体用法?PHP xdebug_time_index怎么用?PHP xdebug_time_index使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了xdebug_time_index函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: bench

 public function bench(RestServer $rest)
 {
     $rest->getResponse()->appendResponse("It took " . round(xdebug_time_index(), 5) . " seconds\n");
     $rest->getResponse()->appendResponse("Used " . round(xdebug_memory_usage() / 1024, 5) . "Kb of Memory\n");
     $rest->getResponse()->appendResponse("Used at peak " . round(xdebug_peak_memory_usage() / 1024, 5) . "Kb of Memory\n");
     return $rest;
 }
开发者ID:nolazybits,项目名称:restserver,代码行数:7,代码来源:server.php


示例2: getScriptDuration

 public function getScriptDuration()
 {
     if (function_exists('xdebug_time_index')) {
         return sprintf("%0.2f", xdebug_time_index());
     } else {
         return 'n/a';
     }
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:8,代码来源:Data.php


示例3: benchIt

 public static function benchIt()
 {
     if (function_exists('xdebug_time_index')) {
         return xdebug_time_index();
     } else {
         return microtime();
     }
 }
开发者ID:SerdarSanri,项目名称:arx-core,代码行数:8,代码来源:Utils.php


示例4: onApiRespond

 /**
  * @param \Civi\API\Event\RespondEvent $event
  *   API response event.
  */
 public function onApiRespond(\Civi\API\Event\RespondEvent $event)
 {
     $apiRequest = $event->getApiRequest();
     $result = $event->getResponse();
     if (function_exists('xdebug_time_index') && \CRM_Utils_Array::value('debug', $apiRequest['params']) && is_array($result)) {
         $result['xdebug']['peakMemory'] = xdebug_peak_memory_usage();
         $result['xdebug']['memory'] = xdebug_memory_usage();
         $result['xdebug']['timeIndex'] = xdebug_time_index();
         $event->setResponse($result);
     }
 }
开发者ID:kidaa30,项目名称:yes,代码行数:15,代码来源:XDebugSubscriber.php


示例5: assert

 /**
  * Add an assertion to the test
  * 
  * @param string $label
  * @param boolean $status
  * @param string $filename
  * @param int $line
  * @throws \RuntimeException
  * @return \Unitest\Result
  */
 public function assert($label, $status, $filename, $line)
 {
     if (!function_exists('xdebug_time_index')) {
         $message = "Xdebug is required to use Unitest";
         throw new \RuntimeException($message, 500);
     }
     if (false === $status) {
         ++$this->failed;
     }
     $this->assertions[] = new Assert($label, $status, $filename, $line, xdebug_time_index());
     return $this;
 }
开发者ID:franckysolo,项目名称:unitest,代码行数:22,代码来源:Result.php


示例6: xdebugInfo

		/**
 * Weird little script to trigger an xdebug info box.
		 * I use this to test for bottlenecks before I discovered cache grind. I'll leave it in incase I need it for something.
		 *
		 * @param string $msg A message, useful for identifying a break point.
		 */
function xdebugInfo ($msg = false)
{
	if ($init['debug'])
	{
		trigger_error(
				'[xdbInfo] ' . ($msg ? '<span style="color:white;background-color:#D60;">' . $msg . '</span> | ' : null) .
						 '
    Mem: <span style="color:white;background-color:#D60;">' . Round(
								(xdebug_memory_usage() / 1000), 2) . '
    Kb</span>, Time: <span style="color:white;background-color:#D60;">' . str_pad(
								Round(xdebug_time_index(), 4), 6, '0') . 'secs</span>', E_USER_WARNING);
	}
}
开发者ID:radiosilence,项目名称:quickbox,代码行数:19,代码来源:errors.php


示例7: doDefault

 function doDefault()
 {
     /* {{{ 导入过滤模块,并初始化 */
     importModule("Filter.Filter");
     $fl = new Filter();
     /* }}} */
     /* {{{ 过滤测试测试文本 */
     $content = "大家好.有人认识李洪志吗? 学过法轮功的吗?";
     echo "<b>原语句:</b> ", $content, "<br />";
     /* }}} */
     /* {{{ 检测是否含有非法关键字 */
     $show = $fl->isForbidden($content);
     if ($show) {
         echo "<br />含有非法关键字!<br /><br />";
     } else {
         echo "<br />没有有非法关键字!<br /><br />";
     }
     /* }}} */
     /* {{{ 过滤文本 */
     $start = xdebug_time_index();
     $show = $fl->clean($content);
     echo "<b>过滤后的:</b>", $show, "<br />";
     echo "用时: ", xdebug_time_index() - $start, "<br />";
     /* }}} */
     /* {{{ 过滤文本, 指定替换的格式 */
     $start = xdebug_time_index();
     $show = $fl->clean($content, "×");
     echo "<br /><b>指定替换内容过滤:</b> ", $show, "<br />";
     echo "用时: ", xdebug_time_index() - $start, "<br />";
     /* }}} */
     /* {{{ 并手工指定关键字再过滤文本 */
     $start = xdebug_time_index();
     $fl->setKey(array('大家好'));
     $show = $fl->clean($content);
     echo "<br /><b>手工指定关键字过滤:</b> ", $show, "<br />";
     echo "用时: ", xdebug_time_index() - $start, "<br />";
     /* }}} */
     /* {{{ 模糊过滤文本 */
     $start = xdebug_time_index();
     $ff = new Filter();
     $content = "start:李      洪     志-测-试- f-!u-c=k, fuck:end";
     echo "<br /><b>原语句:</b> ", $content, "<br />";
     $show = $ff->fuzzyClean($content, "*", 2);
     //其中2为深度,默认值,值越大清理越干净,误杀越多,消耗资源越多.
     echo "<b>模糊过滤后:</b> ", $show, "<br />";
     echo "用时: ", xdebug_time_index() - $start, "<br />";
     /* }}} */
 }
开发者ID:sanplit,项目名称:huishou,代码行数:48,代码来源:index.php


示例8: test_intersect

}
function test_intersect($list1, $list2)
{
    return count(array_intersect($list1, $list2));
}
function test_order_dicto_while($list, $elem)
{
    $start = 0;
    $end = count($list);
    while ($start < $end) {
        $middle = (int) (($start + $end) / 2);
        if ($list[$middle] == $elem || $list[$start] == $elem) {
            return true;
        }
        if ($elem > $list[$middle]) {
            $start = $middle + 1;
        } else {
            $end = $middle - 1;
        }
    }
    return false;
}
$list1 = file('./list1.txt');
$list2 = file('./list2.txt');
$elem = 9682;
//if (test_order_dicto_while(file('./orderList.txt'), $elem)) echo "find : $elem"; else echo "not found $elem";
if (array_search($elem, file('./orderList.txt'))) {
}
//echo test_foreach($list1, $list2);
printf("duration : %f", xdebug_time_index());
开发者ID:Antoine07,项目名称:Base-Objet,代码行数:30,代码来源:test_time.php


示例9: printCommonFooter

/**
 * Print common footer :
 * 		conf->global->MAIN_HTML_FOOTER
 * 		conf->global->MAIN_GOOGLE_AN_ID
 * 		conf->global->MAIN_SHOW_TUNING_INFO or $_SERVER["MAIN_SHOW_TUNING_INFO"]
 * 		conf->logbuffer
 *
 * @param	string	$zone	'private' (for private pages) or 'public' (for public pages)
 * @return	void
 */
function printCommonFooter($zone = 'private')
{
    global $conf, $hookmanager;
    global $micro_start_time;
    if ($zone == 'private') {
        print "\n" . '<!-- Common footer for private page -->' . "\n";
    } else {
        print "\n" . '<!-- Common footer for public page -->' . "\n";
    }
    if (!empty($conf->global->MAIN_HTML_FOOTER)) {
        print $conf->global->MAIN_HTML_FOOTER . "\n";
    }
    print "\n";
    if (!empty($conf->use_javascript_ajax)) {
        print '<script type="text/javascript" language="javascript">jQuery(document).ready(function() {' . "\n";
        print '<!-- If page_y set, we set scollbar with it -->' . "\n";
        print "page_y=getParameterByName('page_y', 0);";
        print "if (page_y > 0) \$('html, body').scrollTop(page_y);";
        print '<!-- Set handler to add page_y param on some a href links -->' . "\n";
        print 'jQuery(".reposition").click(function() {
    	           var page_y = $(document).scrollTop();
    	           /* alert(page_y); */
    	           this.href=this.href+\'&page_y=\'+page_y;
    	           });' . "\n";
        print '});' . "\n";
        print '</script>' . "\n";
    }
    // Google Analytics (need Google module)
    if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AN_ID)) {
        if (empty($conf->dol_use_jmobile)) {
            print "\n";
            print '<script type="text/javascript">' . "\n";
            print '  var _gaq = _gaq || [];' . "\n";
            print '  _gaq.push([\'_setAccount\', \'' . $conf->global->MAIN_GOOGLE_AN_ID . '\']);' . "\n";
            print '  _gaq.push([\'_trackPageview\']);' . "\n";
            print '' . "\n";
            print '  (function() {' . "\n";
            print '    var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;' . "\n";
            print '    ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';' . "\n";
            print '    var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);' . "\n";
            print '  })();' . "\n";
            print '</script>' . "\n";
        }
    }
    // End of tuning
    if (!empty($_SERVER['MAIN_SHOW_TUNING_INFO']) || !empty($conf->global->MAIN_SHOW_TUNING_INFO)) {
        print "\n" . '<script type="text/javascript">' . "\n";
        print 'window.console && console.log("';
        if (!empty($conf->global->MEMCACHED_SERVER)) {
            print 'MEMCACHED_SERVER=' . $conf->global->MEMCACHED_SERVER . ' - ';
        }
        print 'MAIN_OPTIMIZE_SPEED=' . (isset($conf->global->MAIN_OPTIMIZE_SPEED) ? $conf->global->MAIN_OPTIMIZE_SPEED : 'off');
        if ($micro_start_time) {
            $micro_end_time = microtime(true);
            print ' - Build time: ' . ceil(1000 * ($micro_end_time - $micro_start_time)) . ' ms';
        }
        if (function_exists("memory_get_usage")) {
            print ' - Mem: ' . memory_get_usage();
        }
        if (function_exists("xdebug_memory_usage")) {
            print ' - XDebug time: ' . ceil(1000 * xdebug_time_index()) . ' ms';
            print ' - XDebug mem: ' . xdebug_memory_usage();
            print ' - XDebug mem peak: ' . xdebug_peak_memory_usage();
        }
        if (function_exists("zend_loader_file_encoded")) {
            print ' - Zend encoded file: ' . (zend_loader_file_encoded() ? 'yes' : 'no');
        }
        print '");' . "\n";
        print '</script>' . "\n";
        // Add Xdebug coverage of code
        if (defined('XDEBUGCOVERAGE')) {
            print_r(xdebug_get_code_coverage());
        }
    }
    // If there is some logs in buffer to show
    if (count($conf->logbuffer)) {
        print "\n";
        print "<!-- Start of log output\n";
        //print '<div class="hidden">'."\n";
        foreach ($conf->logbuffer as $logline) {
            print $logline . "<br>\n";
        }
        //print '</div>'."\n";
        print "End of log output -->\n";
    }
    $parameters = array();
    $reshook = $hookmanager->executeHooks('printCommonFooter', $parameters);
    // Note that $action and $object may have been modified by some hooks
}
开发者ID:NoisyBoy86,项目名称:Dolibarr_test,代码行数:99,代码来源:functions.lib.php


示例10: _getTime

 /**
  * Get time using microtime or xdebug
  */
 private function _getTime()
 {
     if ($this->_xdebug) {
         return xdebug_time_index();
     }
     return microtime(false);
 }
开发者ID:Geotex,项目名称:v6,代码行数:10,代码来源:debug.class.php


示例11: ob_start

if (file_exists($settings_file)) {
    include $settings_file;
}
$BaseTemplate->template_path = SKINS_PATH;
Template::Set('MODULE_NAV_INC', $NAVBAR);
Template::Set('MODULE_HEAD_INC', $HTMLHead);
ob_start();
MainController::RunAllActions();
$page_content = ob_get_clean();
$BaseTemplate->Set('title', MainController::$page_title . ' - ' . SITE_NAME);
$BaseTemplate->Set('page_title', MainController::$page_title . ' - ' . SITE_NAME);
if (file_exists(SKINS_PATH . '/layout.tpl')) {
    $BaseTemplate->Set('page_htmlhead', Template::Get('core_htmlhead.tpl', true));
    $BaseTemplate->Set('page_htmlreq', Template::Get('core_htmlreq.tpl', true));
    $BaseTemplate->Set('page_content', $page_content);
    $BaseTemplate->ShowTemplate('layout.tpl');
} else {
    # It's a template sammich!
    $BaseTemplate->ShowTemplate('header.tpl');
    echo $page_content;
    $BaseTemplate->ShowTemplate('footer.tpl');
}
# Force connection close
DB::close();
if (Config::Get('XDEBUG_BENCHMARK')) {
    $run_time = xdebug_time_index();
    $memory_end = xdebug_memory_usage();
    echo 'TOTAL MEMORY: ' . ($memory_end - $memory_start) . '<br />';
    echo 'PEAK: ' . xdebug_peak_memory_usage() . '<br />';
    echo 'RUN TIME: ' . $run_time . '<br />';
}
开发者ID:deanstalker,项目名称:phpVMS,代码行数:31,代码来源:index.php


示例12: showDebugInfo

 /**
  * Display debug info gathered along the execution
  *
  * @return void
  */
 public static function showDebugInfo()
 {
     global $Language;
     echo '<div id="footer_debug_separator"/>';
     echo '<div id="footer_debug">';
     echo '<div class="alert alert-info">
                <h4> Development useful information! </h4>
                The section above will show you some useful information about Tuleap for development purpose.
           </div>';
     echo '<div id="footer_debug_content">';
     $debug_compute_tile = microtime(true) - $GLOBALS['debug_time_start'];
     if (function_exists('xdebug_time_index')) {
         $xdebug_time_index = xdebug_time_index();
     }
     $query_time = 0;
     foreach ($GLOBALS['DBSTORE'] as $d) {
         foreach ($d['trace'] as $trace) {
             $query_time += $trace[2] - $trace[1];
         }
     }
     $purifier = Codendi_HTMLPurifier::instance();
     echo '<span class="debug">' . $Language->getText('include_layout', 'query_count') . ": ";
     echo $GLOBALS['DEBUG_DAO_QUERY_COUNT'] . "</span>";
     $percent = (int) ($GLOBALS['DEBUG_TIME_IN_PRE'] * 100 / $debug_compute_tile);
     $sql_percent = (int) ($query_time * 100 / $debug_compute_tile);
     echo '<table border=1><thead><tr><th></th><th>Page generated in</th></tr></thead><tbody>';
     echo '<tr><td>pre.php</td><td>' . number_format(1000 * $GLOBALS['DEBUG_TIME_IN_PRE'], 0, '.', "'") . ' ms (' . $percent . '%)</td>';
     echo '<tr><td>remaining</td><td>' . number_format(1000 * ($debug_compute_tile - $GLOBALS['DEBUG_TIME_IN_PRE']), 0, '.', "'") . ' ms</td>';
     echo '<tr><td><b>total</td><td><b>' . number_format(1000 * $debug_compute_tile, 0, '.', "'") . ' ms</td>';
     if (function_exists('xdebug_time_index')) {
         echo '<tr><td>xdebug</td><td>' . number_format(1000 * $xdebug_time_index, 0, '.', "'") . ' ms</tr>';
     }
     echo '<tr><td>sql</td><td>' . number_format(1000 * $query_time, 0, '.', "'") . ' ms (' . $sql_percent . '%)</tr>';
     echo '</tbody></table>';
     if (function_exists('xdebug_get_profiler_filename')) {
         if ($file = xdebug_get_profiler_filename()) {
             echo '<div>Profiler info has been written in: ' . $file . '</div>';
         }
     }
     $hook_params = array();
     EventManager::instance()->processEvent('layout_footer_debug', $hook_params);
     //Display the config
     // Uncomment this only if you know what you are doing. This may lead to sensitive information leakage /!\
     //echo '<fieldset><legend id="footer_debug_config" class="'. Toggler::getClassname('footer_debug_config') .'">Config:</legend>';
     //echo '<pre>';
     //Config::dump();
     //echo '</pre>';
     //echo '</fieldset>';
     // Display all queries used to generate the page
     echo '<fieldset><legend id="footer_debug_allqueries" class="' . Toggler::getClassname('footer_debug_allqueries') . '">All queries:</legend>';
     echo '<pre>';
     $queries = array();
     $queries_by_time_taken = array();
     $i = 0;
     foreach ($GLOBALS['QUERIES'] as $sql) {
         $t = 0;
         foreach ($GLOBALS['DBSTORE'][md5($sql)]['trace'] as $trace) {
             $t += $trace[2] - $trace[1];
         }
         $q = array('sql' => $purifier->purify($sql), 'total time' => number_format(1000 * $t, 0, '.', "'") . ' ms');
         $queries[] = $q;
         $queries_by_time_taken[] = array('n°' => $i++, 't' => $t) + $q;
     }
     print_r($queries);
     echo '</pre>';
     echo '</fieldset>';
     // Display all queries used to generate the page ordered by time taken
     usort($queries_by_time_taken, array(__CLASS__, 'sort_queries_by_time_taken'));
     echo '<fieldset><legend id="footer_debug_allqueries_time_taken" class="' . Toggler::getClassname('footer_debug_allqueries_time_taken') . '">All queries by time taken:</legend>';
     echo '<table border="1" style="border-collapse:collapse" cellpadding="2" cellspacing="0">';
     echo '<thead><tr><th>n°</th><th style="white-space:nowrap;">time taken</th><th>sum</th><th>sql</th></tr></thead>';
     $i = 0;
     $sum = 0;
     foreach ($queries_by_time_taken as $q) {
         echo '<tr valign="top" class="' . html_get_alt_row_color($i++) . '">';
         echo '<td>' . $q['n°'] . '</td>';
         echo '<td style="white-space:nowrap;">' . $q['total time'] . '</td>';
         echo '<td style="white-space:nowrap;">' . number_format(1000 * ($sum += $q['t']), 0, '.', "'") . ' ms' . '</td>';
         echo '<td><pre>' . $q['sql'] . '</pre></td>';
         echo '</tr>';
     }
     echo '</table>';
     echo '</fieldset>';
     echo '<fieldset><legend id="footer_debug_queriespaths" class="' . Toggler::getClassname('footer_dubug_queriespaths') . '">Path of all queries:</legend>';
     $max = 0;
     foreach ($GLOBALS['DBSTORE'] as $d) {
         foreach ($d['trace'] as $trace) {
             $time_taken = 1000 * round($trace[2] - $trace[1], 3);
             if ($max < $time_taken) {
                 $max = $time_taken;
             }
         }
     }
     $paths = array();
     $time = $GLOBALS['debug_time_start'];
//.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:tuleap,代码行数:101,代码来源:Layout.class.php


示例13: cConvertMem

        echo 'End usage   : ' . cConvertMem($memNow) . '<br/>';
        echo 'Mem usage   : ' . cConvertMem($memNow - $mem) . '<br/>';
        echo 'Peak mem    : ' . cConvertMem(xdebug_peak_memory_usage()) . '<br/>';
        echo 'Time        : ' . (xdebug_time_index() - $tm) . '<br/>';
        echo 'Query       : ' . $db->getTicker();
        echo '</pre>';
        // Log average page load
        jimport('joomla.filesystem.file');
        $content = JFile::read(COMMUNITY_COM_PATH . DS . 'access.log');
        $params = new JParameter($content);
        $today = strftime('%Y-%m-%d');
        $loadTime = $params->get($today, 0);
        if ($loadTime > 0) {
            $loadTime = ($loadTime + (xdebug_time_index() - $tm)) / 2;
        } else {
            $loadTime = xdebug_time_index() - $tm;
        }
        $params->set($today, $loadTime);
        JFile::write(COMMUNITY_COM_PATH . DS . 'access.log', $params->toString());
    }
    echo getJomSocialPoweredByLink();
    //	 getTriggerCount
    //	$appLib = CAppPlugins::getInstance();
    //	echo 'Trigger count: '. $appLib->triggerCount . '<br/>';
    //	$time_end = microtime(true);
    //	$time = $time_end - $time_start;
    //	echo $time;
}
/**
 * Entry poitn for all ajax call
 */
开发者ID:bizanto,项目名称:Hooked,代码行数:31,代码来源:community.php


示例14: printCommonFooter

/**
 * Print common footer :
 * 		conf->global->MAIN_HTML_FOOTER
 * 		conf->global->MAIN_GOOGLE_AN_ID
 * 		DOL_TUNING
 * 		conf->logbuffer
 *
 * @param	string	$zone	'private' (for private pages) or 'public' (for public pages)
 * @return	void
 */
function printCommonFooter($zone = 'private')
{
    global $conf;
    global $micro_start_time;
    if ($zone == 'private') {
        print "\n" . '<!-- Common footer for private page -->' . "\n";
    } else {
        print "\n" . '<!-- Common footer for public page -->' . "\n";
    }
    if (!empty($conf->global->MAIN_HTML_FOOTER)) {
        print $conf->global->MAIN_HTML_FOOTER . "\n";
    }
    // Google Analytics (need Google module)
    if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AN_ID)) {
        if (empty($conf->dol_use_jmobile)) {
            print "\n";
            print '<script type="text/javascript">' . "\n";
            print '  var _gaq = _gaq || [];' . "\n";
            print '  _gaq.push([\'_setAccount\', \'' . $conf->global->MAIN_GOOGLE_AN_ID . '\']);' . "\n";
            print '  _gaq.push([\'_trackPageview\']);' . "\n";
            print '' . "\n";
            print '  (function() {' . "\n";
            print '    var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;' . "\n";
            print '    ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';' . "\n";
            print '    var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);' . "\n";
            print '  })();' . "\n";
            print '</script>' . "\n";
        }
    }
    // End of tuning
    if (!empty($_SERVER['DOL_TUNING']) || !empty($conf->global->MAIN_SHOW_TUNING_INFO)) {
        print "\n" . '<script type="text/javascript">' . "\n";
        print 'window.console && console.log("';
        if (!empty($conf->global->MEMCACHED_SERVER)) {
            print 'MEMCACHED_SERVER=' . $conf->global->MEMCACHED_SERVER . ' - ';
        }
        print 'MAIN_OPTIMIZE_SPEED=' . (isset($conf->global->MAIN_OPTIMIZE_SPEED) ? $conf->global->MAIN_OPTIMIZE_SPEED : 'off');
        if ($micro_start_time) {
            $micro_end_time = dol_microtime_float(true);
            print ' - Build time: ' . ceil(1000 * ($micro_end_time - $micro_start_time)) . ' ms';
        }
        if (function_exists("memory_get_usage")) {
            print ' - Mem: ' . memory_get_usage();
        }
        if (function_exists("xdebug_memory_usage")) {
            print ' - XDebug time: ' . ceil(1000 * xdebug_time_index()) . ' ms';
            print ' - XDebug mem: ' . xdebug_memory_usage();
            print ' - XDebug mem peak: ' . xdebug_peak_memory_usage();
        }
        if (function_exists("zend_loader_file_encoded")) {
            print ' - Zend encoded file: ' . (zend_loader_file_encoded() ? 'yes' : 'no');
        }
        print '");' . "\n";
        print '</script>' . "\n";
        // Add Xdebug coverage of code
        if (defined('XDEBUGCOVERAGE')) {
            var_dump(xdebug_get_code_coverage());
        }
    }
    // If there is some logs in buffer to show
    if (count($conf->logbuffer)) {
        print "\n";
        print "<!-- Start of log output\n";
        //print '<div class="hidden">'."\n";
        foreach ($conf->logbuffer as $logline) {
            print $logline . "<br>\n";
        }
        //print '</div>'."\n";
        print "End of log output -->\n";
    }
}
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:81,代码来源:functions.lib.php


示例15: xdebug_time_index

<?php

$before = xdebug_time_index();
for ($i = 0; $i < 250000; $i++) {
}
$after = xdebug_time_index();
var_dump($before);
var_dump($after);
var_dump($after - $before >= 0);
开发者ID:badlamer,项目名称:hhvm,代码行数:9,代码来源:time_index.php


示例16: output

 /**
  * Prepare template for render from View
  *
  * @throws \Exception if template path is incorrect
  */
 public function output()
 {
     $template = $this->template;
     $data = $this->data;
     $css = $this->css;
     $js = $this->js;
     $title = $this->title;
     ob_start();
     try {
         if (!file_exists(APP . "Templates/_pages/{$template}.html")) {
             throw new \Exception("The required Template ({$template}) not exist.");
         }
         require APP . 'Templates/_shared/header.html';
         require APP . "Templates/_pages/{$template}.html";
         require APP . 'Templates/_shared/footer.html';
     } catch (\Exception $e) {
         echo 'Template exception: ', $e->getMessage(), "\n";
     }
     //only for debug, return time execution and memory usage
     echo '<!-- Memory: ';
     echo round(xdebug_memory_usage() / 1024, 2), ' (';
     echo round(xdebug_peak_memory_usage() / 1024, 2), ') KByte - Time: ';
     echo xdebug_time_index();
     echo ' Seconds -->';
     ob_end_flush();
 }
开发者ID:s3b4stian,项目名称:app,代码行数:31,代码来源:HtmlTemplate.php


示例17: xdebug_profiler_shutdown_cb

function xdebug_profiler_shutdown_cb()
{
    $is_xmlhttprequest = isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
    if (isset($_REQUEST['XDEBUG_PROFILE'])) {
        $used_memory = xdebug_memory_usage();
        $sizename = array(" Bytes", " KB", " MB", " GB");
        $used_memory = round($used_memory / pow(1024, $i = floor(log($used_memory, 1024))), 2) . $sizename[$i];
        $elapsed_time = round(xdebug_time_index() * 1000, 3);
        $profile = xdebug_get_profiler_filename();
        $profile_id = md5($profile);
        /* Show result box */
        if (!$is_xmlhttprequest) {
            if ($profile === false) {
                $path = ini_get('xdebug.profiler_output_dir');
                if ($path != '') {
                    $reason = is_dir($path) ? 'Directory is not writeable' : (file_exists($path) ? "'{$path}' is not directory" : "'{$path}' does not exist");
                    $output = sprintf('Error: Could not create profile dump in %s<br />(Reason: %s)', $path, $reason);
                } else {
                    $output = 'Error: xdebug.profiler_output_dir is not set';
                }
            } else {
                $output = "\n<b>Page generated in</b> {$elapsed_time} ms <b>Used memory:</b> {$used_memory}\n<b>Profiler dump:</b> <a href='/download.php?file={$profile}'>{$profile}</a>\n";
                if ($_REQUEST['XDEBUG_PROFILE'] == 'long') {
                    $output .= shell_exec("/usr/bin/callgrind_annotate --inclusive=yes --tree=both {$profile}");
                }
            }
            echo <<<DATA
<div style="position: absolute; top: 0; z-index: 5000; border: dashed black 1px; background-color: #fff;" id="xdebug_profile_{$profile_id}">
 <a href="#" style="font-size: 11px;" onclick="javascript: document.getElementById('xdebug_profile_{$profile_id}').style.display = 'none'; return false;">[close]</a>
 <pre style="padding: 5px;">{$output}</pre>
 <a href="#" style="font-size: 11px;" onclick="javascript: document.getElementById('xdebug_profile_{$profile_id}').style.display = 'none'; return false;">[close]</a>
</div>
DATA;
        }
    }
    /* Output box with toggles to enable/disable profiler and annotation */
    if (!$is_xmlhttprequest) {
        $profiler = isset($_REQUEST['XDEBUG_PROFILE']) ? array('enabled' => 1, 'checked' => 'checked="checked"', 'display' => 'inline') : array('enabled' => 0, 'checked' => '', 'display' => 'none');
        $profiler['checked_annotate'] = isset($_REQUEST['XDEBUG_PROFILE']) && $_REQUEST['XDEBUG_PROFILE'] == 'long' ? 'checked="checked"' : '';
        echo <<<DATA
<!-- XDEBUG Dynamic Profiler -->
<script type="text/javascript">
<!--
var xdebug_Profiler = {$profiler['enabled']};
function xdebug_setCookie(value)
{
  if (value == '')
    document.cookie = "XDEBUG_PROFILE=; path=/; expires=Thu, 01-Jan-1970 00:00:01 GMT";
  else
    document.cookie = "XDEBUG_PROFILE=" + value + "; path=/; expires=Fri, 01-Jan-2038 00:00:01 GMT";
}
function xdebug_toggleProfiler(output)
{
  var annotate = document.getElementById('xdebug_profiler_annotate');

  if (xdebug_Profiler) {
    xdebug_setCookie('');
    xdebug_Profiler = 0;
    annotate.style.display = 'none';
  } else {
    xdebug_setCookie(output);
    xdebug_Profiler = 1;
    annotate.style.display = 'inline';
  }
  return xdebug_Profiler;
}
// -->
</script>
<div style="padding: 5px; border: dashed black 1px; background-color: #fff; z-index: 1000; position: absolute; top: 0px; right: 5px; " id="xdebug_profile_enable_cookie">
 <label for="xdebug_toggler" style="vertical-align: top">Toggle Profiler</label>
 <input id="xdebug_toggler" type="checkbox" onclick="this.checked = xdebug_toggleProfiler(this.value);" value="short" {$profiler['checked']} />
 <div id="xdebug_profiler_annotate" style="display: {$profiler['display']}">
  <label for="xdebug_annotate" style="vertical-align: top">Annotate</label>
  <input id="xdebug_annotate" type="checkbox" onclick="xdebug_setCookie((this.checked)?this.value:'short');" value="long" {$profiler['checked_annotate']} />
 </div>
</div>
DATA;
    }
}
开发者ID:bperel,项目名称:xdebug,代码行数:79,代码来源:online_profiling_prepend.php


示例18: llxFooter

 function llxFooter($foot = '')
 {
     global $conf, $langs, $dolibarr_auto_user, $micro_start_time;
     // Core error message
     if (defined("MAIN_CORE_ERROR") && constant("MAIN_CORE_ERROR") == 1) {
         // Ajax version
         if ($conf->use_javascript_ajax) {
             $title = img_warning() . ' ' . $langs->trans('CoreErrorTitle');
             print ajax_dialog($title, $langs->trans('CoreErrorMessage'));
         } else {
             $msg = img_warning() . ' ' . $langs->trans('CoreErrorMessage');
             print '<div class="error">' . $msg . '</div>';
         }
         define("MAIN_CORE_ERROR", 0);
     }
     print "\n\n";
     if (preg_match('/^smartphone/', $conf->smart_menu) && isset($conf->browser->phone)) {
         print '</div> <!-- end div data-role="content" -->' . "\n";
         print '</div> <!-- end div data-role="page" -->' . "\n";
     }
     print '</div> <!-- end div class="fiche" -->' . "\n";
     print "\n" . '</td></tr></table> <!-- end right area -->' . "\n";
     if ($conf->use_javascript_ajax && !empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) {
         print '</div></div> <!-- end main layout -->' . "\n";
     }
     print "\n";
     if ($foot) {
         print '<!-- ' . $foot . ' -->' . "\n";
     }
     if (!empty($conf->global->MAIN_HTML_FOOTER)) {
         print $conf->global->MAIN_HTML_FOOTER . "\n";
     }
     // If there is some logs in buffer to show
     if (sizeof($conf->logbuffer)) {
         print "\n";
         print "<!-- Start of log output\n";
         //print '<div class="hidden">'."\n";
         foreach ($conf->logbuffer as $logline) {
             print $logline . "<br>\n";
         }
         //print '</div>'."\n";
         print "End of log output -->\n";
     }
     // End of tuning
     if (!empty($_SERVER['DOL_TUNING'])) {
         $micro_end_time = dol_microtime_float(true);
         print "\n" . '<script type="text/javascript">console.log("';
         if (!empty($conf->global->MEMCACHED_SERVER)) {
             print 'MEMCACHED_SERVER=' . $conf->global->MEMCACHED_SERVER . ' - ';
         }
         print 'MAIN_OPTIMIZE_SPEED=' . (isset($conf->global->MAIN_OPTIMIZE_SPEED) ? $conf->global->MAIN_OPTIMIZE_SPEED : 'off');
         print ' - Build time: ' . ceil(1000 * ($micro_end_time - $micro_start_time)) . ' ms';
         if (function_exists("memory_get_usage")) {
             print ' - Mem: ' . memory_get_usage();
         }
         if (function_exists("xdebug_memory_usage")) {
             print ' - XDebug time: ' . ceil(1000 * xdebug_time_index()) . ' ms';
             print ' - XDebug mem: ' . xdebug_memory_usage();
             print ' - XDebug mem peak: ' . xdebug_peak_memory_usage();
         }
         if (function_exists("zend_loader_file_encoded")) {
             print ' - Zend encoded file: ' . (zend_loader_file_encoded() ? 'yes' : 'no');
         }
         print '")</script>' . "\n";
         // Add Xdebug coverage of code
         if (defined('XDEBUGCOVERAGE')) {
             var_dump(xdebug_get_code_coverage());
         }
     }
     print "</body>\n";
     print "</html>\n";
 }
开发者ID:netors,项目名称:dolibarr,代码行数:72,代码来源:main.inc.php


示例19: getDetails

    /**
     * Debug output found at the bottom of the site when debug mode is enabled.
     *
     * @static 
     * @return mixed Only returns something if the installer is being used and in that case it returns FALSE
     */
    public static function getDetails()
    {
        if (defined('PHPFOX_INSTALLER')) {
            return false;
        }
        // SQL
        $iSqlCount = 0;
        $fSum = 0.0;
        $fLimit = 0.05 * 128;
        $iSqlMemory = 0;
        $aKeywords = array('SELECT', 'SELECT ', 'FROM', 'FROM ', 'WHERE ', 'UPDATE ', 'OFFSET', ' AS ', 'UNION ALL', 'INNER JOIN ', 'LEFT JOIN ', 'INSERT INTO ', 'SHOW COLUMNS ', 'ON', 'SET', 'USING', 'USE INDEX', 'JOIN ', 'ORDER BY', 'DESC', 'LIMIT', 'DELETE');
        $oRequest = Phpfox_Request::instance();
        $oFile = Phpfox_File::instance();
        $aReplaces = array_map(array('self', '_addKeywordSyntax'), $aKeywords);
        $sDriver = Phpfox::getParam(array('db', 'driver'));
        $sSql = '';
        $bIsCmd = PHP_SAPI == 'cli' || defined('PHPFOX_IS_AJAX') && PHPFOX_IS_AJAX;
        if (!isset(self::$_aDebugHistory['sql'])) {
            self::$_aDebugHistory['sql'] = array();
        }
        // Fresh install, no need to display sql debug
        if ($sDriver == 'DATABASE_DRIVER') {
            self::$_aDebugHistory['sql'] = array();
        }
        foreach (self::$_aDebugHistory['sql'] as $aLine) {
            if (!isset($aLine['sql'])) {
                continue;
            }
            $iSqlCount++;
            $sExtra = Phpfox_Database::instance()->sqlReport($aLine['sql']);
            if ($bIsCmd) {
                $sSql .= "\n ----------------- \n Rows: " . $aLine['rows'] . " Slave: " . ($aLine['slave'] ? 'Yes' : 'No') . " \n " . $aLine['sql'] . " \n\n";
            } else {
                if ($aLine['time'] == '0.0000000') {
                    $aLine['time'] = '0.0000001';
                }
                $sColor = sprintf('%02X', min(255, $fLimit / $aLine['time']));
                $aLine['sql'] = str_replace($aKeywords, $aReplaces, htmlspecialchars($aLine['sql']));
                $sSql .= '<div class="nDebugInfo">
				<span style="background-color: #FF' . $sColor . $sColor . '; color:#000; padding:2px;">' . $aLine['time'] . '</span>
				| <b>Memory Before:</b> ' . $oFile->filesize($aLine['memory_before']) . '
				| <b>Memory After:</b> ' . $oFile->filesize($aLine['memory_after']) . '
				| <b>Memory Used:</b> ' . $oFile->filesize($aLine['memory_after'] - $aLine['memory_before']) . '
				| <b>Rows:</b> ' . $aLine['rows'] . '
				| <b>Slave:</b> ' . ($aLine['slave'] ? 'Yes' : 'No') . '
				</div>';
                $sSql .= '<div class="nDebugItems">' . self::_parseSQL($aLine['sql']) . '' . $sExtra . '</div>';
            }
            $fSum += $aLine['time'];
            $iSqlMemory += $aLine['memory_after'] - $aLine['memory_before'];
        }
        // General Stats
        $iTotalTime = sprintf('%0.7f', array_sum(explode(' ', microtime())) - PHPFOX_TIME_START);
        $iTotalSqlTime = sprintf('%0.7f', $fSum);
        $sDebugReturn = '<div id="js_main_debug_holder">';
        if (!defined('PHPFOX_MEM_END')) {
            define('PHPFOX_MEM_END', memory_get_usage());
        }
        if (PHPFOX_DEBUG_LEVEL === 1) {
            $sDebugReturn .= '<div style="font-size:9pt; text-align:center; padding-bottom:50px;">Page generated in ' . round($iTotalTime, 4) . ' seconds with ' . $iSqlCount . ' queries and GZIP ' . (Phpfox::getParam('core.use_gzip') ? 'enabled' : 'disabled') . ' on ' . $_SERVER['SERVER_ADDR'] . '.</div>';
        } elseif (PHPFOX_DEBUG_LEVEL === 2 || PHPFOX_DEBUG_LEVEL === 3) {
            $bSlaveEnabled = Phpfox::getParam(array('db', 'slave'));
            $aStats = array('Version' => PhpFox::getVersion(), 'Product Code Name' => PhpFox::getCodeName(), '1' => '', 'Total Time' => $iTotalTime, 'PHP General Time' => $iTotalTime - $iTotalSqlTime, 'GZIP' => Phpfox::getParam('core.use_gzip') ? 'enabled' : 'disabled', '2' => '', 'Driver Version' => $sDriver == 'DATABASE_DRIVER'  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP xdiff_string_diff函数代码示例发布时间:2022-05-23
下一篇:
PHP xdebug_stop_trace函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap