本文整理汇总了PHP中xdebug_stop_trace函数的典型用法代码示例。如果您正苦于以下问题:PHP xdebug_stop_trace函数的具体用法?PHP xdebug_stop_trace怎么用?PHP xdebug_stop_trace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xdebug_stop_trace函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display($tpl = null)
{
xdebug_start_trace(JPATH_COMPONENT . '/views/xdebug/function_trace');
$data = $this->get('Data');
$this->assign('data', $data);
parent::display($tpl);
xdebug_stop_trace();
}
示例2: stop
public function stop()
{
if (static::$file) {
xdebug_stop_trace();
static::$file = null;
}
}
示例3: tearDown
protected function tearDown()
{
if ($this->stopTraceOnTearDown) {
xdebug_stop_trace();
$this->stopTraceOnTearDown = false;
}
}
示例4: traceStop
function traceStop()
{
if (!function_exists('xdebug_is_enabled') || !xdebug_is_enabled()) {
return;
}
xdebug_stop_trace();
}
示例5: stopTrace
public static function stopTrace()
{
if (!extension_loaded('xdebug')) {
throw new \RuntimeException('XDebug must be installed to use this function');
}
\xdebug_stop_trace();
}
示例6: flush
public function flush()
{
xdebug_stop_trace();
echo "\n\n", 'Generating tracing reports from file ', $this->traceFile, ':', "\n";
echo ' Class Diagram ...';
$builder = $this->parse();
$builder->build()->write('build/logs/class_diagram.dot');
echo ' done', "\n";
}
示例7: end_trace
/**
* If an XDebug trace is running, this stops the trace.
*
* @param bool $showAsDebug If true, outputs the trace file as debug information (assuming displayDebug is used)
*
* @return void
*/
public static function end_trace($showAsDebug = false)
{
if (function_exists('xdebug_stop_trace')) {
$file = xdebug_get_tracefile_name();
xdebug_stop_trace();
if ($showAsDebug === true) {
$trace = file_get_contents($file);
self::debug($trace);
}
}
}
示例8: kataSmallProfile
/**
* shutdown function to generate profile report
*/
function kataSmallProfile()
{
xdebug_stop_trace();
$lines = file($GLOBALS['kataSmallProfileFile'] . '.xt');
unlink($GLOBALS['kataSmallProfileFile'] . '.xt');
array_shift($lines);
//version
array_shift($lines);
//trace start
array_pop($lines);
//exit
array_pop($lines);
//trace end
$lastLine = array_pop($lines);
//dummy
$temp = explode("\t", $lines[2]);
$endTime = $temp[3];
$temp = explode("\t", $lastLine);
$totalTime = $temp[3] - $endTime;
unset($temp);
$callStack = array();
$outCnt = array();
$out = array();
foreach ($lines as $line) {
$line = explode("\t", $line);
if (1 == $line[2]) {
$retLine = array_pop($callStack);
if ($retLine[6] == 1) {
//user func
$time = $line[3] - $retLine[3];
$outCnt[$retLine[5]] = (empty($outCnt[$retLine[5]]) ? 0 : $outCnt[$retLine[5]]) + 1;
$out[$retLine[5]] = (empty($out[$retLine[5]]) ? 0 : $out[$retLine[5]]) + $time;
}
continue;
}
if (substr($line[8], 0, strlen(ROOT)) != ROOT) {
continue;
}
if (0 == $line[2]) {
// entry
$callStack[] = $line;
}
}
arsort($out);
$tdCell = '<td style="border:1px solid red;padding:2px;">';
echo '<table style="border:1px solid red;color:black;background-color:#e8e8e8;border-collapse:collapse;">';
echo '<tr>' . $tdCell . 'What</td>' . $tdCell . 'x times</td>' . $tdCell . 'ms total</td></tr>';
foreach ($out as $n => $v) {
echo '<tr>' . $tdCell . '<pre class="c1">' . $n . '</pre></td>' . $tdCell . $outCnt[$n] . '</td>' . $tdCell . $v . ' ms</td></tr>';
}
echo "<tr>{$tdCell} Total (before destroy)</td>{$tdCell}</td>{$tdCell} {$totalTime} ms</td></tr>";
echo '</table>';
}
示例9: stop
static function stop()
{
if (ini_get('xdebug.auto_trace')) {
return;
}
if (!self::$running) {
throw new \BadMethodCallException();
}
xdebug_stop_trace();
foreach (self::$iniRestore as $k => $v) {
ini_set($k, $v);
}
self::$iniRestore = [];
self::$running = false;
}
示例10: _preRender
protected function _preRender()
{
parent::_preRender();
if (Solar_Config::get('Foresmo', 'dev')) {
xdebug_stop_trace();
$trace_file = explode("\n", file_get_contents('/var/www/foresmo/tmp/trace.xt'));
$trace_file_count = count($trace_file);
$trace_dump = array();
$defined_funcs = get_defined_functions();
foreach ($trace_file as $line => $value) {
if ($line == 0 || $line >= $trace_file_count - 4 || strstr($value, 'include(') || strstr($value, 'require(')) {
continue;
}
$tl = explode('-> ', $value);
$tl = explode(' ', $tl[1]);
if (!in_array(str_replace('()', '', $tl[0]), $defined_funcs['internal']) && strstr($tl[0], 'Foresmo') && !in_array($tl[0], $trace_dump)) {
$trace_dump[] = $tl[0];
}
}
$tests = array();
// Lets organize our trace dump calls to that we can easily check/run tests
foreach ($trace_dump as $call) {
if (strstr($call, '->')) {
$class_method = explode('->', $call);
} else {
$class_method = explode('::', $call);
}
if (!isset($tests[$class_method[0]])) {
$tests[$class_method[0]] = array($class_method[1]);
} else {
$tests[$class_method[0]][] = $class_method[1];
}
}
var_dump($trace_dump);
var_dump($tests);
die;
}
}
示例11: log
/**
* Log same time range
*
* @param string $timePoint Time range name
* @param boolean $additional Additional metric flag OPTIONAL
*
* @return void
*/
public function log($timePoint, $additional = false)
{
if (!isset($this->points[$timePoint])) {
$this->points[$timePoint] = array('start' => microtime(true), 'open' => true, 'time' => 0);
if (self::$useXdebugStackTrace) {
xdebug_start_trace(LC_DIR_LOG . $timePoint . '.' . microtime(true), XDEBUG_TRACE_COMPUTERIZED);
}
} elseif ($this->points[$timePoint]['open']) {
$range = microtime(true) - $this->points[$timePoint]['start'];
if ($additional) {
$this->points[$timePoint]['time'] += $range;
} else {
$this->points[$timePoint]['time'] = $range;
}
$this->points[$timePoint]['open'] = false;
if (self::$useXdebugStackTrace) {
@xdebug_stop_trace();
}
} else {
$this->points[$timePoint]['start'] = microtime(true);
$this->points[$timePoint]['open'] = true;
if (self::$useXdebugStackTrace) {
xdebug_start_trace(LC_DIR_VAR . 'log' . LC_DS . $timePoint . '.' . microtime(true), XDEBUG_TRACE_COMPUTERIZED);
}
}
}
示例12: process
function process($tpl, &$textElements, $functionName, $functionChildren, $functionParameters, $functionPlacement, $rootNamespace, $currentNamespace)
{
switch ($functionName) {
case $this->TimingPointName:
$children = $functionChildren;
$parameters = $functionParameters;
$id = false;
if (isset($parameters["id"])) {
$id = $tpl->elementValue($parameters["id"], $rootNamespace, $currentNamespace, $functionPlacement);
}
$startDescription = "debug-timing-point START: {$id}";
eZDebug::addTimingPoint($startDescription);
if (is_array($children)) {
foreach (array_keys($children) as $childKey) {
$child =& $children[$childKey];
$tpl->processNode($child, $textElements, $rootNamespace, $currentNamespace);
}
}
$endDescription = "debug-timing-point END: {$id}";
eZDebug::addTimingPoint($endDescription);
break;
case $this->AccumulatorName:
$children = $functionChildren;
$parameters = $functionParameters;
$id = false;
if (isset($parameters["id"])) {
$id = $tpl->elementValue($parameters["id"], $rootNamespace, $currentNamespace, $functionPlacement);
}
$name = false;
if (isset($parameters["name"])) {
$name = $tpl->elementValue($parameters["name"], $rootNamespace, $currentNamespace, $functionPlacement);
}
// Assign a name (as $functionName) which will be used in the debug output.
$name = ($name === false and $id === false) ? $functionName : $name;
// To uniquely identify this accumulator.
$id = $id === false ? uniqID($functionName . '_') : $id;
eZDebug::accumulatorStart($id, 'Debug-Accumulator', $name);
if (is_array($children)) {
foreach (array_keys($children) as $childKey) {
$child =& $children[$childKey];
$tpl->processNode($child, $textElements, $rootNamespace, $currentNamespace);
}
}
eZDebug::accumulatorStop($id);
break;
case $this->LogName:
$parameters = $functionParameters;
if (isset($parameters['var'])) {
$var = $tpl->elementValue($parameters['var'], $rootNamespace, $currentNamespace, $functionPlacement);
}
if (isset($parameters['msg'])) {
$msg = $tpl->elementValue($parameters['msg'], $rootNamespace, $currentNamespace, $functionPlacement);
}
if (isset($var) && isset($msg)) {
eZDebug::writeDebug($var, $msg);
} elseif (isset($msg)) {
eZDebug::writeDebug($msg);
} elseif (isset($var)) {
eZDebug::writeDebug($var);
}
break;
case $this->TraceName:
$children = $functionChildren;
$id = false;
// If we have XDebug we start the trace, execute children and stop it
// if not we just execute the children as normal
if (extension_loaded('xdebug')) {
$parameters = $functionParameters;
if (isset($parameters["id"])) {
$id = $tpl->elementValue($parameters["id"], $rootNamespace, $currentNamespace, $functionPlacement);
}
if (!$id) {
$id = 'template-debug';
}
// If we already have a file, make sure it is truncated
if (file_exists($id . '.xt')) {
$fd = fopen($id, '.xt', 'w');
fclose($fd);
}
xdebug_start_trace($id);
if (is_array($children)) {
foreach (array_keys($children) as $childKey) {
$child =& $children[$childKey];
$tpl->processNode($child, $textElements, $rootNamespace, $currentNamespace);
}
}
xdebug_stop_trace();
} elseif (is_array($children)) {
foreach (array_keys($children) as $childKey) {
$child =& $children[$childKey];
$tpl->processNode($child, $textElements, $rootNamespace, $currentNamespace);
}
}
break;
}
}
示例13: array
<?php
include_once __DIR__ . '/vendor/autoload.php';
$appConfig = $appConfig = array('modules' => array(), 'module_listener_options' => array('module_paths' => array('./vendor'), 'config_glob_paths' => array('config/autoload/{,*.}{global,local}.php')));
if (!is_dir(__DIR__ . '/trace')) {
mkdir(__DIR__ . '/trace');
}
ini_set('xdebug.show_mem_delta', '1');
for ($t = 0; $t < 5; $t++) {
xdebug_start_trace(sprintf('%s/trace/%d', __DIR__, $t + 1));
$app = \Zend\Mvc\Application::init($appConfig);
xdebug_stop_trace();
\Zend\EventManager\StaticEventManager::resetInstance();
$app = null;
}
示例14: stopXDTrace
/**
* Stop xdebug trace. Call startXDTrace() first.
* @param string $file (default = STDOUT)
*/
public function stopXDTrace($file = 'php://STDOUT')
{
$trace_file = xdebug_get_tracefile_name();
xdebug_stop_trace();
if (!$trace_file || !$file) {
return;
}
$fh = fopen($trace_file, 'r');
fgets($fh);
// ignore first line
$trace_buildin = array('microtime()', 'memory_get_usage()', 'xdebug_call_class()', 'xdebug_call_function()', 'xdebug_call_line()', 'xdebug_call_file()', 'xdebug_stop_trace()');
$trace_func = array('rkphplib\\Profiler->log()');
$buildin_list = array('time', 'in_array', 'is_object', 'is_array', 'is_null', 'array_push', 'join', 'preg_match', 'array_keys', 'array_shift', 'array_pop', 'array_push', 'strpos', 'preg_split', 'count', 'substr', 'mb_substr', 'basename', 'str_replace', 'mysqli->real_escape_string', 'mysqli->mysqli', 'mysqli->real_query', 'mysqli->set_charset', 'mysqli->query', 'mysqli_result->fetch_assoc', 'mysqli_result->close', 'mysqli->prepare', 'mysqli_stmt->bind_param', 'mysqli_stmt->execute', 'mysqli_stmt->close', 'ReflectionClass->__construct', 'ReflectionClass->getMethod', 'ReflectionMethod->invokeArgs');
$buildin = array();
foreach ($buildin_list as $func) {
$buildin[$func . '()'] = 0;
}
$custom = array();
$last = array(0, 0, '', '');
while ($line = fgets($fh)) {
$col = preg_split("/ +/", trim($line));
if (empty($col[4])) {
continue;
}
if (in_array($col[3], $trace_buildin)) {
$last = $col;
continue;
}
if (in_array($col[3], $trace_func)) {
// ToDo ... ignore following
continue;
}
if (isset($buildin[$col[3]])) {
$buildin[$col[3]]++;
} else {
if (!isset($custom[$col[3]])) {
$custom[$col[3]] = array('call' => 0, 'time' => 0, 'mem' => 0);
}
$custom[$col[3]]['call']++;
// ToDo ... collect following
$custom[$col[3]]['time'] = 0;
$custom[$col[3]]['mem'] = 0;
}
$last = $col;
}
fclose($fh);
$fh = fopen($file, 'a');
fwrite($fh, "\nBuildIn Functions:\n");
foreach ($buildin as $func => $call) {
if ($call > 10) {
fprintf($fh, "%10s%50s\n", $call . 'x ', $func);
}
}
fwrite($fh, "\nCustom Functions:\n");
foreach ($custom as $func => $info) {
if ($info['call'] > 0) {
$c = $info['call'];
fprintf($fh, "%10s%50s%16s%16s\n", $c . 'x ', $func, round($info['time'] / $c, 4) . ' s', round($info['mem'] / $c, 0) . ' b');
}
}
fclose($fh);
}
示例15: stopTrace
/**
* Stops trace.
* This is for temporary use when debugging.
* DO NOT CHECK IN A CALL TO THIS FUNCTION.
*/
public static function stopTrace()
{
xdebug_stop_trace();
}