}
/**
- * Get the target language for the content being parsed. This is usually the
- * language that the content is in.
+ * Get the target language for the content being parsed. This is usually the
+ * language that the content is in.
*/
function getTargetLanguage() {
$target = $this->mOptions->getTargetLanguage();
$text = $this->maybeMakeExternalImage( $url );
if ( $text === false ) {
# Not an image, make a link
- $text = Linker::makeExternalLink( $url,
+ $text = Linker::makeExternalLink( $url,
$this->getConverterLanguage()->markNoConversion($url), true, 'free',
$this->getExternalLinkAttribs( $url ) );
# Register it in the output object...
}
if ( $this->getConverterLanguage()->hasVariants() ) {
- $selflink = $this->getConverterLanguage()->autoConvertToAllVariants(
+ $selflink = $this->getConverterLanguage()->autoConvertToAllVariants(
$this->mTitle->getPrefixedText() );
} else {
$selflink = array( $this->mTitle->getPrefixedText() );
# Load from database
if ( !$found && $title ) {
- $titleProfileIn = __METHOD__ . "-title-" . $title->getDBKey();
- wfProfileIn( $titleProfileIn ); // template in
+ if ( !Profiler::instance()->isPersistent() ) {
+ # Too many unique items can kill profiling DBs/collectors
+ $titleProfileIn = __METHOD__ . "-title-" . $title->getDBKey();
+ wfProfileIn( $titleProfileIn ); // template in
+ }
wfProfileIn( __METHOD__ . '-loadtpl' );
if ( !$title->isExternal() ) {
if ( $title->isSpecialPage()
return false;
}
+ /**
+ * Return whether this profiler stores data
+ *
+ * @see Profiler::logData()
+ * @return Boolean
+ */
+ public function isPersistent() {
+ return true;
+ }
+
public function setProfileID( $id ) {
$this->mProfileID = $id;
}
}
wfProfileOut( '-overhead-total' );
}
-
+
/**
* Counts the number of profiled function calls sitting under
* the given point in the call graph. Not the most efficient algo.
$rc = $dbw->affectedRows();
if ( $rc == 0 ) {
$dbw->insert('profiling', array ('pf_name' => $name, 'pf_count' => $eventCount,
- 'pf_time' => $timeSum, 'pf_memory' => $memorySum, 'pf_server' => $pfhost ),
+ 'pf_time' => $timeSum, 'pf_memory' => $memorySum, 'pf_server' => $pfhost ),
__METHOD__, array ('IGNORE'));
}
// When we upgrade to mysql 4.1, the insert+update
var $zeroEntry = array('cpu'=> 0.0, 'cpu_sq' => 0.0, 'real' => 0.0, 'real_sq' => 0.0, 'count' => 0);
var $errorEntry;
+ public function isPersistent() {
+ /* Implement in output subclasses */
+ return false;
+ }
+
protected function addInitialStack() {
$this->errorEntry = $this->zeroEntry;
$this->errorEntry['count'] = 1;
str_repeat(" ", count( $this->mWorkStack ) + 1 ) . " < " . $functionname . "\n";
}
}
-
+
function memoryDiff() {
$diff = memory_get_usage() - $this->memory;
$this->memory = memory_get_usage();
* @ingroup Profiler
*/
class ProfilerSimpleUDP extends ProfilerSimple {
+ public function isPersistent() {
+ return true;
+ }
+
public function logData() {
global $wgUDPProfilerHost, $wgUDPProfilerPort;
public function isStub() {
return true;
}
+ public function isPersistent() {
+ return false;
+ }
public function profileIn( $fn ) {}
public function profileOut( $fn ) {}
public function getOutput() {}