Skip to content

Instantly share code, notes, and snippets.

@pgampe
Created February 14, 2013 01:15
Show Gist options
  • Save pgampe/4949886 to your computer and use it in GitHub Desktop.
Save pgampe/4949886 to your computer and use it in GitHub Desktop.
diff --git a/Resources/Private/PHP/xhprof-ui/classes/xhprof_ui.php b/Resources/Private/PHP/xhprof-ui/classes/xhprof_ui.php
index 863ed9f..5791a31 100644
--- a/Resources/Private/PHP/xhprof-ui/classes/xhprof_ui.php
+++ b/Resources/Private/PHP/xhprof-ui/classes/xhprof_ui.php
@@ -81,23 +81,23 @@ class XHProf_UI {
if (($data1 = $this->runs[0]->get_data()) && ($data2 = $this->runs[1]->get_data())) {
$this->_setup_metrics($data2);
- return new XHProf_UI\Report\Diff(&$this, $data1, $data2);
+ return new XHProf_UI\Report\Diff($this, $data1, $data2);
}
} elseif (count($this->runs) == 1) {
if ($data = $this->runs[0]->get_data()) {
$this->_setup_metrics($data);
- return new XHProf_UI\Report\Single(&$this, $data);
+ return new XHProf_UI\Report\Single($this, $data);
}
} else {
$wts = strlen($wts) > 0 ? explode(',', $wts) : null;
- if ($data = Compute::aggregate_runs(&$this, $this->runs, $wts)) {
+ if ($data = Compute::aggregate_runs($this, $this->runs, $wts)) {
$this->_setup_metrics($data);
- return new XHProf_UI\Report\Single(&$this, $data);
+ return new XHProf_UI\Report\Single($this, $data);
}
}
}
diff --git a/Resources/Private/PHP/xhprof-ui/classes/xhprof_ui/compute.php b/Resources/Private/PHP/xhprof-ui/classes/xhprof_ui/compute.php
index b938a16..e2871d7 100644
--- a/Resources/Private/PHP/xhprof-ui/classes/xhprof_ui/compute.php
+++ b/Resources/Private/PHP/xhprof-ui/classes/xhprof_ui/compute.php
@@ -10,14 +10,14 @@ class Compute {
* Also, store overall totals in the 2nd argument.
*
* @param array $raw_data XHProf format raw profiler data.
- * @param array &$overall_totals OUT argument for returning
+ * @param array $overall_totals OUT argument for returning
* overall totals for various
* metrics.
* @return array Returns a map from function name to its
* call count and inclusive & exclusive metrics
* (such as wall time, etc.).
*/
- public static function flat_info(\XHProf_UI &$ui, $data) {
+ public static function flat_info(\XHProf_UI $ui, $data) {
$totals = array(
'ct' => 0,
'wt' => 0,
diff --git a/Resources/Private/PHP/xhprof-ui/classes/xhprof_ui/report/diff.php b/Resources/Private/PHP/xhprof-ui/classes/xhprof_ui/report/diff.php
index 9955132..3b092d4 100644
--- a/Resources/Private/PHP/xhprof-ui/classes/xhprof_ui/report/diff.php
+++ b/Resources/Private/PHP/xhprof-ui/classes/xhprof_ui/report/diff.php
@@ -8,7 +8,7 @@ use XHProf_UI\Utils,
class Diff {
- public function __construct(\XHProf_UI &$ui, array $raw_data1, array $raw_data2) {
+ public function __construct(\XHProf_UI $ui, array $raw_data1, array $raw_data2) {
$ui->diff_mode = true;
if (!empty($ui->fn)) {
@@ -18,9 +18,9 @@ class Diff {
$delta = Compute::diff($ui, $raw_data1, $raw_data2);
- $data1 = Compute::flat_info(&$ui, $raw_data1);
- $data2 = Compute::flat_info(&$ui, $raw_data2);
- $data_delta = Compute::flat_info(&$ui, $delta);
+ $data1 = Compute::flat_info($ui, $raw_data1);
+ $data2 = Compute::flat_info($ui, $raw_data2);
+ $data_delta = Compute::flat_info($ui, $delta);
// data tables
diff --git a/Resources/Private/PHP/xhprof-ui/classes/xhprof_ui/report/driver.php b/Resources/Private/PHP/xhprof-ui/classes/xhprof_ui/report/driver.php
index b38ae85..02b3c87 100644
--- a/Resources/Private/PHP/xhprof-ui/classes/xhprof_ui/report/driver.php
+++ b/Resources/Private/PHP/xhprof-ui/classes/xhprof_ui/report/driver.php
@@ -10,9 +10,9 @@ abstract class Driver {
* Analyze raw data & generate the profiler report
* abstract class
*/
- abstract public function __construct();
+ //abstract public function __construct(\XHProf_UI $ui, array $raw_data);
- abstract public function render();
+ //abstract public function render();
protected function _bind($data) {
foreach ($data as $key => $value) {
diff --git a/Resources/Private/PHP/xhprof-ui/classes/xhprof_ui/report/single.php b/Resources/Private/PHP/xhprof-ui/classes/xhprof_ui/report/single.php
index 177b3d1..483ece0 100644
--- a/Resources/Private/PHP/xhprof-ui/classes/xhprof_ui/report/single.php
+++ b/Resources/Private/PHP/xhprof-ui/classes/xhprof_ui/report/single.php
@@ -1,14 +1,12 @@
<?php
namespace XHProf_UI\Report;
-use XHProf_UI\Utils,
- XHProf_UI\Config,
- XHProf_UI\Metrics,
+use XHProf_UI\Utils,
XHProf_UI\Compute;
class Single extends Driver {
- public function __construct(\XHProf_UI &$ui, array $raw_data) {
+ public function __construct(\XHProf_UI $ui, array $raw_data) {
// if we are reporting on a specific function, we can trim down
// the report(s) to just stuff that is relevant to this function.
// That way compute_flat_info()/compute_diff() etc. do not have
@@ -17,7 +15,7 @@ class Single extends Driver {
$raw_data = Compute::trim_run($raw_data, array($ui->fn));
}
- $data = Compute::flat_info(&$ui, $raw_data);
+ $data = Compute::flat_info($ui, $raw_data);
if (!empty($ui->fn) && !isset($data[$ui->fn])) {
throw new \Exception('Function '.$ui->fn.' not found in XHProf run');
diff --git a/Resources/Private/PHP/xhprof-ui/classes/xhprof_ui/utils.php b/Resources/Private/PHP/xhprof-ui/classes/xhprof_ui/utils.php
index ad02240..d31a549 100644
--- a/Resources/Private/PHP/xhprof-ui/classes/xhprof_ui/utils.php
+++ b/Resources/Private/PHP/xhprof-ui/classes/xhprof_ui/utils.php
@@ -93,7 +93,7 @@ class Utils {
echo "</ul>\n";
}
- public static function sort(&$data, $ui) {
+ public static function sort($data, $ui) {
uasort($data, function($a, $b) use ($ui) {
return Utils::sort_cbk($a, $b, $ui);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment