MediaWiki  REL1_24
Profiler.php File Reference

Base class and functions for profiling. More...

Go to the source code of this file.

Classes

class  Profiler
 Profiler base class that defines the interface and some trivial functionality. More...
class  ProfileSection
 Class for handling function-scope profiling. More...
class  TransactionProfiler
 Helper class that detects high-contention DB queries via profiling calls. More...

Functions

 wfGetRusage ()
 Get system resource usage of current request context.
 wfProfileIn ($functionname)
 Begin profiling of a function.
 wfProfileOut ($functionname= 'missing')
 Stop profiling of a function.

Detailed Description

Base class and functions for profiling.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html

Definition in file Profiler.php.


Function Documentation

Get system resource usage of current request context.

Invokes the getrusage(2) system call, requesting RUSAGE_SELF if on PHP5 or RUSAGE_THREAD if on HHVM. Returns false if getrusage is not available.

Since:
1.24
Returns:
array|bool Resource usage data or false if no data available.

Definition at line 33 of file Profiler.php.

Referenced by ParserOutput\getTimes().

wfProfileIn ( functionname)

Begin profiling of a function.

Parameters:
string$functionnameName of the function we will profile

Definition at line 47 of file Profiler.php.

References Profiler\$__instance, and Profiler\instance().

Referenced by MediaWikiPHPUnitBootstrap\__construct(), AjaxDispatcher\__construct(), Linker\accesskey(), LinkCache\addLinkObj(), ChangesFeed\buildItems(), Skin\buildSidebar(), ProfilerStandard\calculateOverhead(), TableDiffFormatter\changed(), UploadBase\checkWarnings(), WordLevelDiff\closing(), ViewCountUpdate\collect(), LanguageKk\convertGrammar(), UploadBase\detectScript(), UploadBase\detectVirus(), UserCache\doQuery(), LinkBatch\doQuery(), DjVuHandler\doTransform(), DeferredUpdates\doUpdates(), Xml\elementClean(), CurlHttpRequest\execute(), PhpHttpRequest\execute(), LinkBatch\executeInto(), SpecialPageFactory\executePath(), Parser\findColonNoLinks(), Linker\formatComment(), FeedUtils\formatDiffRow(), Linker\formatHiddenCategories(), SpecialProtectedtitles\formatRow(), Linker\formatTemplates(), CoreParserFunctions\gender(), ChangesFeed\generateFeed(), MessageBlobStore\get(), MemcachedPeclBagOStuff\get(), JobQueueAggregator\getAllReadyWikiQueues(), Skin\getCachedNotice(), CreditsAction\getCredits(), User\getEditCount(), DjVuHandler\getMetaTree(), ResourceLoaderStartUpModule\getModuleRegistrations(), MemcachedPeclBagOStuff\getMulti(), Skin\getNamespaceNotice(), SpecialPageFactory\getPageList(), UploadBase\getRealPath(), Skin\getSiteNotice(), ProtectedTitlesPager\getStartBody(), ApiTokens\getTokenTypes(), ApiQueryTokens\getTokenTypeSalts(), SpecialVersion\getVersion(), SpecialVersion\getVersionLinked(), SearchHighlighter\highlightSimple(), SearchHighlighter\highlightText(), Skin\initPage(), Linker\link(), Linker\linkAttribs(), Linker\linkUrl(), Linker\makeBrokenImageLinkObj(), Linker\makeKnownLinkObj(), Linker\makeLinkObj(), LanguageBe_tarask\normalizeForSearch(), LanguageYue\normalizeForSearch(), LanguageZh_hans\normalizeForSearch(), LanguageZh\normalizeForSearch(), Linker\normalizeSubpageLink(), SearchMySQL\normalizeText(), JobQueueAggregator\notifyQueueEmpty(), JobQueueAggregator\notifyQueueNonEmpty(), UnwatchAction\onSubmit(), WatchAction\onSubmit(), CreditsAction\onView(), WordLevelDiff\orig(), InfoAction\pageCounts(), SiteStats\pagesInNs(), UploadBase\performUpload(), BlockListPager\preprocessResults(), JobQueueAggregator\purge(), BacklinkCache\queryLinks(), SvgHandler\rasterize(), MWCryptRand\realGenerate(), OldChangesList\recentChangesLine(), Sanitizer\removeHTMLcomments(), Sanitizer\removeHTMLtags(), SearchHighlighter\removeWiki(), ReplacementArray\replace(), WikitextContent\replaceSection(), Http\request(), DjVuImage\retrieveMetaData(), JpegHandler\rotate(), BitmapHandler\rotate(), Hooks\run(), PrefixSearch\searchWithVariants(), MemcachedPeclBagOStuff\setMulti(), UploadBase\stashFile(), StreamFile\stream(), Linker\titleAttrib(), BitmapHandler\transformCustom(), BitmapHandler\transformImageMagick(), MediaWikiI18N\translate(), StripState\unstripType(), UploadBase\verifyFile(), UploadBase\verifyMimeType(), UploadBase\verifyPartialFile(), UploadBase\verifyUpload(), wfIsBadImage(), and wfMsgReal().

