本文整理汇总了PHP中xhprof_get_possible_metrics函数的典型用法代码示例。如果您正苦于以下问题:PHP xhprof_get_possible_metrics函数的具体用法?PHP xhprof_get_possible_metrics怎么用?PHP xhprof_get_possible_metrics使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xhprof_get_possible_metrics函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xhprof_get_metrics
function xhprof_get_metrics($xhprof_data)
{
// get list of valid metrics
$possible_metrics = xhprof_get_possible_metrics();
// return those that are present in the raw data.
// We'll just look at the root of the subtree for this.
$metrics = array();
foreach ($possible_metrics as $metric => $desc) {
if (isset($xhprof_data["main()"][$metric])) {
$metrics[] = $metric;
}
}
return $metrics;
}
示例2: symbol_report
/**
* Generates a report for a single function/symbol.
*
* @author Kannan
*/
function symbol_report($url_params, $run_data, $symbol_info, $sort, $rep_symbol, $run1, $symbol_info1 = null, $run2 = 0, $symbol_info2 = null)
{
global $vwbar;
global $vbar;
global $totals;
global $pc_stats;
global $sortable_columns;
global $metrics;
global $diff_mode;
global $descriptions;
global $format_cbk;
global $sort_col;
global $display_calls;
global $base_path;
$possible_metrics = xhprof_get_possible_metrics();
if ($diff_mode) {
$diff_text = "<b>Diff</b>";
$regr_impr = "<i style='color:red'>Regression</i>/<i style='color:green'>Improvement</i>";
} else {
$diff_text = "";
$regr_impr = "";
}
if ($diff_mode) {
$base_url_params = xhprof_array_unset(xhprof_array_unset($url_params, 'run1'), 'run2');
$href1 = "{$base_path}/index.php?" . http_build_query(xhprof_array_set($base_url_params, 'run', $run1));
$href2 = "{$base_path}/index.php?" . http_build_query(xhprof_array_set($base_url_params, 'run', $run2));
print "<h3 align=center>{$regr_impr} summary for {$rep_symbol}<br><br></h3>";
print '<table border=1 cellpadding=2 cellspacing=1 width="30%" ' . 'rules=rows bordercolor="#bdc7d8" align=center>' . "\n";
print '<tr bgcolor="#bdc7d8" align=right>';
print "<th align=left>{$rep_symbol}</th>";
print "<th {$vwbar}><a href=" . $href1 . ">Run #{$run1}</a></th>";
print "<th {$vwbar}><a href=" . $href2 . ">Run #{$run2}</a></th>";
print "<th {$vwbar}>Diff</th>";
print "<th {$vwbar}>Diff%</th>";
print '</tr>';
print '<tr>';
if ($display_calls) {
print "<td>Number of Function Calls</td>";
print_td_num($symbol_info1["ct"], $format_cbk["ct"]);
print_td_num($symbol_info2["ct"], $format_cbk["ct"]);
print_td_num($symbol_info2["ct"] - $symbol_info1["ct"], $format_cbk["ct"], true);
print_td_pct($symbol_info2["ct"] - $symbol_info1["ct"], $symbol_info1["ct"], true);
print '</tr>';
}
foreach ($metrics as $metric) {
$m = $metric;
// Inclusive stat for metric
print '<tr>';
print "<td>" . str_replace("<br>", " ", $descriptions[$m]) . "</td>";
print_td_num($symbol_info1[$m], $format_cbk[$m]);
print_td_num($symbol_info2[$m], $format_cbk[$m]);
print_td_num($symbol_info2[$m] - $symbol_info1[$m], $format_cbk[$m], true);
print_td_pct($symbol_info2[$m] - $symbol_info1[$m], $symbol_info1[$m], true);
print '</tr>';
// AVG (per call) Inclusive stat for metric
print '<tr>';
print "<td>" . str_replace("<br>", " ", $descriptions[$m]) . " per call </td>";
$avg_info1 = 'N/A';
$avg_info2 = 'N/A';
if ($symbol_info1['ct'] > 0) {
$avg_info1 = $symbol_info1[$m] / $symbol_info1['ct'];
}
if ($symbol_info2['ct'] > 0) {
$avg_info2 = $symbol_info2[$m] / $symbol_info2['ct'];
}
print_td_num($avg_info1, $format_cbk[$m]);
print_td_num($avg_info2, $format_cbk[$m]);
print_td_num($avg_info2 - $avg_info1, $format_cbk[$m], true);
print_td_pct($avg_info2 - $avg_info1, $avg_info1, true);
print '</tr>';
// Exclusive stat for metric
$m = "excl_" . $metric;
print '<tr style="border-bottom: 1px solid black;">';
print "<td>" . str_replace("<br>", " ", $descriptions[$m]) . "</td>";
print_td_num($symbol_info1[$m], $format_cbk[$m]);
print_td_num($symbol_info2[$m], $format_cbk[$m]);
print_td_num($symbol_info2[$m] - $symbol_info1[$m], $format_cbk[$m], true);
print_td_pct($symbol_info2[$m] - $symbol_info1[$m], $symbol_info1[$m], true);
print '</tr>';
}
print '</table>';
}
print "<br><h4><center>";
print "Parent/Child {$regr_impr} report for <b>{$rep_symbol}</b>";
$callgraph_href = "{$base_path}/callgraph.php?" . http_build_query(xhprof_array_set($url_params, 'func', $rep_symbol));
print " <a href='{$callgraph_href}'>[View Callgraph {$diff_text}]</a><br>";
print "</center></h4><br>";
print '<table border=1 cellpadding=2 cellspacing=1 width="90%" ' . 'rules=rows bordercolor="#bdc7d8" align=center>' . "\n";
print '<tr bgcolor="#bdc7d8" align=right>';
foreach ($pc_stats as $stat) {
$desc = stat_description($stat);
if (array_key_exists($stat, $sortable_columns)) {
$href = "{$base_path}/index.php?" . http_build_query(xhprof_array_set($url_params, 'sort', $stat));
$header = xhprof_render_link($desc, $href);
} else {
//.........这里部分代码省略.........
示例3: symbol_report
/**
* Generates a report for a single function/symbol.
*
* @author Kannan
*/
function symbol_report($url_params, $run_data, $symbol_info, $sort, $rep_symbol, $run1, $symbol_info1 = null, $run2 = 0, $symbol_info2 = null)
{
global $vwbar;
global $vbar;
global $totals;
global $pc_stats;
global $sortable_columns;
global $metrics;
global $diff_mode;
global $descriptions;
global $format_cbk;
global $sort_col;
global $display_calls;
global $base_path;
$possible_metrics = xhprof_get_possible_metrics();
if ($diff_mode) {
$diff_text = "<b>Diff</b>";
$regr_impr = "<i style='color:red'>Regression</i>/<i style='color:green'>Improvement</i>";
} else {
$diff_text = "";
$regr_impr = "";
}
if ($diff_mode) {
$base_url_params = xhprof_array_unset(xhprof_array_unset($url_params, 'run1'), 'run2');
$href1 = "{$base_path}?" . http_build_query(xhprof_array_set($base_url_params, 'run', $run1));
$href2 = "{$base_path}?" . http_build_query(xhprof_array_set($base_url_params, 'run', $run2));
print '<div id="diff_page" class="title left hdblock" style="margin-left:20px;" >zPerfmon/Profile Diff</div>';
print '<button id="back_button" style="float:right;width:100px;" type=button >Back</button>';
print '<button id="home_button" style="float:right;width:100px;" type=button >Home</button>';
print '<br /><br /><br />';
print "<div style='font-size:16px' align=center>{$regr_impr} summary for {$rep_symbol}<br><br></div>";
$file1_arr = explode("/", $run1);
$file2_arr = explode("/", $run2);
$time_page1 = $file1_arr[count($file1_arr) - 1];
$time_page2 = $file2_arr[count($file2_arr) - 1];
$game_id1 = $file1_arr[count($file1_arr) - 3];
$game_id2 = $file2_arr[count($file2_arr) - 3];
$game_me1 = explode("_", $game_id1);
$game_me2 = explode("_", $game_id2);
$game1 = $game_me1[0];
$game2 = $game_me2[0];
if (sizeof($game_me1) > 1) {
$array1 = $game_me1[1];
} else {
$array1 = "all";
}
if (sizeof($game_me2) > 1) {
$array2 = $game_me2[1];
} else {
$array2 = "all";
}
if (sizeof($game_me1) > 1) {
if (is_numeric($game_me1[sizeof($game_me1) - 1])) {
for ($i = 1; $i < sizeof($game_me1) - 1; $i++) {
$game1 = $game1 . "_" . $game_me1[$i];
}
$array1 = $game_me1[sizeof($game_me1) - 1];
} else {
for ($i = 1; $i < sizeof($game_me1); $i++) {
$game1 = $game1 . "_" . $game_me1[$i];
}
$array1 = "all";
}
} else {
$array1 = "all";
}
if (sizeof($game_me2) > 1) {
if (is_numeric($game_me2[sizeof($game_me2) - 1])) {
for ($i = 1; $i < sizeof($game_me2) - 1; $i++) {
$game2 = $game2 . "_" . $game_me2[$i];
}
$array2 = $game_me2[sizeof($game_me2) - 1];
} else {
for ($i = 1; $i < sizeof($game_me2); $i++) {
$game2 = $game2 . "_" . $game_me2[$i];
}
$array2 = "all";
}
} else {
$array2 = "all";
}
$timestamp1 = intval($time_page1 . substr(0, 10));
$timestamp2 = intval($time_page2 . substr(0, 10));
$page1 = substr($time_page1, 11, strlen($time_page1) - 18);
$page2 = substr($time_page2, 11, strlen($time_page2) - 18);
print '<table id="summary" class="summary" style="border-color:grey;font-size:16px; border:1px solid ;border-color:grey; margin:30px;">' . "\n";
print '<tr style="background: #D8D8DA url(http://yui.yahooapis.com/2.9.0/build/assets/skins/sam/sprite.png) repeat-x 0 0;text-align:center">';
print "<th align=left>{$rep_symbol}</th>";
print "<th {$vwbar} style ='text-align:center;' >{$page1} <br /> <div id='time1'>{$timestamp1}</div> </th>";
print "<th {$vwbar} style ='text-align:center;' >{$page2} <br /> <div id ='time2'>{$timestamp2}</div> </th>";
print "<th {$vwbar}>Diff</th>";
print "<th {$vwbar}>Diff%</th>";
print '</tr>';
print '<tr>';
if ($display_calls) {
//.........这里部分代码省略.........
示例4: renderOverallSummary
protected static function renderOverallSummary()
{
global $totals;
global $metrics;
global $unitSymbols;
OverallSummaryTemplate::render(xhprof_get_possible_metrics(), $metrics, $totals, $unitSymbols);
}
示例5: init_metrics
/**
* Initialize the metrics we'll display based on the information
* in the raw data.
*
* @author Kannan
*/
function init_metrics($xhprof_data, $rep_symbol)
{
global $metrics;
global $sort_col;
// For C++ profiler runs, walltime attribute isn't present.
// In that case, use "samples" as the default sort column.
if (!isset($xhprof_data["main()"]["wt"])) {
if ($sort_col == "wt") {
$sort_col = "samples";
}
}
// parent/child report doesn't support exclusive times yet.
// So, change sort hyperlinks to closest fit.
if (!empty($rep_symbol)) {
$sort_col = str_replace("excl_", "", $sort_col);
}
$possible_metrics = xhprof_get_possible_metrics();
foreach ($possible_metrics as $metric => $desc) {
if (isset($xhprof_data["main()"][$metric])) {
$metrics[] = $metric;
}
}
}