Commit graph

60 commits

Author SHA1 Message Date
Aaron Schulz
630284a62a Added some sanity warnings to TransactionProfiler
* The use of $id should avoid any nesting, unless something is broken

Change-Id: I01941a186d1e74ddd6c4610b0eb9e15f54e28347
2014-06-27 11:40:50 -07:00
Aaron Schulz
a1bc02ec8b Include trx state in query profiling (and DBPerformance log)
* Replaced use of spl hash with random transaction IDs.
  These can be correlated better and make the DBPerformance
  log easier to make sense of. They are also shorter.

Change-Id: I5f49c0d0c26e37807341bbc83b1b41b124164419
2014-06-25 14:13:25 -07:00
Aaron Schulz
2dcf1395c5 Lowered the TransactionProfiler threshold
Change-Id: Id574e8d2b2a28cba3003d6a344a4afb0307699e3
2014-06-05 15:59:07 -07:00
Aaron Schulz
60e65d8d8d Made TransactionProfiler handle interlaced transactions better
* Previously the list of involved DBs might be incomplete

Change-Id: I75b91d3b9a951169038b40b9cf2f59707ba0c11d
2014-05-29 14:47:59 -07: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
Aaron Schulz
63b1f29d76 Fixed call to undefined method in TransactionProfiler
Change-Id: I855b514f8b63c7e81935b13df4612f09628142b3
2014-04-28 17:57:55 +00:00
umherirrender
23bb3d1cb4 Follow-Ups to "Fixed some @params documentation"
Fix of inline comments of the following patch sets:
Follow-Up: I0056b4a8df243cfc0c5f25378de48f7a35170aca
Follow-Up: I7f605aa9e117b5fd80d9b1440864fe526d2b14a5
Follow-Up: I3622f216a2ca8ac1b5e51892be9f98665f65bc36
Follow-Up: I6627ba0e76d3577c40bf2473e0f78a5ad7368634
Follow-Up: Id75b5ecf648ca50f955b3bde3307c82c4366b102
Follow-Up: I4ca5231119f33039d91da3b57a41cd40719a576b

Change-Id: Id9bbe84b2820e9db44af5783411e955f55f643d4
2014-04-23 13:39:49 +02:00
umherirrender
a3983418d5 Fixed some @params documentation (includes/*)
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.

Change-Id: I0056b4a8df243cfc0c5f25378de48f7a35170aca
2014-04-22 13:07:02 +02:00
Aaron Schulz
9c586d6361 More Profiler class refactoring
* Factored a ProfilerStandard class out of Profiler
* Profiler is now an abstract base class
* For b/c, using Profiler as the profiler switches to ProfilerStub
  to avoid trying to instantiate an abstract class
* Also factored out a small TransactionProfiler class
* Fixed fatal in "new ProfilerStub()" line in getInstance();
  Profiler has long since type hinted $params as an array
* Removed bogus debug var usage left in ProfilerMwprof::getRawData()
* Removed useless mTimeMetric stuff

Change-Id: I854dabba6c8b1fb7d92baca59ebd4af25878d11d
2014-04-21 10:54:51 -07:00
umherirrender
b45420410f Fixed some @params documentation (includes/*)
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.

Change-Id: Iced714bca004756b461b66067a49a925a7e3b877
2014-04-19 22:22:20 +02:00
Aaron Schulz
afa6af07d7 Profiler class refactoring
* Merged the "collate at end" and "running collate" logic
  into the base class to make it more unified and consistent.
* Pulled out DB code into ProfilerSimpleDB class.
* Removed the ProfilerSimple class and updated child classes.
* Made ProfilerSimpleTrace set the debug information too.
* Work around "ended by close()" bug from 99aef03f. Since the
  getRawData() method gets called while some wfProfileOut() calls
  have not yet happened, make it use the matched call data and let
  the final logData() method work on the full data as normal.
* Let ProfilerSimple classes use getFunctionReport() for the profiler
  debug log if it is setup instead of making it just return "".
* Made getRawData() work as best as possible with ProfilerMwprof.
* Removed $wgProfileToDatabase since it is now useless.
* Improved DB profile performance with sqlite.
* Updated visibility of various methods.

Change-Id: I1260bab2b5ba12dccbba701bcae4a637cb85c6e8
2014-04-14 16:46:55 +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
Alexandre Emsenhuber
811a084abf New 'profileerror' log group for profiling errors
Easier to catch them than if they are in the default debug log.

Added Profiler::debugGroup() as wrapper to wfDebugLog(), as
there already is Profiler::debug() for wfDebug(), so that
there won't be a fatal error if the error happens before the
inclusion of GlobalFunctions.php and converted other calls
to wfDebugLog() to use it.

Change-Id: Ie8481a2e13a94efa0248dd5a36b6b1a22811817e
2014-03-15 21:43:39 +01:00
umherirrender
0bc583af2c Move closing parenthesis from multi line if and function to own line
The Line continuation Coding conventions prefers the closing parenthesis
on the same line than the beginning curly braces. This is done for ifs
and functions.
Also move some boolean operator from the end of a line to the beginning
and changed some indentation to make the condition hopefully better
readable.

Change-Id: Id0437b06bde86eb5a75bc59eefa19e7edb624426
2013-12-01 21:39:00 +01:00
MatmaRex
df8ec1e216 No spaces after (casts)
Also removed some unnecessary ones. I think I've caught them all.

The spaceless version already appears in core ~300 times (after
accounting for false positives when grepping). Some consistency would
be nice.

Change-Id: I607655b5f4366e66dc78730d5fd2f57ed8776cae
2013-09-04 20:05:43 +02:00
Kevin Israel
0643e83df7 Profiler: remove unnecessary checks
Should slightly reduce overhead.

Change-Id: Iff71041f1cbc12b0d28f24752a01c63456cb9eaf
2013-08-25 22:46:55 +00:00
Aaron Schulz
138d5dc92c Typo fix
Change-Id: I778f1291cfcc1b6cc5441898607e4c1341c9f6df
2013-08-02 16:48:40 -07: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 Schulz
d2dcea586d Added a --profiler option to all maintenance scripts.
* This dumps profiling information in list or trace format as specified.
* Also optimized wfProfile* function like the ProfileSection class, which
  also plays better with Profiler::setInstance().
* Fixed fatals due to wfDebug() calls in Profiler::instance() due to that
  function not yet being loaded. The calls were simply removed.
* Cleaned up file performance test script a bit.

Change-Id: I6b8cd8b30fefc1904eeeeacada7a30a46f62fe2a
2013-05-23 14:20:51 -07:00
umherirrender
15ff79312d Fixed spacing and removed unneeded parenthesis
Added spaces after/before parenthesis
Removed unneeded parenthesis around some statements
Broke a long line

Change-Id: I7fbe129f7bbf524dd0598ece2a9708643f08453b
2013-05-17 16:12:08 +00:00
Tim Starling
1fe9340bb3 Remove hphpc support and deprecate related functions
hphpc has been superseded by hhvm, so support for hphpc is no longer
needed.

* Continue to use Preprocessor_Hash under HipHop since it is still
  faster under hhvm
* Keep $wgCompiledFiles for now, so that wikihiero doesn't give an error
  before Ic9d1e795 is merged
* Migrate the run-server script and associated configuration file to
  hhvm. Enable EnableStaticContentFromDisk since it doesn't seem
  ridiculously inefficient at first glance. Run from $IP rather than
  $IP/.. since hhvm is apparently not picky about sourcing files from
  outside of the current directory.

Change-Id: Ic3e769f1fbad4f7ad26dd819406796fee48c6b45
2013-05-09 08:28:05 +10:00
Aaron Schulz
32ac151803 Created ProfileSection class to avoid wfProfileOut() whack-a-mole.
Change-Id: I9f7e0638edd99e1ac07b83054e8f7ef255179281
2013-04-28 23:54:33 +00:00
umherirrender
6c38a5eb72 Fixed spacing in logging/parser/profiler/rl/revdel/search folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: I11bbcfa351e945b7bde10c2105d61a3cf5622205
2013-04-20 17:38:24 +02:00
umherirrender
97234cc884 Added spaces before and removed spaces after 'array'
Fix some other spacing while at it

Change-Id: I13f81533eaf40e06c13cf377c0f08ef5cef01d00
2013-04-14 21:57:46 +02:00
umherirrender
6c278b6d7e fix some spacing
* Removed spaces around array index
* Removed double spaces or added spaces to begin or end of function
  calls, method signature, conditions or foreachs
* Added braces to one-line ifs
* Changed multi line conditions to one line conditions
* Realigned some arrays

Change-Id: Ia04d2a99d663b07101013c2d53b3b2e872fd9cc3
2013-03-25 22:22:46 +00:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
umherirrender
d63121016d fix some spacing
Added/removed spaces around logical/arithmetic operator
Reduced multiple empty lines to one empty line
Removed wrong tabs before comments at end of line
Removed too many spaces in assigments

Change-Id: I2bba4e72f9b5f88c53324d7b70e6042f1aad8f6b
2013-03-07 17:53:21 +01:00
umherirrender
be90ce07b3 fix some spacing
Change-Id: I93f0a87ba7129bc336083e7289247d3150feb606
2013-02-04 19:54:07 +00:00
umherirrender
2e8da558ba fix some spacing
Change-Id: Id7eda67a43f9040117edd79fdbeb678f1c3a6da2
2013-01-26 22:11:09 +01:00
Aaron Schulz
0458ce38be Made the profilers that output text not break js.
Change-Id: I12377e7ac08203113e8d6650f57091a63ad1af27
2013-01-04 21:29:24 +00:00
Antoine Musso
cb60d72be1 misc style fix
* makes booleans lower case
* add spaces before open braces

Change-Id: Id88884e08bc23d7730361ee91646f54f5e16920b
2012-12-20 16:09:25 +01:00
Aaron Schulz
1da33a49a0 Removed references to DB ignoreErrors() function.
Change-Id: I9441d897d45bca189c17b8bcca4ea7b3469af8b0
2012-12-11 11:24:12 -08: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
e33b8c4083 Refactor Profiler to get the actual and initial time:
* Added $metric parameter to Profiler::getTime() and
  Profiler::getInitialTime() so that the time calculating method can be
  easily overriden
* Added 'cpu' time metric (for ProfilerSimple)
* Made Profiler::getInitialTime() protected so that it can be used by
  ProfilerSimple and ProfilerSimpleTrace

Change-Id: I12d1bcb43ec179396a3f8ed46ba4128412e2f65b
2012-03-29 14:31:30 +02:00
Alexandre Emsenhuber
c7df7ade69 * Added Profiler::addInitialStack() to separate definitions of local variables and insertion of the first stacks
* Use it in ProfilerSimple and call $this->profileOut() there to factorise common code

Change-Id: I2eb74088c6087a7c2dd32af1a1f600f327178c67
2012-03-23 16:25:22 +01:00
Sam Reed
2ec09c5165 More return documentation 2012-02-09 21:35:05 +00:00
Sam Reed
0a626db6e1 Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 19:29:36 +00:00
Alexandre Emsenhuber
6eb567c4bc Fix comment, Profiler::getFunctionReport() no longer logs data itself. 2012-02-08 15:23:09 +00:00
Alexandre Emsenhuber
36fe3f01e6 Make time of '-total' item correct if using 'user' time metric 2012-01-18 20:01:46 +00:00
Alexandre Emsenhuber
bddbb77e99 * Fix Profiler::getUserTime() to return a float and not string with space separated values since, was breaking difference calculation since PHP doesn't know how to make the difference of two strings :P
* Same when adding fake items in the stack after a profiling error
* Removed useless ProfilerSimple::getTime()
2012-01-15 11:42:36 +00:00
Chad Horohoe
70dc1f53fb Back-compat for $wgProfiler set as a class. Fix for r89206 2011-09-19 23:25:13 +00:00
Chad Horohoe
2c1bf9190c Another stupid newline, forgot to press save 2011-08-30 20:55:50 +00:00
Chad Horohoe
74e5de02f1 Fixes for r94158: newlines and minor debugging typo (more silly fixmes) 2011-08-30 20:55:29 +00:00
Chad Horohoe
3f4b661ac3 Various profiler tweaks:
* Add some debugging output to bad profiler config
* Make member variables all protected, nothing uses them outside of Profiler and its subclasses
* Allow setting $mProfilerID from the config
2011-08-10 15:35:03 +00:00
Alexandre Emsenhuber
890f361a3c Removed usage of error suppression operator 2011-07-07 17:25:35 +00:00
Tim Starling
173f4fe0b9 Fix for r89206, r89218: always supply constructor parameters 2011-05-31 23:50:11 +00:00
Antoine Musso
8292a848e7 Profiler can be constructed without param
Before that patch, we could see warnings such as:
  Missing argument 1 for Profiler::__construct(),
2011-05-31 17:18:15 +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