Page MenuHomePhorge

Update copy of external xhprof library
Open, Needs TriagePublic

Description

Phorge has an external copy of a file called xhprof_lib.php in https://we.phorge.it/source/phorge/browse/master/externals/xhprof/ which has not seen updates since February 2011.

I assume that its upstream was https://github.com/phacility/xhprof/blob/master/xhprof_lib/utils/xhprof_lib.php which saw its last update in February 2015.

Per https://pecl.php.net/package/xhprof , the canonical upstream nowadays seems to be the fork located at https://github.com/longxinH/xhprof/blob/master/xhprof_lib/utils/xhprof_lib.php . https://github.com/longxinH/xhprof/commits/master/xhprof_lib/utils/xhprof_lib.php doesn't list many changes.

Calls seem to take place in three core files (and the functions' signatures are still the same in new upstream):

./src/applications/xhprof/view/PhabricatorXHProfProfileTopLevelView.php: * @phutil-external-symbol function xhprof_compute_flat_info
./src/applications/xhprof/view/PhabricatorXHProfProfileTopLevelView.php:    $flat = xhprof_compute_flat_info($this->profileData, $totals);
./src/applications/xhprof/view/PhabricatorXHProfProfileSymbolView.php: * @phutil-external-symbol function xhprof_compute_flat_info
./src/applications/xhprof/view/PhabricatorXHProfProfileSymbolView.php:    $flat = xhprof_compute_flat_info($data, $totals);
./src/applications/console/plugin/xhprof/DarkConsoleXHProfPluginAPI.php: * @phutil-external-symbol function xhprof_enable
./src/applications/console/plugin/xhprof/DarkConsoleXHProfPluginAPI.php: * @phutil-external-symbol function xhprof_disable
./src/applications/console/plugin/xhprof/DarkConsoleXHProfPluginAPI.php:    require_once $root.'/externals/xhprof/xhprof_lib.php';
./src/applications/console/plugin/xhprof/DarkConsoleXHProfPluginAPI.php:    xhprof_enable();
./src/applications/console/plugin/xhprof/DarkConsoleXHProfPluginAPI.php:    $data = xhprof_disable();

Related documentation can be found in

  • ./src/docs/book/phorge.book
  • ./src/docs/user/field/xhprof.diviner
  • ./src/docs/user/field/performance.diviner

Apart from three lines difference, the version currently copied into Phorge resembles 58f6d12cdea501b96ea26172e363eb3a5aa2433a in https://github.com/longxinH/xhprof/commits/master/xhprof_lib/utils/xhprof_lib.php :

[acko@fedora phorge-tmp-xhprof-upstream ((58f6d12...))]$ diff -pu xhprof_lib/utils/xhprof_lib.php /var/www/html/phorge/phorge/externals/xhprof/xhprof_lib.php 
--- xhprof_lib/utils/xhprof_lib.php	2024-10-21 10:17:22.846280385 +0200
+++ /var/www/html/phorge/phorge/externals/xhprof/xhprof_lib.php	2024-08-23 14:19:53.124306783 +0200
@@ -261,7 +261,7 @@ function xhprof_aggregate_runs($xhprof_r
   $bad_runs = array();
   foreach($runs as $idx => $run_id) {
 
-    $raw_data = $xhprof_runs_impl->get_run($run_id, $source, $description);
+    $raw_data = $xhprof_runs_impl->get_run($run_id, $source, '?');
 
     // use the first run to derive what metrics to aggregate on.
     if ($idx == 0) {
@@ -283,7 +283,7 @@ function xhprof_aggregate_runs($xhprof_r
     }
 
     if ($use_script_name) {
-      $page = $description;
+      $page = '?';
 
       // create a fake function '__script::$page', and have and edge from
       // main() to '__script::$page'. We will also need edges to transfer
@@ -589,7 +589,7 @@ function xhprof_prune_run($raw_data, $pr
 
   $prune_threshold = (($main_info[$prune_metric] * $prune_percent) / 100.0);
 
-  init_metrics($raw_data, null, null, false);
+//  init_metrics($raw_data, null, null, false);
   $flat_info = xhprof_compute_inclusive_times($raw_data);
 
   foreach ($raw_data as $parent_child => $info) {

Revisions and Commits