Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4111769
profiler.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
profiler.js
View Options
/*!
* Augment mw.loader to facilitate module-level profiling.
*
* @since 1.32
*/
/* global mw */
(
function
()
{
'use strict'
;
var
moduleTimes
=
Object
.
create
(
null
);
/**
* Private hooks inserted into mw.loader code if MediaWiki configuration
* `$wgResourceLoaderEnableJSProfiler` is `true`.
*
* To use this data, run `mw.inspect( 'time' )` from the browser console.
* See mw#inspect().
*
* @private
* @class
* @singleton
*/
mw
.
loader
.
profiler
=
{
onExecuteStart
:
function
(
moduleName
)
{
var
time
=
performance
.
now
();
if
(
moduleTimes
[
moduleName
]
)
{
throw
new
Error
(
'Unexpected perf record for "'
+
moduleName
+
'".'
);
}
moduleTimes
[
moduleName
]
=
{
executeStart
:
time
,
executeEnd
:
null
,
scriptStart
:
null
,
scriptEnd
:
null
};
},
onExecuteEnd
:
function
(
moduleName
)
{
var
time
=
performance
.
now
();
moduleTimes
[
moduleName
].
executeEnd
=
time
;
},
onScriptStart
:
function
(
moduleName
)
{
var
time
=
performance
.
now
();
moduleTimes
[
moduleName
].
scriptStart
=
time
;
},
onScriptEnd
:
function
(
moduleName
)
{
var
time
=
performance
.
now
();
moduleTimes
[
moduleName
].
scriptEnd
=
time
;
},
/**
* For internal use by inspect.reports#time.
*
* @private
* @param {string} moduleName
* @return {Object|null}
* @throws {Error} If the perf record is incomplete.
*/
getProfile
:
function
(
moduleName
)
{
var
times
,
key
,
execute
,
script
,
total
;
times
=
moduleTimes
[
moduleName
];
if
(
!
times
)
{
return
null
;
}
for
(
key
in
times
)
{
if
(
times
[
key
]
===
null
)
{
throw
new
Error
(
'Incomplete perf record for "'
+
moduleName
+
'".'
,
times
);
}
}
execute
=
times
.
executeEnd
-
times
.
executeStart
;
script
=
times
.
scriptEnd
-
times
.
scriptStart
;
total
=
execute
+
script
;
return
{
name
:
moduleName
,
execute
:
execute
,
script
:
script
,
total
:
total
};
}
};
}()
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Aug 18, 22:31 (1 d, 3 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
fe/70/099115bb287e1d5daffa5047d2f8
Default Alt Text
profiler.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment