74 ? [
'ignored_functions' =>
$params[
'exclude'] ] : [];
83 if ( !$this->xhprofData ) {
90 $key =
'section.' . ltrim(
$section,
'.' );
91 return $this->sprofiler->scopedProfileIn( $key );
107 if (
$name ===
'-total' ) {
110 if ( !empty( $this->params[
'include'] ) ) {
111 foreach ( $this->params[
'include']
as $pattern ) {
112 if ( fnmatch( $pattern,
$name, FNM_NOESCAPE ) ) {
118 if ( !empty( $this->params[
'exclude'] ) ) {
119 foreach ( $this->params[
'exclude']
as $pattern ) {
120 if ( fnmatch( $pattern,
$name, FNM_NOESCAPE ) ) {
133 foreach ( $metrics
as $fname => $stats ) {
140 'calls' => $stats[
'ct'],
141 'real' => $stats[
'wt'][
'total'] / 1000,
142 '%real' => $stats[
'wt'][
'percent'],
143 'cpu' => isset( $stats[
'cpu'] ) ? $stats[
'cpu'][
'total'] / 1000 : 0,
144 '%cpu' => isset( $stats[
'cpu'] ) ? $stats[
'cpu'][
'percent'] : 0,
145 'memory' => isset( $stats[
'mu'] ) ? $stats[
'mu'][
'total'] : 0,
146 '%memory' => isset( $stats[
'mu'] ) ? $stats[
'mu'][
'percent'] : 0,
147 'min_real' => $stats[
'wt'][
'min'] / 1000,
148 'max_real' => $stats[
'wt'][
'max'] / 1000
151 if (
$fname ===
'main()' ) {
157 foreach ( $this->sprofiler->getFunctionStats()
as $stats ) {
163 $stats[
'%real'] = $main[
'real'] ? $stats[
'real'] / $main[
'real'] * 100 : 0;
164 $stats[
'%cpu'] = $main[
'cpu'] ? $stats[
'cpu'] / $main[
'cpu'] * 100 : 0;
165 $stats[
'%memory'] = $main[
'memory'] ? $stats[
'memory'] / $main[
'memory'] * 100 : 0;
199 usort( $data,
function( $a, $b ) {
200 if ( $a[
'real'] === $b[
'real'] ) {
203 return ( $a[
'real'] > $b[
'real'] ) ? -1 : 1;
207 $nameWidth = $width - 65;
208 $format =
"%-{$nameWidth}s %6d %9d %9d %9d %9d %7.3f%% %9d";
210 $out[] = sprintf(
"%-{$nameWidth}s %6s %9s %9s %9s %9s %7s %9s",
211 'Name',
'Calls',
'Total',
'Min',
'Each',
'Max',
'%',
'Mem'
213 foreach ( $data
as $stats ) {
214 $out[] = sprintf( $format,
217 $stats[
'real'] * 1000,
218 $stats[
'min_real'] * 1000,
219 $stats[
'real'] / $stats[
'calls'] * 1000,
220 $stats[
'max_real'] * 1000,
225 return implode(
"\n",
$out );
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
the array() calling protocol came about after MediaWiki 1.4rc1.
static disable()
Stop xhprof profiler.
static enable($flags=0, $options=[])
Start xhprof profiler.
scopedProfileIn($section)
getOutput()
Returns a profiling output to be stored in debug file.
close()
No-op for xhprof profiling.
SectionProfiler $sprofiler
Profiler for explicit, arbitrary, frame labels.
array $params
All of the params passed from $wgProfiler.
it s the revision text itself In either if gzip is the revision text is gzipped $flags
__construct(array $params=[])
getFunctionReport()
Get a report of profiled functions sorted by inclusive wall clock time in descending order...
Custom PHP profiler for parser/DB type section names that xhprof/xdebug can't handle.
shouldExclude($name)
Check if a function or section should be excluded from the output.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
Profiler wrapper for XHProf extension.
Convenience class for working with XHProf profiling data https://github.com/phacility/xhprof.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template $section
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined...
getRawData()
Retrieve raw data from xhprof.
Profiler base class that defines the interface and some trivial functionality.
Allows to change the fields on the form that will be generated $name