Browse files

MDL-38161 Upgrade xhprof to 02-2013 commits

Note this continues being version 0.9.2 and
only a few changes have landed since 3y ago.
(the important stuff is in the xhprof extension,
not in this UI package using it)
  • Loading branch information...
1 parent 1dd6835 commit 6919693cd60ff3b12d6e09df274803fee98eee05 @stronk7 stronk7 committed Feb 22, 2013
View
8 lib/xhprof/readme_moodle.txt
@@ -1,17 +1,19 @@
Description of XHProf 0.9.2 library/viewer import into Moodle
-Removed:
+Removed (commit #1):
+ * .arcconfig - Definitions for arcanist/phabricator removed completely
+ * composer.json - Composer's definition removed completely
* examples - examples dir removed completely
* extension - extension dir removed completely
* package.xml - PECL package definition removed completely
* xhprof_html/docs - documentation dir removed completely
-Added:
+Added (commit #2 - always taken from current moodle.git master):
* index.html - prevent directory browsing on misconfigured servers
* xhprof_moodle.php - containing all the stuff needed to run the xhprof profiler within Moodle
* readme_moodle.txt - this file ;-)
-Our changes: Look for "moodle" in code
+Our changes: Look for "moodle" in code (commit #3 - always mimic from current moodle.git master):
* xhprof_html/index.php ----|
* xhprof_html/callgraph.php -|=> Changed to use own DB iXHProfRuns implementation (moodle_xhprofrun)
* xhprof_html/typeahead.php -|
View
11 lib/xhprof/xhprof_html/callgraph.php
@@ -29,12 +29,12 @@
* @author Changhao Jiang (cjiang@facebook.com)
*/
-// start moodle modification: moodleize this script
+// Start moodle modification: moodleize this script.
require_once(dirname(dirname(dirname(dirname(__FILE__)))).'/config.php');
require_once($CFG->libdir . '/xhprof/xhprof_moodle.php');
require_login();
require_capability('moodle/site:config', context_system::instance());
-// end moodle modification
+// End moodle modification.
// by default assume that xhprof_html & xhprof_lib directories
// are at the same level.
@@ -85,11 +85,10 @@
$type = $params['type'][1]; // default image type.
}
-// start moodle modification: use own XHProfRuns implementation
-//$xhprof_runs_impl = new XHProfRuns_Default();
-require_once($GLOBALS['XHPROF_LIB_ROOT'].'/../xhprof_moodle.php');
+// Start moodle modification: use own XHProfRuns implementation.
+// $xhprof_runs_impl = new XHProfRuns_Default();
$xhprof_runs_impl = new moodle_xhprofrun();
-// end moodle modification
+// End moodle modification.
if (!empty($run)) {
// single run call graph image generation
View
8 lib/xhprof/xhprof_html/css/xhprof.css
@@ -13,13 +13,11 @@
* limitations under the License.
*/
-/* start moodle modification: add basic, smaller, font specs */
+/* Start moodle modification: add basic, smaller, font specs */
body, p, table, li {
- font: normal normal normal 13px/1.231 arial, helvetica, clean, sans-serif;
+ font: normal normal normal 13px/1.231 arial, helvetica, clean, sans-serif;
}
-
-/* end moodle modification */
-
+/* End moodle modification */
td.sorted {
color:#0000FF;
View
10 lib/xhprof/xhprof_html/index.php
@@ -31,12 +31,12 @@
// Changhao Jiang
//
-// start moodle modification: moodleize this script
+// Start moodle modification: moodleize this script.
require_once(dirname(dirname(dirname(dirname(__FILE__)))).'/config.php');
require_once($CFG->libdir . '/xhprof/xhprof_moodle.php');
require_login();
require_capability('moodle/site:config', context_system::instance());
-// end moodle modification
+// End moodle modification.
// by default assume that xhprof_html & xhprof_lib directories
// are at the same level.
@@ -87,10 +87,10 @@
$vrbar = ' class="vrbar"';
$vgbar = ' class="vgbar"';
-// start moodle modification: use own XHProfRuns implementation
-//$xhprof_runs_impl = new XHProfRuns_Default()
+// Start moodle modification: use own XHProfRuns implementation.
+// $xhprof_runs_impl = new XHProfRuns_Default();
$xhprof_runs_impl = new moodle_xhprofrun();
-// end moodle modification
+// End moodle modification.
displayXHProfReport($xhprof_runs_impl, $params, $source, $run, $wts,
$symbol, $sort, $run1, $run2);
View
BIN lib/xhprof/xhprof_html/jquery/indicator.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
11 lib/xhprof/xhprof_html/typeahead.php
@@ -21,23 +21,22 @@
* Changhao Jiang
*/
-// start moodle modification: moodleize this script
+// Start moodle modification: moodleize this script.
require_once(dirname(dirname(dirname(dirname(__FILE__)))).'/config.php');
require_once($CFG->libdir . '/xhprof/xhprof_moodle.php');
require_login();
require_capability('moodle/site:config', context_system::instance());
-// end moodle modification
+// End moodle modification.
// by default assume that xhprof_html & xhprof_lib directories
// are at the same level.
$GLOBALS['XHPROF_LIB_ROOT'] = dirname(__FILE__) . '/../xhprof_lib';
require_once $GLOBALS['XHPROF_LIB_ROOT'].'/display/xhprof.php';
-// start moodle modification: use own XHProfRuns implementation
-//$xhprof_runs_impl = new XHProfRuns_Default();
-require_once($GLOBALS['XHPROF_LIB_ROOT'].'/../xhprof_moodle.php');
+// Start moodle modification: use own XHProfRuns implementation.
+// $xhprof_runs_impl = new XHProfRuns_Default();
$xhprof_runs_impl = new moodle_xhprofrun();
-// end moodle modification
+// End moodle modification.
require_once $GLOBALS['XHPROF_LIB_ROOT'].'/display/typeahead_common.php';
View
10 lib/xhprof/xhprof_lib/utils/callgraph_utils.php
@@ -25,6 +25,7 @@
"jpg" => 1,
"gif" => 1,
"png" => 1,
+ "svg" => 1, // support scalable vector graphic
"ps" => 1,
);
@@ -68,6 +69,9 @@ function xhprof_generate_mime_header($type, $length) {
case 'png':
$mime = 'image/png';
break;
+ case 'svg':
+ $mime = 'image/svg+xml'; // content type for scalable vector graphic
+ break;
case 'ps':
$mime = 'application/postscript';
default:
@@ -103,11 +107,11 @@ function xhprof_generate_image_by_dot($dot_script, $type) {
2 => array("pipe", "w")
);
- // start moodle modification: use $CFG->pathtodot for executing this
- //$cmd = " dot -T".$type;
+ // Start moodle modification: use $CFG->pathtodot for executing this.
+ // $cmd = " dot -T".$type;
global $CFG;
$cmd = (!empty($CFG->pathtodot) ? $CFG->pathtodot : 'dot') . ' -T' . $type;
- // end moodle modification
+ // End moodle modification.
$process = proc_open($cmd, $descriptorspec, $pipes, "/tmp", array());
if (is_resource($process)) {
View
4 lib/xhprof/xhprof_lib/utils/xhprof_runs.php
@@ -149,7 +149,9 @@ public function save_run($xhprof_data, $type, $run_id = null) {
function list_runs() {
if (is_dir($this->dir)) {
echo "<hr/>Existing runs:\n<ul>\n";
- foreach (glob("{$this->dir}/*.{$this->suffix}") as $file) {
+ $files = glob("{$this->dir}/*.{$this->suffix}");
+ usort($files, create_function('$a,$b', 'return filemtime($b) - filemtime($a);'));
+ foreach ($files as $file) {
list($run,$source) = explode('.', basename($file));
echo '<li><a href="' . htmlentities($_SERVER['SCRIPT_NAME'])
. '?run=' . htmlentities($run) . '&source='

0 comments on commit 6919693

Please sign in to comment.