| Line 17... |
Line 17... |
| 17 |
// | |
|
17 |
// | |
|
| 18 |
// | You should have received a copy of the GNU Lesser General Public |
|
18 |
// | You should have received a copy of the GNU Lesser General Public |
|
| 19 |
// | License along with this library; if not, write to the Free Software |
|
19 |
// | License along with this library; if not, write to the Free Software |
|
| 20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
| 21 |
// +------------------------------------------------------------------------------------------------------+
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
| 22 |
// CVS : $Id: BOG_chrono.fonct.php,v 1.1 2004-06-15 10:13:07 jpm Exp $
|
22 |
// CVS : $Id: BOG_chrono.fonct.php,v 1.2 2004-11-29 15:54:16 jpm Exp $
|
| 23 |
/**
|
23 |
/**
|
| 24 |
* Bibliothèque de fonctions permettant de mesure le temps d'execution d'un script.
|
24 |
* Bibliothèque de fonctions permettant de mesure le temps d'execution d'un script.
|
| 25 |
*
|
25 |
*
|
| 26 |
* Contient des fonctions permettant d'évaluer un script.
|
26 |
* Contient des fonctions permettant d'évaluer un script.
|
| 27 |
*
|
27 |
*
|
| Line 29... |
Line 29... |
| 29 |
//Auteur original :
|
29 |
//Auteur original :
|
| 30 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
30 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
| 31 |
//Autres auteurs :
|
31 |
//Autres auteurs :
|
| 32 |
*@author Aucun
|
32 |
*@author Aucun
|
| 33 |
*@copyright Tela-Botanica 2000-2004
|
33 |
*@copyright Tela-Botanica 2000-2004
|
| 34 |
*@version $Revision: 1.1 $ $Date: 2004-06-15 10:13:07 $
|
34 |
*@version $Revision: 1.2 $ $Date: 2004-11-29 15:54:16 $
|
| 35 |
// +------------------------------------------------------------------------------------------------------+
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
| 36 |
*/
|
36 |
*/
|
| Line 37... |
Line 37... |
| 37 |
|
37 |
|
| 38 |
// +------------------------------------------------------------------------------------------------------+
|
38 |
// +------------------------------------------------------------------------------------------------------+
|
| Line 43... |
Line 43... |
| 43 |
* Cette fonction permet d'afficher un ensemble de mesure de temps prises à différents endroits d'un script.
|
43 |
* Cette fonction permet d'afficher un ensemble de mesure de temps prises à différents endroits d'un script.
|
| 44 |
* Ces mesures sont affichées au sein d'un tableau XHTML dont on peut controler l'indentation des balises.
|
44 |
* Ces mesures sont affichées au sein d'un tableau XHTML dont on peut controler l'indentation des balises.
|
| 45 |
* Pour un site en production, il suffit d'ajouter un style #chrono {display:none;} dans la css. De cette façon,
|
45 |
* Pour un site en production, il suffit d'ajouter un style #chrono {display:none;} dans la css. De cette façon,
|
| 46 |
* le tableau ne s'affichera pas. Le webmaster lui pourra rajouter sa propre feuille de style affichant le tableau.
|
46 |
* le tableau ne s'affichera pas. Le webmaster lui pourra rajouter sa propre feuille de style affichant le tableau.
|
| 47 |
* Le développeur initial de cette fonction est Loic d'Anterroches. Elle a été modifiée par Jean-Pascal Milcent.
|
47 |
* Le développeur initial de cette fonction est Loic d'Anterroches. Elle a été modifiée par Jean-Pascal Milcent.
|
| - |
|
48 |
* Elle utilise une variable gobale : $_CHRONO_
|
| 48 |
*
|
49 |
*
|
| 49 |
* @author Loic d'Anterroches
|
50 |
* @author Loic d'Anterroches
|
| 50 |
* @param int l'indentation de base pour le code html du tableau.
|
51 |
* @param int l'indentation de base pour le code html du tableau.
|
| 51 |
* @param int le pas d'indentation pour le code html du tableau.
|
52 |
* @param int le pas d'indentation pour le code html du tableau.
|
| 52 |
* @return string la chaine XHTML de mesure des temps.
|
53 |
* @return string la chaine XHTML de mesure des temps.
|
| 53 |
*/
|
54 |
*/
|
| 54 |
function BOG_afficherChrono($indentation_origine = 8, $indentation = 4)
|
55 |
function BOG_afficherChrono($indentation_origine = 8, $indentation = 4)
|
| 55 |
{
|
56 |
{
|
| 56 |
global $chrono_flash;
|
- |
|
| 57 |
|
- |
|
| 58 |
$sortie = str_repeat(' ', $indentation_origine).
|
57 |
$sortie = str_repeat(' ', $indentation_origine).
|
| 59 |
'<table id="chrono" lang="fr" summary="Résultat du chronométrage du programme affichant la page actuelle.">'."\n";
|
58 |
'<table id="chrono" lang="fr" summary="Résultat du chronométrage du programme affichant la page actuelle.">'."\n";
|
| 60 |
$sortie .= str_repeat(' ', ($indentation_origine + ($indentation * 1))).
|
59 |
$sortie .= str_repeat(' ', ($indentation_origine + ($indentation * 1))).
|
| 61 |
'<caption>Chronométrage</caption>'."\n";
|
60 |
'<caption>Chronométrage</caption>'."\n";
|
| 62 |
$sortie .= str_repeat(' ', ($indentation_origine + ($indentation * 1))).
|
61 |
$sortie .= str_repeat(' ', ($indentation_origine + ($indentation * 1))).
|
| Line 68... |
Line 67... |
| 68 |
|
67 |
|
| 69 |
$tbody = str_repeat(' ', ($indentation_origine + ($indentation * 1))).
|
68 |
$tbody = str_repeat(' ', ($indentation_origine + ($indentation * 1))).
|
| 70 |
'<tbody>'."\n";
|
69 |
'<tbody>'."\n";
|
| 71 |
$total_tps_ecoule = 0;
|
70 |
$total_tps_ecoule = 0;
|
| 72 |
// Récupération de la première mesure
|
71 |
// Récupération de la première mesure
|
| 73 |
list($usec, $sec) = explode(' ',$chrono_flash['depart']);
|
72 |
list($usec, $sec) = explode(' ', $GLOBALS['_CHRONO_']['depart']);
|
| 74 |
// Ce temps correspond à tps_fin
|
73 |
// Ce temps correspond à tps_fin
|
| Line 75... |
Line 74... |
| 75 |
$tps_fin = ((float)$usec + (float)$sec);
|
74 |
$tps_fin = ((float)$usec + (float)$sec);
|
| 76 |
|
75 |
|
| 77 |
foreach ($chrono_flash as $cle => $valeur) {
|
76 |
foreach ($GLOBALS['_CHRONO_'] as $cle => $valeur) {
|
| Line 78... |
Line 77... |
| 78 |
list($usec, $sec) = explode(' ',$valeur);
|
77 |
list($usec, $sec) = explode(' ',$valeur);
|
| 79 |
$tps_debut = ((float)$usec + (float)$sec);
|
78 |
$tps_debut = ((float)$usec + (float)$sec);
|
| Line 109... |
Line 108... |
| 109 |
}
|
108 |
}
|
| Line 110... |
Line 109... |
| 110 |
|
109 |
|
| 111 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
110 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
| 112 |
*
|
111 |
*
|
| - |
|
112 |
* $Log: not supported by cvs2svn $
|
| - |
|
113 |
* Revision 1.1 2004/06/15 10:13:07 jpm
|
| - |
|
114 |
* Intégration dans Papyrus.
|
| 113 |
* $Log: not supported by cvs2svn $
|
115 |
*
|
| 114 |
* Revision 1.2 2004/04/22 09:01:55 jpm
|
116 |
* Revision 1.2 2004/04/22 09:01:55 jpm
|
| 115 |
* Ajout de l'attribut lang au tableau.
|
117 |
* Ajout de l'attribut lang au tableau.
|
| 116 |
*
|
118 |
*
|
| 117 |
* Revision 1.1 2004/04/21 07:49:13 jpm
|
119 |
* Revision 1.1 2004/04/21 07:49:13 jpm
|