footer.php 921 B

1234567891011121314151617181920
  1. <?php
  2. /**
  3. * @package chamilo.profiling
  4. */
  5. /**
  6. * Init
  7. */
  8. if (extension_loaded('tideways')) {
  9. $profiler_namespace = 'chamilolms'; // namespace for your application
  10. $xhprof_data = tideways_disable();
  11. //$xhprof_runs = new XHProfRuns_Default();
  12. //$run_id = $xhprof_runs->save_run($xhprof_data, $profiler_namespace);
  13. $run_id = uniqid();
  14. file_put_contents(sys_get_temp_dir() . '/' . $run_id . '.' . $profiler_namespace . '.xhprof', serialize($xhprof_data));
  15. // url to the XHProf UI libraries (change the host name and path)
  16. $subDir = substr(__DIR__, strlen(trim($_SERVER['DOCUMENT_ROOT'])));
  17. $profiler_url = sprintf($subDir.'/xhprof_html/index.php?run=%s&source=%s', $run_id, $profiler_namespace);
  18. $mem = round(memory_get_peak_usage()/1024);
  19. echo '<a style="z-index:99; position: absolute;" href="'. $profiler_url .'" target="_blank">Profiler output (Memory: '.$mem.'KB)</a>';
  20. }