Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
Please try this:
$report = new MyReport();
$start = microtime(true); //get Unix time in seconds
$report->run();
$time_elapsed_secs = microtime(true) - $start;
echo "report running time = $time_elapsed_secs <br>";
$start = microtime(true);
$report->render();
$time_elapsed_secs = microtime(true) - $start;
echo "report rendering time = $time_elapsed_secs <br>";
Hi Keith,
Just set the running time as a property of the report like this:
$start = microtime(true); //get Unix time in seconds
$report->run();
$runningTime = microtime(true) - $start;
$report->runningTime = $runningTime;
$report->render();
Then in the report's view you could use $this->runningTime.
As for rendering time, it might require some trick. First put some place holders like "{runningTime}", "{renderingTime}" in your view, then use this code:
$start = microtime(true); //get Unix time in seconds
$report->run();
$runningTime = microtime(true) - $start;
ob_start();
$start = microtime(true);
$report->render();
$reportContent = ob_get_clearn();
$renderingTime = microtime(true) - $start;
$reportContent = str_replace("{runningTime}", $runningTime, $reportContent):
$reportContent = str_replace("{renderingTime}", $renderingTime, $reportContent):
echo $reportContent;
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo