Commit graph

27 commits

Author SHA1 Message Date
Chad Horohoe
b0dad16ea9 ProfileStub: Remove getCurrentSection(), unused
No callers, no implementations in other Profiler classes

Change-Id: I5b5364d5b40964944e1595056b4c292610fcdf36
2016-07-20 20:48:28 +00:00
Aaron Schulz
016fd0b776 Refactored entry points to have uniform shutdown handling
* Added doPreOutputCommit() and doPostOutputShutdown(),
  which most entry points just using the later
* Also fixed problem where text profiling did not show up
* Avoid calling triggerJobs() in the file streaming
  entry points

Bug: T100127
Bug: T100085
Change-Id: Ibc7e768fd483389a01847f08cdeba4058c853d3f
2015-05-29 20:40:46 +00:00
Ori Livneh
1b6f70089d Introduce ProfilerOutputStats
* Associate Profiler objects with a request context by adding a $context
  property with a getter and a setter.
* Introduce ProfilerOutputStats, which writes profiling data to the stats
  buffer associated with the current request context.
* Make it the Profiler class's responsibility to enforce $wgProfilerLimit.
* Deprecate $wgProfilerLimit in favor of the (more aptly named, IMO)
  $wgProfiler['threshold'] config setting.
* Tidy up Profiler instance creation code in Profiler::instance().
* Add Profiler::getOutputs, which returns an array of ProfilerOutput instances
  which are configured for the current profiler and whose canUse() method
  returns true.
* Make ProfilerStub not log by creating a stub ProfilerStub::logData() method
  which does not call the parent. Previously the parent class checked if $this
  was an instance of ProfilerStub and returned early if so.

Task: T90623
Task: T85641
Change-Id: Icf644ad3435c1f30d0a49957a97b481808a3153d
2015-04-02 01:32:46 +00:00
Aaron Schulz
5012ac6c6a Made ProfilerStub return null instead of a dummy ScopedCallback
* This can happen well over 10k times per request due to the message
  hooks. Avoiding the object construction seems prudent.

Change-Id: I45ff7b8c10851f15a25cbea9a2df3669ec21dbd3
2015-03-25 20:50:41 -07:00
Aaron Schulz
4236b9beb6 Made profileIn/profileOut methods a no-op
Change-Id: I781f62be9747bb41af6faad6fbe265414fb77669
2015-01-08 01:54:51 -08: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
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
dcd639f9f9 Switched hook profiling to use scopedProfileIn
* Also made scopedProfileOut handle the case where the callback
  was null (e.g. when there are no frame methods for xhprof).

Change-Id: Ife242bda8e046990d0d8ac27d628975b7b4a14d7
2014-12-04 19:32:38 +00:00
Chad Horohoe
52f3b13312 Remove Profiler::isStub()
Just check for ProfilerStub directly.

Change-Id: I503916599f182df4206da5282193ae6ec9324ee6
2014-12-03 20:19:56 -08:00
Aaron Schulz
240152117c Added custom frame support to Profiler
* Made use of it in the DatabaseBase classes
* For the xhprof class, this only works in HHVM for now

Change-Id: I95d7cc128d4a770328fbdd2b546972d3fc2e2e8a
2014-11-25 14:52:21 -07: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
Chad Horohoe
4fa6c46c94 Remove per-template profiling
Creates absurd dependency on the profiler from the parser. This profiling
is also not compatible with function-level profiling that we're trying to
aim for with xhprof.

Change-Id: I3c780fcb06e3470a0cbf50311ba916a0b67ea49e
2014-11-12 18:18:30 -08:00
Aaron Schulz
671bcd8d27 Changed TransactionProfiler to only work via the DB classes
* This makes it work with xhprof/xdebug, though it will only examine DB queries.

Change-Id: I999b66e6c3af88dda408b2252c248e085af9eea4
2014-11-06 10:30:51 -08:00
Siebrand Mazeland
1c0980ebb0 Pass phpcs-strict on includes/profiler/
Change-Id: Ic9058a650ea0735b71b3725703d76cc62b5c9fb1
2014-05-10 10:45:53 +02:00
Aaron Schulz
28bed62ae6 Made TransactionProfiler handle nested transactions to the same server/DB
Change-Id: Ie4dfd4af88a9da76c76b21053bbd125c6ad3b193
2014-05-01 19:38:39 +00:00
Erik Bernhardson
99aef03f04 Visualize profile output in debug toolbar
This adds a new pane for the debug toolbar labeled Profiler.  It groups
together events sent to wfProfileIn/Out and draws a timeline giving a
visual representation of what the page was doing at a particular point
in time. Hovering over a timeline brings up a flyout about the contained
events.

Depends on I08854d80f57286129f19cb14566f84ed3c7fa21c for proper positioning
of the flyout.

Change-Id: I23a0ce4137abcd74ad87967fb263214c08cb9685
2014-04-02 21:53:51 +00:00
Aaron Schulz
797d5f19c4 profiler: log slow methods that worsen DB locks in transactions
Change-Id: I1aa13c29837fa655c13ef324d02cd1be1739edea
2013-07-19 03:46:55 +00:00
Aaron
691318d0eb Only use per-template profiling for one-time profiling output.
Change-Id: Ib89ce14310ccac529684f0ada71f60744319eb3e
2012-05-05 00:34:50 +01:00
Alexandre Emsenhuber
e7ab34cf1d Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: If65d7313e1e05163ce6cc46d17daa310cb41888c
2012-04-28 20:41:55 +02:00
Alexandre Emsenhuber
e7b1979681 Added overrides of logData() and getCurrentSection() in ProfilerStub; just in case. 2012-02-04 14:51:01 +00:00
Tim Starling
a0123d0549 * Made the profiler work in HipHop:
** Don't try to set a global variable in the same file as a class definition (Profiler.php). Set it in WebStart.php instead.
** In StartProfiler.sample, don't use require_once() to get ProfilerStub.

* Removed the setproctitle() stuff from ProfilerStub, the extension is not maintained and doesn't work with Apache 2.x
* Added an optimisation to wfProfileIn() and wfProfileOut() to reduce the overhead when profiling is not enabled
* Added the ability to configure in StartProfiler.php whether CPU time or wall-clock time is used, avoiding recompilation
2011-05-31 06:05:05 +00:00
Alexandre Emsenhuber
21e53d3590 * Added Profiler::isStub() to check if we are using a stub profiler, instead of checking whether $wgProfiler is set
* Replaced wfProfileClose() and wfGetProfilingOutput() by direct calls to the Profiler instance and removed them, no uses in extensions
* Also removed useless params from Profiler::getOutput() call in wfLogProfilingData()
* Only generate profiling output if it'll be used; introduced Profiler::logData() that saves profiling data (database, udp, ...) to separate it from output generation
* Removed unused Profiler::getCaller(), not used at all, and we have wfGetCaller() that does the same thing
2011-04-21 16:31:02 +00:00
Chad Horohoe
248ff9031e method signatures, E_STRICT, blah blah blah 2011-04-16 21:59:01 +00:00
Chad Horohoe
5a6d1ee2d3 More profiler cleanup:
* Move autoloader up a little bit so the profiler classes can use it
* Make Profiler into a singleton so it's lazy-constructed, $wgProfiler is now a configuration array (used 'visible' in ProfilerSimpleText as an example of other globals we can move into this array). If $wgProfiler is set to an object, it'll use that for back-compat
* Maintenance: rather than setting up the profiler and then disabling it, just disable it from the start
* Kill $wgProfiling -> now that ProfilerStub overrides profileIn() and profileOut(), it's not needed
* dumpHTML needs some fixes still
2011-04-16 19:00:54 +00:00
Chad Horohoe
e376ee65f7 First step of reorganizing profiling files:
* Move them all to includes/profiling/* - If you're using StartProfiler, you'll need to update that
* Make ProfileStub subclass the Profiler rather than duplicating function definitions conditionally
* Removed unused params to wfGetProfilingOutput(), only used in the stub, and they didn't do anything with them
* TODO: Kill $wgProfiling, make $wgProfiler a config array and move the various options to that. Also make into a singleton, rather than global (not much calls it outside of core)
2011-04-16 02:19:40 +00:00
Sam Reed
035218f403 Revert r74913, caused many problems, and was only likely to cause more in the future 2010-10-17 21:18:04 +00:00
Sam Reed
47b13d184c Move profiler stuff to own folder, updater AutoLoader to match
ProfilerSimpleTrace isn't in AutoLoader. Neither is ProfilerStub

Profiler also says " * This file is only included if profiling is enabled"...
2010-10-17 19:04:05 +00:00
Renamed from includes/ProfilerStub.php (Browse further)