Last active
December 14, 2019 12:10
-
-
Save daniellockyer/263278b84f680258c5761f16bea900d2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>XDebug Flame Graph</title> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2" /> | |
<style> | |
label {cursor: pointer;} | |
svg{width:100%;} | |
</style> | |
</head> | |
<body> | |
<h1>XDebug Flame Graph</h1> | |
<form method="POST" class="load"> | |
<label for="file">File:</label> | |
<select name="file" id="file"> | |
<?php | |
$dir = ini_get('xdebug.trace_output_dir'); | |
if (!$dir) $dir = '/tmp/'; | |
$files = glob("$dir/*.xt"); | |
foreach ($files as $file) { | |
$checked = ($file == $_REQUEST['file']) ? 'selected="selected"' : ''; | |
echo '<option value="' . htmlspecialchars($file) . '" '.$checked.'>' . htmlspecialchars(basename($file)) . '</option>'; | |
} | |
?> | |
</select> | |
<button type="submit">Load</button> | |
<br/> | |
<p>Files from <code>xdebug.trace_output_dir = <?php echo htmlspecialchars($dir) ?></code></p> | |
</form> | |
<?php | |
if (!empty($_REQUEST['file'])) { | |
$file = $_REQUEST['file']; | |
if (!file_exists($file)) { echo "input file does not exist"; return; } | |
if (!is_readable($file)) { echo "cannot read input file"; return; } | |
passthru(__DIR__.'/FlameGraph/stackcollapse-xdebug.php '.$file.' | '.__DIR__.'/FlameGraph/flamegraph.pl'); | |
} | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I try to check this out, very much appreciated.
I wonder what license this code has?