$boucle";
} else {
if ($x) return;
$boucle = $contexte = '';
}
list($usec, $sec) = explode(" ", $m1);
list($usec2, $sec2) = explode(" ", $m2);
$dt = $sec2 + $usec2 - $sec - $usec;
$tt += $dt;
$nb++;
$q = preg_replace('/([a-z)`])\s+([A-Z])/', "$1\n
$2",spip_htmlentities($query));
$e = sql_explain($query, $serveur);
$r = str_replace('Resource id ','',(is_object($result)?get_class($result):$result));
$tableau_des_temps[] = array($dt, $nb, $boucle, $q, $e, $r, $contexte);
}
function chrono_requete($temps)
{
$total = 0;
$hors = "" . _T('zbug_hors_compilation') . "";
$t = $q = $n = $d = array();
// Totaliser les temps et completer le Explain
foreach ($temps as $key => $v) {
list($dt, $nb, $boucle, $query, $explain, $res, $contexte) = $v;
if (is_array($contexte)) {
$k = ($contexte[0] . " $boucle");
include_spip('public/compiler');
$env = reconstruire_contexte_compil($contexte);
} else $k = $env = $boucle;
$total += $dt;
$t[$key] = $dt;
$q[$key] = $nb;
$d[$k]+= $dt;
if ($k) @++$n[$k];
if (!is_array($explain))
$explain = array();
foreach($explain as $j => $v) {
$explain[$j] = "
Time | $dt |
---|---|
Order | $nb |
Res | $res |