MDL-60313 libraries: xhprof upgraded to 0.9.4

This commit is contained in:
Marina Glancy 2017-10-02 18:41:55 +08:00
parent 23ab0d7788
commit ffb41a8f8f
11 changed files with 17 additions and 18 deletions

View file

@ -193,7 +193,7 @@
<location>xhprof</location>
<name>XHProf</name>
<license>Apache</license>
<version>0.9.2</version>
<version>0.9.4</version>
<licenseversion>2.0</licenseversion>
</library>
<library>

View file

@ -1,5 +1,7 @@
Originally developed at Facebook, XHProf was open sourced in Mar, 2009.
XHProf is now maintained by Phacility.
Creators:
Changhao Jiang
Kannan Muthukkaruppan
@ -9,4 +11,3 @@ Creators:
Additional Contributors:
George Cabrera - UI enhancements
Paul Saab - FreeBSD port

View file

@ -1,4 +1,3 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

View file

@ -3,5 +3,3 @@ For installation and usage notes refer to:
To view the latest version of the doc, go to:
http://pecl.php.net/package/xhprof ---> [View Documentation]

View file

@ -1,4 +1,4 @@
Description of XHProf 0.9.2 library/viewer import into Moodle
Description of XHProf 0.9.4 library/viewer import into Moodle
Removed (commit #1):
* .arcconfig - Definitions for arcanist/phabricator removed completely
@ -37,3 +37,4 @@ TODO:
20110318 - MDL-26891 - Eloy Lafuente (stronk7): Implemented earlier profiling runs
20130621 - MDL-39733 - Eloy Lafuente (stronk7): Export & import of profiling runs
20160721 - MDL-55292 - Russell Smith (mr-russ): Add support for tideways profiler collection for PHP7
20171002 - MDL-60313 - Marina Glancy (marinaglancy): Upgrade to 0.9.4 release

View file

@ -85,4 +85,3 @@ ul.xhprof_actions li a:hover {
background:#3B5998 none repeat scroll 0 0;
color:#FFFFFF;
}

View file

@ -77,4 +77,3 @@ if (in_array($q, $functions)) {
foreach ($functions as $f) {
echo $f."\n";
}

View file

@ -42,7 +42,7 @@ require_once $GLOBALS['XHPROF_LIB_ROOT'].'/utils/xhprof_runs.php';
* Our coding convention disallows relative paths in hrefs.
* Get the base URL path from the SCRIPT_NAME.
*/
$base_path = rtrim(dirname($_SERVER['SCRIPT_NAME']), "/");
$base_path = rtrim(dirname($_SERVER['SCRIPT_NAME']), '/\\');
/**
@ -58,7 +58,7 @@ $base_path = rtrim(dirname($_SERVER['SCRIPT_NAME']), "/");
function xhprof_include_js_css($ui_dir_url_path = null) {
if (empty($ui_dir_url_path)) {
$ui_dir_url_path = rtrim(dirname($_SERVER['SCRIPT_NAME']), "/");
$ui_dir_url_path = rtrim(dirname($_SERVER['SCRIPT_NAME']), '/\\');
}
// style sheets
@ -621,7 +621,7 @@ function print_td_num($num, $fmt_func, $bold=false, $attributes=null) {
$class = get_print_class($num, $bold);
if (!empty($fmt_func)) {
if (!empty($fmt_func) && is_numeric($num) ) {
$num = call_user_func($fmt_func, $num);
}
@ -1003,7 +1003,7 @@ function print_pc_array($url_params, $results, $base_ct, $base_info, $parent,
function print_source_link($info) {
if (strncmp($info['fn'], 'run_init', 8) && $info['fn'] !== 'main()') {
if (defined('XHPROF_SYMBOL_LOOKUP_URL')) {
if (defined('XHPROF_SYMBOL_LOOKUP_URL')) {
$link = xhprof_render_link(
'source',
XHPROF_SYMBOL_LOOKUP_URL . '?symbol='.rawurlencode($info["fn"]));

View file

@ -113,7 +113,7 @@ function xhprof_generate_image_by_dot($dot_script, $type) {
$cmd = (!empty($CFG->pathtodot) ? $CFG->pathtodot : 'dot') . ' -T' . $type;
// End moodle modification.
$process = proc_open($cmd, $descriptorspec, $pipes, "/tmp", array());
$process = proc_open( $cmd, $descriptorspec, $pipes, sys_get_temp_dir(), array( 'PATH' => getenv( 'PATH' ) ) );
if (is_resource($process)) {
fwrite($pipes[0], $dot_script);
fclose($pipes[0]);
@ -382,7 +382,7 @@ function xhprof_generate_dot_script($raw_data, $threshold, $source, $page,
$result .= "N" . $sym_table[$parent]["id"] . " -> N"
. $sym_table[$child]["id"];
$result .= "[arrowsize=$arrow_size, style=\"setlinewidth($linewidth)\","
$result .= "[arrowsize=$arrow_size, color=grey, style=\"setlinewidth($linewidth)\","
." label=\""
.$label."\", headlabel=\"".$headlabel
."\", taillabel=\"".$taillabel."\" ]";

View file

@ -98,7 +98,7 @@ function init_metrics($xhprof_data, $rep_symbol, $sort, $diff_report = false) {
$pc_stats = $stats;
$possible_metrics = xhprof_get_possible_metrics($xhprof_data);
$possible_metrics = xhprof_get_possible_metrics();
foreach ($possible_metrics as $metric => $desc) {
if (isset($xhprof_data["main()"][$metric])) {
$metrics[] = $metric;
@ -905,6 +905,10 @@ function xhprof_param_init($params) {
exit();
}
if ($k === 'run') {
$p = implode(',', array_filter(explode(',', $p), 'ctype_xdigit'));
}
// create a global variable using the parameter name.
$GLOBALS[$k] = $p;
}
@ -939,4 +943,3 @@ function xhprof_get_matching_functions($q, $xhprof_data) {
return ($res);
}

View file

@ -95,8 +95,7 @@ class XHProfRuns_Default implements iXHProfRuns {
$dir = ini_get("xhprof.output_dir");
if (empty($dir)) {
// some default that at least works on unix...
$dir = "/tmp";
$dir = sys_get_temp_dir();
xhprof_error("Warning: Must specify directory location for XHProf runs. ".
"Trying {$dir} as default. You can either pass the " .