mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 10:26:40 +02:00
MDL-60313 libraries: xhprof upgraded to 0.9.4
This commit is contained in:
parent
23ab0d7788
commit
ffb41a8f8f
11 changed files with 17 additions and 18 deletions
|
@ -77,4 +77,3 @@ if (in_array($q, $functions)) {
|
|||
foreach ($functions as $f) {
|
||||
echo $f."\n";
|
||||
}
|
||||
|
||||
|
|
|
@ -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"]));
|
||||
|
|
|
@ -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."\" ]";
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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 " .
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue