Skip to content

Commit

Permalink
no more warnings while writing dot files.
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Dec 30, 2013
1 parent 9e35adb commit ac12615
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions xhprof/classes/callgraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
class callgraph
{
/**
* param array $callstack The callstack must have UIDs.
* param boolean $output TRUE will output the content to the stdout and set the Content-Type to text/plain
* param boolean $debug TRUE will output a less complicated DOT script.
* @param array $callstack The callstack must have UIDs.
* @param boolean $output TRUE will output the content to the stdout and set the Content-Type to text/plain
* @param boolean $debug TRUE will output a less complicated DOT script.
*
* @return resource
*/
public function dot($callstack, $output = FALSE, $debug = FALSE)
{
Expand All @@ -25,15 +27,15 @@ public function dot($callstack, $output = FALSE, $debug = FALSE)
$callee_uid = $e['uid'] . '_' . $e['callee_id'];

if($e['caller']) {
$calls[] = "\t" . $e['uid'] . ' -> ' . $callee_uid . ';';
$calls[] = "\t\"" . $e['uid'] . '" -> "' . $callee_uid . '";';
}

if(isset($players[$callee_uid])) {
throw new CallgraphException('Duplicate player is not possible in an exclusive callstack.');
}

if($debug) {
$players[$callee_uid] = "\t" . $callee_uid . '[shape=square, label="' . $e['callee'] . '"];';
$players[$callee_uid] = "\t\"" . $callee_uid . '"[shape=square, label="' . $e['callee'] . '"];';
} else {
$ct = '';

Expand All @@ -50,7 +52,7 @@ public function dot($callstack, $output = FALSE, $debug = FALSE)
$column_group_color = ' bgcolor="' . $group_colors[$e['group']['index']-1] . '"';
}

$players[$callee_uid] = "\t" . $callee_uid . '[shape=none, label=<
$players[$callee_uid] = "\t\"" . $callee_uid . '"[shape=none, label=<
<table border="0" cellspacing="0" cellborder="1" cellpadding="5">
<tr>
<td colspan="2" align="left"' . $column_group_color . '>' . $e['callee'] . '</td>
Expand Down Expand Up @@ -81,7 +83,8 @@ public function dot($callstack, $output = FALSE, $debug = FALSE)
implode(PHP_EOL, $players) . PHP_EOL . PHP_EOL .
implode(PHP_EOL, $calls);

$dot = "digraph\r{\r{$dot}\r}";
$dot = "digraph\r{\r{$dot}}";


if(!$output) {
return $dot;
Expand Down

0 comments on commit ac12615

Please sign in to comment.