footer.php 864 B

12345678910111213141516171819202122
  1. <?php
  2. /**
  3. * Comes at the end of every script if loaded from php config
  4. * @package chamilo.profiling
  5. */
  6. /**
  7. * Init
  8. */
  9. if (extension_loaded('xhprof')) {
  10. $profiler_namespace = 'chamilolms'; // namespace for your application
  11. $xhprof_data = xhprof_disable();
  12. $xhprof_runs = new XHProfRuns_Default();
  13. $run_id = $xhprof_runs->save_run($xhprof_data, $profiler_namespace);
  14. // url to the XHProf UI libraries (change the host name and path)
  15. require_once __DIR__.'/../../main/inc/lib/api.lib.php';
  16. $url = api_get_path(WEB_PATH);
  17. $profiler_url = sprintf($url.'tests/xhprof/xhprof_html/index.php?run=%s&source=%s', $run_id, $profiler_namespace);
  18. $xhprof = '<br /><a class="btn btn-primary" href="'. $profiler_url .'" target="_blank">xhprof profiler output</a><br /><br />';
  19. echo $xhprof;
  20. error_log("xhprof runid: $run_id");
  21. }