×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Roman Ignatov
Added: Nov 24, 2016 4:33 PM
Views: 10
  1. <?php
  2.  
  3. if (extension_loaded('xhprof')  && !empty($_GET['xhprof'])) {
  4.     $profiler_namespace = 'myspace';
  5.     $xhprof_data = xhprof_disable();
  6.     $xhprof_runs = new XHProfRuns_Default();
  7.     $run_id = $xhprof_runs->save_run($xhprof_data, $profiler_namespace);
  8.  
  9.     // url to the XHProf UI libraries (change the host name and path)
  10.     $profiler_url = sprintf('http://'.$_SERVER['SERVER_NAME'].'/xhprof/xhprof_html/index.php?run=%s&source=%s', $run_id, $profiler_namespace);
  11.     echo '<a href="'. $profiler_url .'" target="_blank">Profiler output</a>';
  12. }
  13.    
  14.