-
Functional Test
-
Minor
-
None
-
Original - DO NOT REPORT TEST RESULTS HERE
Requisites:
- To have the xhprof or tideways php extension installed and available.
- To have the "dot" executable available.
Settings:
- Instead of doing that from the admin UI, put these lines in your config.php:
$CFG->debug = 32767; |
$CFG->earlyprofilingenabled = true; |
$CFG->profilingenabled=true; |
$CFG->profilingautofrec = 5; |
$CFG->profilingincluded = '/*view.php,/*index.php'; |
$CFG->profilingallowme = true; |
$CFG->profilingallowall = true; |
$CFG->pathtodot = '/path/to/your/executable/dot'; |
Testing:
- Log in as an admin.
- Reload the front page around 10-20 times (or navigate around different index.php and view.php files) and look to the footer. Randomly (the settings above define one frequency of 1/5) you will see the message "This script has been profiled".
- Go to various pages of moodle (course/view, participant list, backup...) and add the "PROFILEME" param to the URL (don't forget the & if needed). That will force profiling and you'll see the "This script has been profiled" always the param is used.
- Go to any index.php or view.php page and add the "DONTPROFILEME" to the URL (don't forget the & if needed). Reload 10-20 times and verify that the page isn't ever profiled (looking to footer).
- Go to config.php and delete/comment this line (because next steps do not work with early profiling enabled):
$CFG->earlyprofilingenabled = true;
- To any URL add the "PROFILEALL" param (don't forget the & if needed). From that moment ALL the pages you visit will be profiled. All.
- To any URL add the "PROFILEALLSTOP". All the pages won't be profiled anymore (only the 20% random profiling tested in 2) will continue happening).
- Go to admin -> development -> profiling runs.
- There you will see a bunch of profiled scripts (from the previous tests). They are sorted by date.
- Click on the date of any of them and then "View profiling details". You should get a new window/tab with the xhprof report.
- Verify it works by navigating, sorting, searching for some function...
- Don't forget to verify the graph works ([View Full Callgraph] link). This step requires "dot" to be available. By default it shows a png graph. Try adding "&type=svg" to the URL manually. If your browser supports svg, you will get the graph in that format.
- Go to admin -> development -> profiling runs again.
- Click on the "arrow" of any script having multiple profiling runs. You will get a page with the runs for that URL only.
- Pick some of the older runs by clicking on its date.
- In the page, tick the "Mark as reference run/comment" and set it's name as "base testing run". Save changes.
- In the breadcrumb, click the rightmost url, you will be back to the list of profiling runs for that url (same than 14) above).
- Verify that the run you have edited is shown in bold and with comment "base testing run".
- Click on any newer run. Now you should see 2 options: "View profiling details" and "View profiling differences with:" which shows the base testing run. Click the Run ID of the Base testing run.
- You get a new page with the summary of differences between the 2 runs, the "base" on the left, the newer on the right, with some green/red differences.
- Click the "View profiling diff details". You should get a new window/tab with the xhprof report showing all the diffs for each function.
- Verify it works by navigating, sorting, searching for some function...
- You can try the "View improvements/regressions callgraph", but be noted it's huge and complex to be generated and a timeout may happen. Don't fail this because of that.
- 2 dozens of testing points to verify it works, thanks!