Tempo de execução do script em PHP
Publicado por Angelito Monteiro Goulart (última atualização em 06/12/2011)
[ Hits: 15.052 ]
Homepage: http://angelitomg.com
Script que calcula o tempo que a página levou para ser processada.
Deve-se incluir o arquivo exec_time.php no início do script, chamar a função startExec() logo após e no final do script deve-se chamar a função endExec(), responsável por finalizar a medição e exibir o resultado na tela.
<?php /* * * @file: exec_time.php * * @author: Angelito M. Goulart * * @date: 22/11/2011 * * @description: calculates the time of execution of a script * * @use: include this file in the top of the script, call function startExec() and * the end of script call the function endExec(). * * Function endExec print results in the screen. * */ global $time; /* Get current time */ function getTime(){ $microtime = explode(" ", microtime()); $time = $microtime[0] + $microtime[1]; return $time; } /* Calculate start time */ function startExec(){ global $time; $time = getTime(); } /* * Calculate end time of the script, * execution time and print * result in the screen */ function endExec(){ global $time; $finalTime = getTime(); $execTime = $finalTime - $time; echo 'Execution time: ' . number_format($execTime, 6) . ' ms'; } ?>
Gerador de Thumbnail (miniatura)
Como compartilhar a tela do Ubuntu com uma Smart TV (LG, Samsung, etc.)
Descritores de Arquivos e Swappiness
tux-gpt - Assistente de IA para o Terminal
Instalação e configuração do Chrony
Programa IRPF - Guia de Instalação e Resolução de alguns Problemas
Como instalar no Linux Jogos da Steam só para Windows
Instalando o Team Viewer no Debian Trixie - problema no Policykit
O Que Fazer Após Instalar Ubuntu 25.04
O que você está ouvindo agora? [2] (175)
Copiar Layout do Teclado para aplicar em outra Distribuição (10)
Autenticação necessária. um aplicativo quer acesso ao chaveiro (2)