public static function render()
    {
        ?>
        <div class="input-group input-group-sm input-group-symbol">
            <span class="input-group-addon"><span class="glyphicon glyphicon-search"></span></span>
            <table class="input-suggestions">
            </table>
            <input class="form-control input-group-sm" style="width:20vw;" name="search"
                   placeholder="Search Functions Here" autocomplete="off" type="text" list="symbols">

        </div>

        <?php 
        if (CurrentPage::getParam('symbol')) {
            ?>
        <a class="btn btn-primary btn-sm" href="<?php 
            echo CurrentPage::url(array('symbol' => ''));
            ?>
">
            <span class="glyphicon glyphicon-arrow-up" aria-hidden="true"></span>
            View Top Level Run Report
        </a>
        <?php 
        }
    }
Ejemplo n.º 2
0
    public static function render()
    {
        ?>
        <thead>
            <tr>
                <?php 
        foreach (static::getColumns() as $column => $meta) {
            ?>
                    <th <?php 
            if (!empty($meta['percentage'])) {
                ?>
colspan="2"<?php 
            }
            ?>
>
                        <a href="<?php 
            echo CurrentPageHelper::url(array('sort' => $column));
            ?>
">
                            <?php 
            echo stat_description($column);
            ?>
                            <?php 
            if (CurrentPageHelper::getParam('sort') == $column) {
                ?>
                                <i class="fa fa-sort-amount-desc" aria-hidden="true"></i>
                            <?php 
            }
            ?>
                        </a>
                    </th>
                <?php 
        }
        ?>
            </tr>
        </thead>
        <?php 
    }
Ejemplo n.º 3
0
 protected static function thisPageFilterUrl($sortBy)
 {
     $controller = CurrentPage::getCurrentController();
     $dir = $controller->getParam('f_sort_by') == $sortBy ? $controller->getParam('f_sort_dir') == 'desc' ? 'asc' : 'desc' : 'desc';
     return CurrentPage::url(array('f_sort_by' => $sortBy, 'f_sort_dir' => $dir));
 }
Ejemplo n.º 4
0
    public static function render($runData, $params, $xhprofData, $symbol)
    {
        global $totals;
        init_metrics($xhprofData, $symbol);
        // if we are reporting on a specific function, we can trim down
        // the report(s) to just stuff that is relevant to this function.
        // That way compute_flat_info()/compute_diff() etc. do not have
        // to needlessly work hard on churning irrelevant data.
        if (!empty($symbol)) {
            $xhprofData = xhprof_trim_run($xhprofData, array($symbol));
        }
        $symbol_tab = xhprof_compute_flat_info($xhprofData, $totals);
        ?>
<!DOCTYPE HTML><html>
        <?php 
        HtmlHead::render($runData['namespace'] . ' - SugarCRM XHProf Viewer', array('xhprof/css/xhprof.css', 'bower_components/bootstrap/dist/css/bootstrap.min.css', 'bower_components/font-awesome/css/font-awesome.min.css', 'xhprof/css/run-page.css'), array('bower_components/jquery/dist/jquery.min.js', 'bower_components/bootstrap/dist/js/bootstrap.min.js', 'xhprof/js/symbol-typeahead.js'));
        ?>
        <body class="container-fluid">
        <div>
            <div class="page-header form-inline" style="margin-top: 20px;">

                <div class="navbar-form pull-right" style="padding-right:0;">
                    <a class="btn btn-default btn-overall-summary">
                        <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
                        <div><?php 
        static::renderOverallSummary();
        ?>
</div>
                    </a>
                    <a class="btn btn-primary" href="<?php 
        echo $params['list_url'];
        ?>
">
                        <span class="glyphicon glyphicon-arrow-left" aria-hidden="true"></span> Back To List
                    </a>
                </div>
                <h1><p>SugarCRM XHProf Viewer </p><small><?php 
        echo htmlentities($runData['namespace']);
        ?>
</small></h1>
            </div>
        </div>

        <?php 
        if (!$symbol) {
            TopTabsTemplate::render($runData);
        }
        ?>
        <?php 
        profiler_report($params, $symbol, $xhprofData, $symbol_tab);
        ?>

        <script type="text/javascript">
            window.TYPEAHEAD_URL = '<?php 
        echo static::typeAheadUrl();
        ?>
';
            window.SYMBOL_URL = '<?php 
        echo CurrentPageHelper::url();
        ?>
';

            $(function () {
                $('[data-toggle="tooltip"]').tooltip({html: true})
            });
        </script>
        </body>
        </html>

        <?php 
    }
    public static function renderTopButtons()
    {
        ?>
        <form method="get" class="form-inline" style="display:inline-block; margin:0">
            <?php 
        foreach (CurrentPage::getParams() as $key => $value) {
            ?>
                <input type="hidden" name="<?php 
            echo htmlspecialchars($key);
            ?>
" value="<?php 
            echo htmlspecialchars($value);
            ?>
"/>
            <?php 
        }
        ?>

            <div class="input-group input-group-sm">
                <div class="input-group-addon">/</div>
                <input type="text" class="form-control" name="regex_text" style="width: 350px" placeholder="RegEx"
                       value="<?php 
        echo htmlspecialchars(CurrentPage::getParam('regex_text'));
        ?>
">
                <div class="input-group-addon" style="border-left: 0; border-right: 0;">/</div>
                <input type="text" class="form-control" name="regex_mod" style="width: 50px" placeholder=""
                       value="<?php 
        echo htmlspecialchars(CurrentPage::getParam('regex_mod'));
        ?>
">
            </div>

            <div class="btn-group" role="group">
                <a class="btn btn-primary btn-sm <?php 
        echo CurrentPage::getParam('type') == 'all' ? 'active' : '';
        ?>
"
                   href="<?php 
        echo CurrentPage::url(array('type' => 'all'));
        ?>
">All Queries</a>
                <a class="btn btn-primary btn-sm <?php 
        echo CurrentPage::getParam('type') == 'select' ? 'active' : '';
        ?>
"
                   href="<?php 
        echo CurrentPage::url(array('type' => 'select'));
        ?>
">Selects</a>
                <a class="btn btn-primary btn-sm <?php 
        echo CurrentPage::getParam('type') == 'modify' ? 'active' : '';
        ?>
"
                   href="<?php 
        echo CurrentPage::url(array('type' => 'modify'));
        ?>
">Inserts/Updates</a>
                <a class="btn btn-primary btn-sm <?php 
        echo CurrentPage::getParam('type') == 'other' ? 'active' : '';
        ?>
"
                   href="<?php 
        echo CurrentPage::url(array('type' => 'other'));
        ?>
">Others</a>
            </div>

            <div class="btn-group" role="group">
                <a class="btn btn-primary btn-sm <?php 
        echo CurrentPage::getParam('sort_by') == 'time' ? 'active' : '';
        ?>
"
                   href="<?php 
        echo CurrentPage::url(array('sort_by' => 'time'));
        ?>
">Sort by Time</a>
                <a class="btn btn-primary btn-sm <?php 
        echo CurrentPage::getParam('sort_by') == 'hits' ? 'active' : '';
        ?>
"
                   href="<?php 
        echo CurrentPage::url(array('sort_by' => 'hits'));
        ?>
">Sort by Hits</a>
                <a class="btn btn-primary btn-sm <?php 
        echo CurrentPage::getParam('sort_by') == 'exec_order' ? 'active' : '';
        ?>
"
                   data-toggle="tooltip" title="Sort in Execution Order"
                   href="<?php 
        echo CurrentPage::url(array('sort_by' => 'exec_order'));
        ?>
">Exec. Order</a>
            </div>

            <input type="submit" style="display:none;"/>
        </form>

        <?php 
    }
Ejemplo n.º 6
0
/**
 * Print non-hierarchical (flat-view) of profiler data.
 *
 * @author Kannan
 */
function print_flat_data($title, $flat_data, $limit, $callGraphButton)
{
    $size = count($flat_data);
    if (!$limit) {
        $limit = $size;
        $display_link = "";
    } else {
        $display_link = "<a href='" . CurrentPageHelper::url(array('all' => 1)) . "' class='btn btn-sm btn-primary'>Display All</a>";
    }
    print '<div class="panel panel-default panel-functions">';
    print "<div class=\"panel-heading form-inline \"><h3 class=\"panel-title\" style='display:inline-block;'>{$title}</h3> ";
    SymbolSearchInputTemplate::render();
    echo "{$display_link} {$callGraphButton}";
    print "</div>";
    print '<table class="table table-functions table-condensed table-bordered">';
    \Sugarcrm\XHProf\Viewer\Templates\Run\SymbolsTable\HeaderTemplate::prepareColumns(reset($flat_data));
    \Sugarcrm\XHProf\Viewer\Templates\Run\SymbolsTable\HeaderTemplate::render();
    if ($limit >= 0) {
        $limit = min($size, $limit);
        for ($i = 0; $i < $limit; $i++) {
            print_function_info($flat_data[$i]);
        }
    } else {
        // if $limit is negative, print abs($limit) items starting from the end
        $limit = min($size, abs($limit));
        for ($i = 0; $i < $limit; $i++) {
            print_function_info($flat_data[$size - $i - 1]);
        }
    }
    print "</table>";
    // let's print the display all link at the bottom as well...
    if ($display_link) {
        echo '<div class="panel-footer">' . $display_link . '</div>';
    }
    print '</div>';
}