You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
921 B
20 lines
921 B
<?php
|
|
/**
|
|
* @package chamilo.profiling
|
|
*/
|
|
/**
|
|
* Init
|
|
*/
|
|
if (extension_loaded('tideways')) {
|
|
$profiler_namespace = 'chamilolms'; // namespace for your application
|
|
$xhprof_data = tideways_disable();
|
|
//$xhprof_runs = new XHProfRuns_Default();
|
|
//$run_id = $xhprof_runs->save_run($xhprof_data, $profiler_namespace);
|
|
$run_id = uniqid();
|
|
file_put_contents(sys_get_temp_dir() . '/' . $run_id . '.' . $profiler_namespace . '.xhprof', serialize($xhprof_data));
|
|
// url to the XHProf UI libraries (change the host name and path)
|
|
$subDir = substr(__DIR__, strlen(trim($_SERVER['DOCUMENT_ROOT'])));
|
|
$profiler_url = sprintf($subDir.'/xhprof_html/index.php?run=%s&source=%s', $run_id, $profiler_namespace);
|
|
$mem = round(memory_get_peak_usage()/1024);
|
|
echo '<a style="z-index:99; position: absolute;" href="'. $profiler_url .'" target="_blank">Profiler output (Memory: '.$mem.'KB)</a>';
|
|
}
|
|
|