78 ? [
'ignored_functions' =>
$params[
'exclude'] ] : [];
87 if ( !$this->xhprofData ) {
94 $key =
'section.' . ltrim(
$section,
'.' );
95 return $this->sprofiler->scopedProfileIn( $key );
111 if (
$name ===
'-total' ) {
114 if ( !empty( $this->params[
'include'] ) ) {
115 foreach ( $this->params[
'include']
as $pattern ) {
116 if ( fnmatch( $pattern,
$name, FNM_NOESCAPE ) ) {
122 if ( !empty( $this->params[
'exclude'] ) ) {
123 foreach ( $this->params[
'exclude']
as $pattern ) {
124 if ( fnmatch( $pattern,
$name, FNM_NOESCAPE ) ) {
137 foreach ( $metrics
as $fname => $stats ) {
144 'calls' => $stats[
'ct'],
145 'real' => $stats[
'wt'][
'total'] / 1000,
146 '%real' => $stats[
'wt'][
'percent'],
147 'cpu' => isset( $stats[
'cpu'] ) ? $stats[
'cpu'][
'total'] / 1000 : 0,
148 '%cpu' => isset( $stats[
'cpu'] ) ? $stats[
'cpu'][
'percent'] : 0,
149 'memory' => isset( $stats[
'mu'] ) ? $stats[
'mu'][
'total'] : 0,
150 '%memory' => isset( $stats[
'mu'] ) ? $stats[
'mu'][
'percent'] : 0,
151 'min_real' => $stats[
'wt'][
'min'] / 1000,
152 'max_real' => $stats[
'wt'][
'max'] / 1000
155 if (
$fname ===
'main()' ) {
161 foreach ( $this->sprofiler->getFunctionStats()
as $stats ) {
167 $stats[
'%real'] = $main[
'real'] ? $stats[
'real'] / $main[
'real'] * 100 : 0;
168 $stats[
'%cpu'] = $main[
'cpu'] ? $stats[
'cpu'] / $main[
'cpu'] * 100 : 0;
169 $stats[
'%memory'] = $main[
'memory'] ? $stats[
'memory'] / $main[
'memory'] * 100 : 0;
203 usort(
$data,
function ( $a, $b ) {
204 return $b[
'real'] <=> $a[
'real'];
208 $nameWidth = $width - 65;
209 $format =
"%-{$nameWidth}s %6d %9d %9d %9d %9d %7.3f%% %9d";
211 $out[] = sprintf(
"%-{$nameWidth}s %6s %9s %9s %9s %9s %7s %9s",
212 'Name',
'Calls',
'Total',
'Min',
'Each',
'Max',
'%',
'Mem'
215 $out[] = sprintf( $format,
218 $stats[
'real'] * 1000,
219 $stats[
'min_real'] * 1000,
220 $stats[
'real'] / $stats[
'calls'] * 1000,
221 $stats[
'max_real'] * 1000,
226 return implode(
"\n",
$out );
if(defined( 'MW_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings,...
Profiler wrapper for XHProf extension.
getFunctionStats()
Get the aggregated inclusive profiling data for each method.
getRawData()
Retrieve raw data from xhprof.
scopedProfileIn( $section)
Mark the start of a custom profiling frame (e.g.
close()
No-op for xhprof profiling.
__construct(array $params=[])
shouldExclude( $name)
Check if a function or section should be excluded from the output.
getFunctionReport()
Get a report of profiled functions sorted by inclusive wall clock time in descending order.
getOutput()
Returns a profiling output to be stored in debug file.
SectionProfiler $sprofiler
Profiler for explicit, arbitrary, frame labels.
Profiler base class that defines the interface and some trivial functionality.
array $params
All of the params passed from $wgProfiler.
Custom PHP profiler for parser/DB type section names that xhprof/xdebug can't handle.
Convenience class for working with XHProf profiling data https://github.com/phacility/xhprof.
static enable( $flags=0, $options=[])
Start xhprof profiler.
static disable()
Stop xhprof profiler.
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
$data
Utility to generate mapping file used in mw.Title (phpCharToUpper.json)
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password 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
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
Allows to change the fields on the form that will be generated $name
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
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))