/** * Render a {@link ProfilerNode} step node and it's children recursively * * @param ProfilerNode $node The node to render * @param int $max_depth the maximum depth of the tree to traverse and render. -1 to traverse entire tree */ public static function renderNode($node, $max_depth = -1) { ?> <tr class="depth_<?php echo $node->getDepth(); ?> <?php echo profiler::isTrivial($node) && !$node->hasNonTrivialChildren() ? 'profiler-trivial' : ''; ?> "> <td class="profiler-step_id"><?php echo str_repeat(' ', $node->getDepth() - 1); echo $node->getName(); ?> </td> <td class="profiler-stat profiler-monospace profiler-step_self_duration"><?php echo $node->getSelfDuration(); ?> </td> <td class="profiler-stat profiler-monospace profiler-step_total_duration"><?php echo $node->getTotalDuration(); ?> </td> <td class="profiler-stat profiler-monospace profiler-start_delay"> <span class="profiler-unit">+</span><?php echo round($node->getStart() - profiler::getGlobalStart(), 1); ?> </td> <td class="profiler-stat profiler-monospace profiler-query_count"> <a href="#" class="profiler-show-queries-button" data-node-id="<?php echo md5($node->getName() . $node->getStart()); ?> "><?php echo $node->getSQLQueryCount() . " sql"; ?> </a> </td> <td class="profiler-stat profiler-monospace profiler-query_time"><?php echo $node->getTotalSQLQueryDuration(); ?> </td> </tr> <?php if ($node->hasChildren() && ($max_depth == -1 || $max_depth > $node->getDepth())) { foreach ($node->getChildren() as $childNode) { self::renderNode($childNode, $max_depth); } } }