wfProfileOut ( functionname = 'missing')

Stop profiling of a function.

Parameters:
string$functionnameName of the function we have profiled

Definition at line 60 of file Profiler.php.

References Profiler\$__instance, and Profiler\instance().

Referenced by AjaxDispatcher\__construct(), MediaWikiPHPUnitBootstrap\__destruct(), Linker\accesskey(), LinkCache\addLinkObj(), ChangesFeed\buildItems(), Skin\buildSidebar(), ProfilerStandard\calculateOverhead(), TableDiffFormatter\changed(), UploadBase\checkWarnings(), WordLevelDiff\closing(), ViewCountUpdate\collect(), LanguageKk\convertGrammar(), UploadBase\detectScript(), UploadBase\detectVirus(), UserCache\doQuery(), LinkBatch\doQuery(), DjVuHandler\doTransform(), DeferredUpdates\doUpdates(), Xml\elementClean(), CurlHttpRequest\execute(), PhpHttpRequest\execute(), LinkBatch\executeInto(), SpecialPageFactory\executePath(), Parser\findColonNoLinks(), Linker\formatComment(), FeedUtils\formatDiffRow(), Linker\formatHiddenCategories(), SpecialProtectedtitles\formatRow(), Linker\formatTemplates(), CoreParserFunctions\gender(), ChangesFeed\generateFeed(), MessageBlobStore\get(), MemcachedPeclBagOStuff\get(), JobQueueAggregator\getAllReadyWikiQueues(), Skin\getCachedNotice(), CreditsAction\getCredits(), User\getEditCount(), DjVuHandler\getMetaTree(), ResourceLoaderStartUpModule\getModuleRegistrations(), MemcachedPeclBagOStuff\getMulti(), Skin\getNamespaceNotice(), SpecialPageFactory\getPageList(), UploadBase\getRealPath(), Skin\getSiteNotice(), ProtectedTitlesPager\getStartBody(), ApiTokens\getTokenTypes(), ApiQueryTokens\getTokenTypeSalts(), SpecialVersion\getVersion(), SpecialVersion\getVersionLinked(), SearchHighlighter\highlightSimple(), SearchHighlighter\highlightText(), Skin\initPage(), Linker\link(), Linker\linkAttribs(), Linker\linkUrl(), Linker\makeBrokenImageLinkObj(), Linker\makeKnownLinkObj(), Linker\makeLinkObj(), EditPage\matchSpamRegexInternal(), LanguageBe_tarask\normalizeForSearch(), LanguageYue\normalizeForSearch(), LanguageZh_hans\normalizeForSearch(), LanguageZh\normalizeForSearch(), Linker\normalizeSubpageLink(), SearchMySQL\normalizeText(), JobQueueAggregator\notifyQueueEmpty(), JobQueueAggregator\notifyQueueNonEmpty(), UnwatchAction\onSubmit(), WatchAction\onSubmit(), CreditsAction\onView(), WordLevelDiff\orig(), InfoAction\pageCounts(), SiteStats\pagesInNs(), UploadBase\performUpload(), BlockListPager\preprocessResults(), JobQueueAggregator\purge(), BacklinkCache\queryLinks(), SvgHandler\rasterize(), MWCryptRand\realGenerate(), OldChangesList\recentChangesLine(), Sanitizer\removeHTMLcomments(), Sanitizer\removeHTMLtags(), SearchHighlighter\removeWiki(), ReplacementArray\replace(), WikitextContent\replaceSection(), Http\request(), DjVuImage\retrieveMetaData(), JpegHandler\rotate(), BitmapHandler\rotate(), Hooks\run(), PrefixSearch\searchWithVariants(), MemcachedPeclBagOStuff\setMulti(), UploadBase\stashFile(), StreamFile\stream(), Linker\titleAttrib(), BitmapHandler\transformCustom(), BitmapHandler\transformImageMagick(), MediaWikiI18N\translate(), StripState\unstripType(), UploadBase\verifyFile(), UploadBase\verifyMimeType(), UploadBase\verifyPartialFile(), UploadBase\verifyUpload(), wfIsBadImage(), and wfMsgReal().