37 Commits

Author SHA1 Message Date
Eloy Lafuente (stronk7)
71bc684c41
MDL-79285 xhprof: Add support for optional "reducedata" parameter
This new parameter / property will decide if we want to reduce
the run data before processing it:
- By default it will be disabled in table mode.
- By default it will be enabled in graph mode.
- The defaults can be changed by adding reducedata=[0|1] in the URLs
- Once data reduction is enabled, it stays enabled while
  navigating within the xhprof reports.
2023-09-26 19:39:48 +02:00
Eloy Lafuente (stronk7)
8ef2974af1
MDL-79285 xhprof: Cover the new functions with unit tests
This covers the 2 new functions with unit tests:
- xhprof_topo_sort()
- reduce_run_data()

Note that the example graph used in the provider is the
one shown in the issue to explain the reduction procedure.
2023-09-26 19:39:47 +02:00
Eloy Lafuente (stronk7)
bc70bd69ed
MDL-79285 xhprof: Enable reducing runs data for quicker use
Here we are reducing the xhprof runs data by removing the
__Mustache==>__Mustache calls and all the orphaned data.

To save N iterations what we are doing is:

0. The information is "topologically" sorted, so we ensure that
   all the parents in the data are processed before the children.
   (this will help a lot when cleaning orphaned data, see below).
1. First pass, all the candidate (by regexp) calls are removed
   from the run data.
2. Second pass, all the orphaned information (calls that have
   ended losing his parent) are also removed, so data is consistent.
   Note that, normally we would need N passes to remove all the
   orphaned data (because each pass creates new orphan candidates),
   but, as far as we have ensured that the information is topologically
   sorted (see point 0 above), all this can be done in one unique pass.

TODO:
  - Add unit tests.
  - Enable some system to be able to decide which utilities we
    want to get the data reduced and which ones will continue
    using the complete data. Right now the reduction is being
    applied to all the utilities (both table and graph views).
  - Document the change and, if implemented, the way to select
    between complete/reduced data.
  - Consider adding some caching to speed-up the reduction process
    (some TODOs have been left in the code pointing to the critical
    points).
2023-09-26 19:39:47 +02:00
Stevani Andolo
bba2bf5ee6 MDL-76397 lib: Moodle customizations. 2023-05-23 11:14:06 +08:00
Stevani Andolo
ae0ea56f25 MDL-76397 lib: xhprof upgraded to 2.3.9 2023-05-23 11:14:06 +08:00
Ilya Tregubov
5e11de3af9 MDL-71705 libraries: Moodle customizations. 2021-12-09 14:19:33 +02:00
Ilya Tregubov
6f069f5272 MDL-71705 libraries: xhprof upgraded to 2.3.5 2021-12-09 14:08:31 +02:00
Tomo Tsuyuki
6581cb7137 MDL-70525 tool_profiling: Cannot import profiling file
Change type from int to integer to be able to have big numbers
2021-02-09 09:45:45 +11:00
Ilya Tregubov
db0f3ee517 MDL-70297 libraries: Moodle customizations. 2021-01-19 09:47:13 +02:00
Ilya Tregubov
602498c5e4 MDL-70297 libraries: xhprof upgraded to 2.2.3 2021-01-19 09:31:19 +02:00
Brendan Heywood
7f97d1181d MDL-67081 xhprof: Allow conditional profiling from CLI using env vars 2020-11-13 14:01:38 +11:00
Brendan Heywood
60dc024201 MDL-65349 xhprof: Removed greedy matching from wildcard parsing 2019-10-23 11:08:27 +11:00
Brendan Heywood
097616f8ac MDL-64543 profiling: Fixed code warning error 2019-04-11 12:02:43 +10:00
Brendan Heywood
504198780e MDL-64543 profiling: Add ability to auto profile only slow scripts 2019-03-14 11:44:25 +11:00
Paul Greidanus
05f6ed0034 MDL-63031 administration: Allow plugins to define trace storage
This will allow the use of other storage systems implemented
in plugins.
It also allows for disabling the built in DB based profiling, which
will be useful when using an external target to not waste DB storage.
2018-08-13 21:54:48 -06:00
Andrew Nicols
3dd3ed3af2 MDL-62280 xhprof: Support tideways_xhprof 2018-05-01 11:02:27 +08:00
Marina Glancy
a56889c800 MDL-60313 libraries: patch xhprof for PHP 7.2 2017-10-02 18:51:39 +08:00
Marina Glancy
ffb41a8f8f MDL-60313 libraries: xhprof upgraded to 0.9.4 2017-10-02 18:41:55 +08:00
David Monllao
8beee5a449 MDL-55921 profiling: Adding missing vars 2016-09-14 13:48:38 +10:00
Russell Smith
ff3b8f6c89 MDL-55921 profiling: Enable util script to be profiled.
Enable util scripts to be profiled again and ensure
that non-util script runs that don't include version.php
are also able to provide some output.

