• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP init_metrics函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中init_metrics函数的典型用法代码示例。如果您正苦于以下问题:PHP init_metrics函数的具体用法?PHP init_metrics怎么用?PHP init_metrics使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了init_metrics函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: xhprof_prune_run

function xhprof_prune_run($raw_data, $prune_percent)
{
    $main_info = $raw_data["main()"];
    if (empty($main_info)) {
        xhprof_error("XHProf: main() missing in raw data");
        return false;
    }
    // raw data should contain either wall time or samples information...
    if (isset($main_info["wt"])) {
        $prune_metric = "wt";
    } else {
        if (isset($main_info["samples"])) {
            $prune_metric = "samples";
        } else {
            xhprof_error("XHProf: for main() we must have either wt " . "or samples attribute set");
            return false;
        }
    }
    // determine the metrics present in the raw data..
    $metrics = array();
    foreach ($main_info as $metric => $val) {
        if (isset($val)) {
            $metrics[] = $metric;
        }
    }
    $prune_threshold = $main_info[$prune_metric] * $prune_percent / 100.0;
    init_metrics($raw_data, null, null, false);
    $flat_info = xhprof_compute_inclusive_times($raw_data);
    foreach ($raw_data as $parent_child => $info) {
        list($parent, $child) = xhprof_parse_parent_child($parent_child);
        // is this child's overall total from all parents less than threshold?
        if ($flat_info[$child][$prune_metric] < $prune_threshold) {
            unset($raw_data[$parent_child]);
            // prune the edge
        } else {
            if ($parent && $parent != "__pruned__()" && $flat_info[$parent][$prune_metric] < $prune_threshold) {
                // Parent's overall inclusive metric is less than a threshold.
                // All edges to the parent node will get nuked, and this child will
                // be a dangling child.
                // So instead change its parent to be a special function __pruned__().
                $pruned_edge = xhprof_build_parent_child_key("__pruned__()", $child);
                if (isset($raw_data[$pruned_edge])) {
                    foreach ($metrics as $metric) {
                        $raw_data[$pruned_edge][$metric] += $raw_data[$parent_child][$metric];
                    }
                } else {
                    $raw_data[$pruned_edge] = $raw_data[$parent_child];
                }
                unset($raw_data[$parent_child]);
                // prune the edge
            }
        }
    }
    return $raw_data;
}
开发者ID:gggeek,项目名称:ezperformancelogger,代码行数:55,代码来源:xhprof_lib.php


示例2: profiler_diff_report

/**
 * Generate the profiler report for diff mode (delta between two runs).
 *
 * @author Kannan
 */
function profiler_diff_report($url_params, $xhprof_data1, $run1_desc, $xhprof_data2, $run2_desc, $rep_symbol, $sort, $run1, $run2)
{
    // Initialize what metrics we'll display based on data in Run2
    init_metrics($xhprof_data2, $rep_symbol, $sort, true);
    profiler_report($url_params, $rep_symbol, $sort, $run1, $run1_desc, $xhprof_data1, $run2, $run2_desc, $xhprof_data2);
}
开发者ID:bdlangton,项目名称:xhprof-1,代码行数:11,代码来源:xhprof.php


示例3: render

    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 
    }
开发者ID:sugarcrm,项目名称:xhprof-viewer,代码行数:71,代码来源:RunTemplate.php



注:本文中的init_metrics函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP init_page_items函数代码示例发布时间:2022-05-15
下一篇:
PHP init_language函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap