Commit graph

33 commits

Author SHA1 Message Date
Tim Starling
0077c5da15 Use short array destructuring instead of list()
Introduced in PHP 7.1. Because it's shorter and looks nice.

I used regex replacement.

Change-Id: I0555e199d126cd44501f859cb4589f8bd49694da
2022-10-21 15:33:37 +11:00
Timo Tijhof
dd5f374b51 profiler: Remove deprecated 'trace' feature in SectionProfiler
Bug: T305100
Change-Id: Ia0f6584d5eb533690fb0e1d12f80cf0d2f9ea48d
2022-04-29 11:18:50 +00:00
Timo Tijhof
a756642283 profiler: Deprecate unused 'trace' option
This has no usage in core or in Codesearch Everywhere.

The creation of logical profile entries (such as for templates in
the parser, and for DB queries) remains supported and this is how
the class is used in core. Capturing detailed traces is only supported
via implementations like ProfilerXhprof and ProfilerExcimer.

Bug: T305100
Change-Id: Ib06ec25bfa1f9565ce85b54e8375c0a5f99a912a
2022-04-13 21:04:56 +00:00
Umherirrender
0a43a1e011 profiler: Adjust variable names in SectionProfiler::collateData
Found by phan (T259172)

Bug: T259172
Change-Id: I48742e08edfee5d09f43400e16c766cb88986658
2022-03-30 17:34:11 +00:00
Timo Tijhof
5947b51adf profiler: Document ProfilerXhprof class options
* Remove references to "udp" profiler output, removed in MediaWiki 1.27.

* Improve $wgProfiler docs.

* Improve ProfilerXhprof docs.

* Remove some inline $wgProfiler examples,
  in favour of references to $wgProfiler.

Bug: T247332
Change-Id: I8ec3a2a38cda767d47330c67a61b842d512b30ef
2021-09-07 03:10:32 +01:00
Timo Tijhof
063a528bc8 profiler: Use PSR-3 logging in Profiler and ProfilerOutput classes
* Use the "profiler" channel consistently within this component,
  and set it in the constructor of the base classes.

* Fold legacy "profilererror" channel into "profiler".
  Previously, the wfDebugLog wrapper was using the INFO severity,
  which is the default given wfDebugLog does not support severity.

Change-Id: I1e7dcbc221b395a4ea792e18f4d4da36b5ee40df
2020-08-12 03:51:29 +00:00
Timo Tijhof
c243872abb profiler: Document SectionProfiler private start and end as 'array|null'
Follows-up I2d35bfddfcc4c194aa7.

Also add a second check for is_array on end to please static analysis.

Change-Id: Ie8cf4bb1a6e64479cc411f049d7aab08570e6aa1
2020-03-02 02:56:51 +00:00
Timo Tijhof
d83fcce5cb profiler: Clean up file headers and @ingroup
* Remove redundant file description for files that only define
  a class where the class description suffices.
* Ensure the file has a license header and @file.

* Remove any @ingroup from the file comment block.
  These clutter the Doxygen pages with duplicate entries.
* Ensure the class block has an @ingroup set.

* Remove @since when @internal is set.
* Add any missing @since to public classes that were created
  recently enough to easily find out when:
  - ProfilerExcimer was introduced in 1.33 (6373e3d1d4).

Change-Id: I6b18289a15a3085857acd7c9004ec819f7914b29
2020-02-05 23:28:12 +00:00
James D. Forrester
2bc660c95a Collapse uses of now-deprecated wfGetRusage()
Change-Id: I9a2b5d1234ebb458b6cd29797de3f387d1399e6f
2019-10-22 11:32:06 +01:00
Daimona Eaytoy
b5f0d61ee4 Fix new phan errors, part 8
Bug: T231636
Change-Id: I61852ba55362ab9ae8cc8c1ab6b27565ce1d08e7
2019-10-22 10:09:13 +02:00
Daimona Eaytoy
b1a5367ec8 Fix new phan errors, part 7
Bug: T231636
Change-Id: Ia5e0abee7163c5a1abd0bb53b89603cc2e7a9b5c
2019-10-21 22:10:20 +00:00
Daimona Eaytoy
bd5b6f98ba Fix new phan errors, part 3
These are almost only doc changes, with two exceptions:
1-In LinkHolderArray, int-alike array keys are now cast to int, to be uniform with what we do in other code paths
2-In ExtensionRegistration, changed a line to throw an Exception
immediately, instead of an ExtensionDependencyError. This is because the
latter takes an array with msg and type, but we were passing it a plain
string (and in fact the code was bugged).

Bug: T231636
Change-Id: I8b0ef50d279c2a87490dde6a467a4e22c0710afd
2019-10-12 10:35:22 +00:00
Máté Szabó
2782276088 SectionProfiler: Do not attempt to use null values as arrays
When SectionProfiler::getFunctionStats() is called, the 'start'
and 'end' member variables may be null if no code called the
scopedProfileIn()/scopedProfileOut() methods on this profiler instance.
This can occur, for instance, when generating the parser limit report
for wikitext that did not include expensive parser functions.

In PHP 7.4, attemping to use a null value as an array generates
a PHP Notice.[1] This patch adds a check to SectionProfiler::getFunctionStats
to verify that the 'start' value is an array before attempting to
access its keys.

---
[1] https://github.com/php/php-src/blob/php-7.4.0RC1/UPGRADING#L25

Bug: T233012
Change-Id: I2d35bfddfcc4c194aa71265e40387f2f2914e3a5
2019-09-16 21:30:47 +02:00
Reedy
6341ee8fa6 Move SectionProfileCallback to its own file
Change-Id: Iccb2048eed6631caa4f20639f55866e76f9fabf0
2019-04-14 19:25:56 +00:00
Kunal Mehta
cc5d9a92a2 build: Updating mediawiki/mediawiki-codesniffer to 24.0.0
Change-Id: I66b1775b7c1d36076d9ca78cbeb42787a743f2aa
2019-02-07 18:39:42 +00:00
WMDE-Fisch
6df9ed1ad6 update mediawiki-codesniffer to 0.11.0 and fix issues
- mostly auto fixes
- some too long lines fixed
- ignore amp space in one case  passing by reference

Change-Id: I6472f83bc3cbf4bd629d83050cc3319b19ec465c
2017-08-11 22:27:51 +02:00
Umherirrender
a9007e8baf Add missing & to @param documentation to match functon call
Change-Id: I81e68310abcbc59964b22e0e74842d509f6b1fb9
2017-08-11 18:47:46 +02:00
Aaron Schulz
82e2c924e4 Remove "@author Aaron Schulz" annotations
Bug: T139301
Change-Id: Ib5248e8e27d60611c7373bce4b29dd5e85aa3489
2017-06-27 15:24:14 -07:00
Aaron Schulz
058707ef38 Fix SectionProfileCallback type error
Avoids "Argument 1 passed to Profiler::scopedProfileOut() must
be an instance of ScopedCallback, SectionProfileCallback given"

Change-Id: I92713de71df9722d8a5d7e5cd04460aff71cf096
2016-09-30 15:57:44 -07:00
Kunal Mehta
5320f0835e Use wikimedia/scoped-callback
The ScopedCallback class was moved into a separate library. This updates
all callers to use the namespaced version, and provides a
backwards-compatibility class wrapper under the old name.

Bug: T146258
Change-Id: I2dd0a66fe2f510f26bdfef6b0a975c1beb3fd93c
Depends-On: Iea0c40bdd7776372ccf72db8f088a2abaa4d3721
2016-09-29 10:41:40 +00:00
Kevin Israel
dc529b6555 SectionProfiler: Remove $profileOutCallback
Unused since 626aede99b.

Change-Id: I12c0d7900cd81d8b33b1a5a8dbe866ddd9664083
2016-07-25 09:23:29 -04:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Ori Livneh
c099155a17 ellapsed => elapsed
Also fix some files that don't end with a newline.

Change-Id: Id0672d685b929a5832b42f733dad49683536180a
2015-06-23 03:32:33 +00:00
Chad Horohoe
4b619eb7bd Remove $wgRUstart, unused
Change-Id: Ia57f8fb2da4eed6b185ea0592d521e3119411f0e
2015-04-16 15:28:37 -07:00
Reedy
4d9143c7f5 Add lots of @throws
Change-Id: I09d0c13070f966fcf23d2638d8fc1328279a5995
2014-12-24 13:49:20 +00:00
Aaron Schulz
626aede99b Made a new SectionProfileCallback class that extends ScopedCallback
* This is now used by SectionProfiler and avoids the high overhead of call_user_func_array().

Change-Id: I7ff2c9a35c7cd8ee462f2368b655e766ad33dd63
2014-12-17 13:16:06 -08:00
Aaron Schulz
2698d9803d Made SectionProfiler cache the ScopedCallback closure to lower overhead
Change-Id: Ia6f2ef4bb82dad13d49e74c730530295d5719009
2014-12-09 23:40:35 +00:00
Aaron Schulz
1b32de48d5 Made xhprof scopedProfileIn() work via merging SectionProfiler results
* This works around various pecl/hhvm xhprof extension issues.

Change-Id: I04555db1d0781bafc758ab9965c4af2fab9569f4
2014-12-08 23:39:37 +00:00
Aaron Schulz
848cad74e8 Fixed running percents in SectionProfiler
* Previously it assumed methods never overlapped.
* Also fixed running collation when in trace mode.

Change-Id: I6cbf5384a57ea68197495173d75732f5df328040
2014-12-08 23:04:27 +00:00
umherirrender
489d793882 Fixed spacing
- Added/removed spaces around parenthesis
- Added newline in empty blocks
- Added space after switch/foreach/function
- Use tabs at begin of line
- Add newline at end of file

Change-Id: I244cdb2c333489e1020931bf4ac5266a87439f0d
2014-12-05 22:28:07 +01:00
Aaron Schulz
0f5d3c7b92 Placed ProfilerStandard logic directly into SectionProfiler
* The former class should eventually be removed

Change-Id: I4e6df3bd0c7047f5f5110e7f115b1cf6fad0316e
2014-11-18 14:51:46 -08:00
Chad Horohoe
b8d93fb4fd Refactor profiling output from profiling
* Added a standard getFunctionStats() method for Profilers to return
  per function data as maps. This is not toolbar specific like getRawData().
* Cleaned up the interface of SectionProfiler::getFunctionStats() a bit.
* Removed unused cpu_sq, real_sq fields from profiler UDP output.
* Moved getTime/getInitialTime to ProfilerStandard.

Co-Authored-By: Aaron Schulz <aschulz@wikimedia.org>
Change-Id: I266ed82031a434465f64896eb327f3872fdf1db1
2014-11-17 19:26:04 -07:00
Aaron Schulz
0bfa6b6264 Move request-only template profiling to an always-on parser report
Change-Id: I0660c8d6cac0dadab648eac9736504b7939320f3
2014-11-12 18:06:00 -08:00