See David's commit for how export ensures version is used.
2016-09-14 13:48:15 +10:00
David Monllao
30fbc3ecab MDL-55504 profiling: No profiling for PHPUNIT_UTIL stuff 2016-09-08 15:32:46 +08:00
Russell Smith
8f7dcb3453 MDL-55504 profiling: Support for PHPUnit and big profiles.
To support PHPUnit we need to support large profiles, these may
include backups and restores. To do that the following was required;
- gzcompress for database space saving.
- gzcompress for XML DomDocument field to say < 10Mb and allow imports.
- Save PHPUnit runs directly to a file so they can be imported to the normal database.
- Memory allowance on profiling view pages increases to support large profiles.
2016-09-06 12:41:56 +10:00
Russell Smith
bdca62ac6d MDL-55292 performance: Allow Tideways profiler extension.
PHP7 doesn't have any default XHProf support and all other
investigated forks don't have stable PHP7.  Tideways is under
active development and is easy to install.  The data format
is compatible with XHProf so it is a drop-in replacement in that way.
2016-08-04 21:10:03 +10:00
Russell Smith
116094595d MDL-53323 profiling: Close session as early as possible. 2016-03-03 12:45:16 +11:00
Russell Smith
ba194bdf2b MDL-41068 profile: Repair profiling after box API change
The box API was used with an extra incorrect parameter
in the profiling code.  It worked without issue until
the introduction of error checking in MDL-40842.  It
has failed since then.
2013-08-07 19:02:56 +10:00
Russell Smith
5f052b571f MDL-40793 profiling: Allow multiple reference runs in display 2013-07-22 12:12:58 +10:00
Eloy Lafuente (stronk7)
2e746b72be MDL-39733 xhprof: implement import of runs 2013-07-02 00:28:47 +02:00
Eloy Lafuente (stronk7)
2e07539699 MDL-39733 profiling: UI for importing runs 2013-06-28 04:46:40 +02:00
Eloy Lafuente (stronk7)
1d3d4d1376 MDL-39733 profiling: UI for exporting runs 2013-06-28 04:46:40 +02:00
Eloy Lafuente (stronk7)
e36a3e3643 MDL-39733 xhprof: implement export of runs 2013-06-28 04:46:39 +02:00
Eloy Lafuente (stronk7)
6919693cd6 MDL-38161 Upgrade xhprof to 02-2013 commits
Note this continues being version 0.9.2 and
only a few changes have landed since 3y ago.
(the important stuff is in the xhprof extension,
not in this UI package using it)
2013-02-22 02:05:04 +01:00
Adrian Greeve
b0c6dc1cac MDL-34465 - lib - Replacing get_context_instance with context_XXXX::instance (group 8) 2012-07-27 10:10:46 +08:00
Petr Skoda
187536f6c4 MDL-29029 move profiling to admin tools
AMOS BEGIN
 MOV [calls,report_profiling],[calls,tool_profiling]
 MOV [cannotfindanyrunforurl,report_profiling],[cannotfindanyrunforurl,tool_profiling]
 MOV [cannotfindanyrunforrunid,report_profiling],[cannotfindanyrunforrunid,tool_profiling]
 MOV [comment,report_profiling],[comment,tool_profiling]
 MOV [differencesbetween2runsof,report_profiling],[differencesbetween2runsof,tool_profiling]
 MOV [executiontime,report_profiling],[executiontime,tool_profiling]
 MOV [cputime,report_profiling],[cputime,tool_profiling]
 MOV [lastrunof,report_profiling],[lastrunof,tool_profiling]
 MOV [markreferencerun,report_profiling],[markreferencerun,tool_profiling]
 MOV [memory,report_profiling],[memory,tool_profiling]
 MOV [pluginname,report_profiling],[pluginname,tool_profiling]
 MOV [profilingfocusscript,report_profiling],[profilingfocusscript,tool_profiling]
 MOV [profilingruns,report_profiling],[profilingruns,tool_profiling]
 MOV [profilingrunsfor,report_profiling],[profilingrunsfor,tool_profiling]
 MOV [referencerun,report_profiling],[referencerun,tool_profiling]
 MOV [runid,report_profiling],[runid,tool_profiling]
 MOV [summaryof,report_profiling],[summaryof,tool_profiling]
 MOV [viewdetails,report_profiling],[viewdetails,tool_profiling]
 MOV [viewdiff,report_profiling],[viewdiff,tool_profiling]
 MOV [viewdiffdetails,report_profiling],[viewdiffdetails,tool_profiling]
AMOS END
2011-09-17 10:20:51 +02:00
Eloy Lafuente (stronk7)
68fabb5c7e MDL-27481 profiling - prevent data to be sent to DB before it is available 2011-05-12 02:04:13 +02:00
Eloy Lafuente (stronk7)
54fb7e80fc MDL-27034 profiling - xhprof_table_sql improvement 2011-04-07 00:46:54 +02:00
Eloy Lafuente (stronk7)
c646dd26ea MDL-26891 profiling - earlier runs
This allows profiling to be started earlier in the
setup.php execution, by configuring everything in
the config.php file. That way some interesting code
is also profiled, like DB connections, load of config records...

100% compatible with normal profiling and enabled via
special setting $CFG->earlyprofilingenabled

Example (to be put on config.php):

$CFG->earlyprofilingenabled = true;
$CFG->profilingautofrec = 3;
$CFG->profilingincluded = '/*';
$CFG->profilingallowme = true;

(to enable early profiling for 1/3 of any requests while also
allowing to use the PROFILEME PGC)
2011-03-30 18:08:38 +02:00
Eloy Lafuente (stronk7)
6af80cae01 MDL-24600 profiling - add xhprof integration 2010-12-20 21:41:45 +01:00