[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
1 <?php 2 // Copyright (c) 2009 Facebook 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 // 16 17 /** 18 * 19 * A callgraph generator for XHProf. 20 * 21 * * This file is part of the UI/reporting component, 22 * used for viewing results of XHProf runs from a 23 * browser. 24 * 25 * Modification History: 26 * 02/15/2008 - cjiang - The first version of callgraph visualizer 27 * based on Graphviz's DOT tool. 28 * 29 * @author Changhao Jiang ([email protected]) 30 */ 31 32 // Start moodle modification: moodleize this script. 33 require_once(dirname(dirname(dirname(dirname(__FILE__)))).'/config.php'); 34 require_once($CFG->libdir . '/xhprof/xhprof_moodle.php'); 35 require_login(); 36 require_capability('moodle/site:config', context_system::instance()); 37 // End moodle modification. 38 39 // by default assume that xhprof_html & xhprof_lib directories 40 // are at the same level. 41 $GLOBALS['XHPROF_LIB_ROOT'] = dirname(__FILE__) . '/../xhprof_lib'; 42 43 require_once $GLOBALS['XHPROF_LIB_ROOT'].'/display/xhprof.php'; 44 45 ini_set('max_execution_time', 100); 46 47 $params = array(// run id param 48 'run' => array(XHPROF_STRING_PARAM, ''), 49 50 // source/namespace/type of run 51 'source' => array(XHPROF_STRING_PARAM, 'xhprof'), 52 53 // the focus function, if it is set, only directly 54 // parents/children functions of it will be shown. 55 'func' => array(XHPROF_STRING_PARAM, ''), 56 57 // image type, can be 'jpg', 'gif', 'ps', 'png' 58 'type' => array(XHPROF_STRING_PARAM, 'png'), 59 60 // only functions whose exclusive time over the total time 61 // is larger than this threshold will be shown. 62 // default is 0.01. 63 'threshold' => array(XHPROF_FLOAT_PARAM, 0.01), 64 65 // whether to show critical_path 66 'critical' => array(XHPROF_BOOL_PARAM, true), 67 68 // first run in diff mode. 69 'run1' => array(XHPROF_STRING_PARAM, ''), 70 71 // second run in diff mode. 72 'run2' => array(XHPROF_STRING_PARAM, '') 73 ); 74 75 // pull values of these params, and create named globals for each param 76 xhprof_param_init($params); 77 78 // if invalid value specified for threshold, then use the default 79 if ($threshold < 0 || $threshold > 1) { 80 $threshold = $params['threshold'][1]; 81 } 82 83 // if invalid value specified for type, use the default 84 if (!array_key_exists($type, $xhprof_legal_image_types)) { 85 $type = $params['type'][1]; // default image type. 86 } 87 88 // Start moodle modification: use own XHProfRuns implementation. 89 // $xhprof_runs_impl = new XHProfRuns_Default(); 90 $xhprof_runs_impl = new moodle_xhprofrun(); 91 // End moodle modification. 92 93 if (!empty($run)) { 94 // single run call graph image generation 95 xhprof_render_image($xhprof_runs_impl, $run, $type, 96 $threshold, $func, $source, $critical); 97 } else { 98 // diff report call graph image generation 99 xhprof_render_diff_image($xhprof_runs_impl, $run1, $run2, 100 $type, $threshold, $source); 101 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |