本文整理汇总了PHP中Profiler::setInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Profiler::setInstance方法的具体用法?PHP Profiler::setInstance怎么用?PHP Profiler::setInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profiler
的用法示例。
在下文中一共展示了Profiler::setInstance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wfSetupDump
function wfSetupDump()
{
global $wgProfileToDatabase, $wgProfileSampleRate;
// Override disabled profiling in maintenance scripts
Profiler::setInstance(new Profiler());
$wgProfileToDatabase = false;
$wgProfileSampleRate = 1;
}
示例2: execute
public function execute()
{
Profiler::setInstance(new ProfilerSimpleText(array()));
// clear
$backend = FileBackendGroup::singleton()->get($this->getOption('b1'));
$this->doPerfTest($backend);
if ($this->getOption('b2')) {
$backend = FileBackendGroup::singleton()->get($this->getOption('b2'));
$this->doPerfTest($backend);
}
Profiler::instance()->setTemplated(true);
// NOTE: as of MW1.21, $profiler->logData() is called implicitly by doMaintenance.php.
}
示例3: finalSetup
/**
* Handle some last-minute setup here.
*/
public function finalSetup()
{
global $wgCommandLineMode, $wgShowSQLErrors, $wgServer;
global $wgDBadminuser, $wgDBadminpassword;
global $wgDBuser, $wgDBpassword, $wgDBservers, $wgLBFactoryConf;
# Turn off output buffering again, it might have been turned on in the settings files
if (ob_get_level()) {
ob_end_flush();
}
# Same with these
$wgCommandLineMode = true;
# Override $wgServer
if ($this->hasOption('server')) {
$wgServer = $this->getOption('server', $wgServer);
}
# If these were passed, use them
if ($this->mDbUser) {
$wgDBadminuser = $this->mDbUser;
}
if ($this->mDbPass) {
$wgDBadminpassword = $this->mDbPass;
}
if ($this->getDbType() == self::DB_ADMIN && isset($wgDBadminuser)) {
$wgDBuser = $wgDBadminuser;
$wgDBpassword = $wgDBadminpassword;
if ($wgDBservers) {
/**
* @var $wgDBservers array
*/
foreach ($wgDBservers as $i => $server) {
$wgDBservers[$i]['user'] = $wgDBuser;
$wgDBservers[$i]['password'] = $wgDBpassword;
}
}
if (isset($wgLBFactoryConf['serverTemplate'])) {
$wgLBFactoryConf['serverTemplate']['user'] = $wgDBuser;
$wgLBFactoryConf['serverTemplate']['password'] = $wgDBpassword;
}
LBFactory::destroyInstance();
}
$this->afterFinalSetup();
$wgShowSQLErrors = true;
// @codingStandardsIgnoreStart Allow error supppression. wfSuppressWarnings()
// is not avaiable.
@set_time_limit(0);
// @codingStandardsIgnoreStart
$this->adjustMemoryLimit();
// Per-script profiling; useful for debugging
$forcedProfiler = $this->getOption('profiler');
if ($forcedProfiler === 'text') {
Profiler::setInstance(new ProfilerSimpleText(array()));
Profiler::instance()->setTemplated(true);
} elseif ($forcedProfiler === 'trace') {
Profiler::setInstance(new ProfilerSimpleTrace(array()));
Profiler::instance()->setTemplated(true);
}
}