$wgProfileCallTree = false;
/** If not empty, specifies profiler type to load */
$wgProfilerType = '';
+/** Should application server host be put into profiling table */
+$wgProfilePerHost = false;
/** Settings for UDP profiler */
$wgUDPProfilerHost = '127.0.0.1';
*/
function logToDB($name, $timeSum, $eventCount) {
# Warning: $wguname is a live patch, it should be moved to Setup.php
- global $wguname;
+ global $wguname, $wgProfilePerHost;
$fname = 'Profiler::logToDB';
$dbw = & wfGetDB(DB_MASTER);
$name = substr($name, 0, 255);
$encname = $dbw->strencode($name);
+
+ if ($wgProfilePerHost) {
+ $pfhost = $wguname['nodename'];
+ } else {
+ $pfhost = '';
+ }
+
$sql = "UPDATE $profiling "."SET pf_count=pf_count+{$eventCount}, "."pf_time=pf_time + {$timeSum} ".
- "WHERE pf_name='{$encname}' AND pf_server='{$wguname['nodename']}'";
+ "WHERE pf_name='{$encname}' AND pf_server='{$pfhost}'";
$dbw->query($sql);
$rc = $dbw->affectedRows();
if ($rc == 0) {
$dbw->insert('profiling', array ('pf_name' => $name, 'pf_count' => $eventCount,
- 'pf_time' => $timeSum, 'pf_server' => $wguname['nodename'] ), $fname, array ('IGNORE'));
+ 'pf_time' => $timeSum, 'pf_server' => $pfhost ), $fname, array ('IGNORE'));
}
// When we upgrade to mysql 4.1, the insert+update
// can be merged into just a insert with this construct added:
pf_count integer not null default 0,
pf_time float not null default 0,
pf_name varchar(255) not null default '',
- UNIQUE KEY pf_name (pf_name)
+ pf_server varchar(30) not null default '',
+ UNIQUE KEY pf_name_server (pf_name, pf_server)
) TYPE=HEAP;