49 $t1 = explode(
" ",$t1);
50 $t2 = explode(
" ",$t2);
51 $diff = $t2[0] - $t1[0] + $t2[1] - $t1[1];
65 $q =
"DELETE FROM benchmark";
77 function start($a_module, $a_bench)
79 $this->bench[$a_module.
":".$a_bench][] = microtime();
88 function stop($a_module, $a_bench)
90 $this->bench[$a_module.
":".$a_bench][count($this->bench[$a_module.
":".$a_bench]) - 1]
91 = $this->
microtimeDiff($this->bench[$a_module.
":".$a_bench][count($this->bench[$a_module.
":".$a_bench]) - 1], microtime());
105 foreach($this->bench as $key => $bench)
107 $bench_arr = explode(
":", $key);
108 $bench_module = $bench_arr[0];
109 $benchmark = $bench_arr[1];
110 foreach($bench as $time)
112 $q =
"INSERT INTO benchmark (cdate, duration, module, benchmark) VALUES ".
113 "(now(), ".$ilDB->quote($time).
", ".$ilDB->quote($bench_module).
", ".$ilDB->quote($benchmark).
")";
117 $this->bench = array();
134 $q =
"SELECT COUNT(*) AS cnt, AVG(duration) AS avg_dur, benchmark,".
135 " MIN(duration) AS min_dur, MAX(duration) AS max_dur".
137 " WHERE module = ".$ilDB->quote($a_module).
" ".
138 " GROUP BY benchmark".
139 " ORDER BY benchmark";
140 $bench_set = $ilDB->query($q);
144 $eva[] = array(
"benchmark" => $bench_rec[
"benchmark"],
145 "cnt" => $bench_rec[
"cnt"],
"duration" => $bench_rec[
"avg_dur"],
146 "min" => $bench_rec[
"min_dur"],
"max" => $bench_rec[
"max_dur"]);
159 $q =
"SELECT COUNT(*) AS cnt FROM benchmark";
160 $cnt_set = $ilDB->query($q);
163 return $cnt_rec[
"cnt"];
174 return $ilias->getSetting(
"bench_max_records");
185 $ilias->setSetting(
"bench_max_records", (
int) $a_max);
196 return (
boolean) $ilias->getSetting(
"enable_bench");
209 $ilias->setSetting(
"enable_bench", 1);
213 $ilias->setSetting(
"enable_bench", 0);
225 $q =
"SELECT DISTINCT module FROM benchmark";
226 $mod_set = $ilDB->query($q);
231 $modules[$mod_rec[
"module"]] = $mod_rec[
"module"];
245 return $this->bench[$a_module.
":".$a_bench][count($this->bench[$a_module.
":".$a_bench]) - 1];