Moodle
  1. Moodle
  2. MDL-39733

Add support for exporting and importing profiling runs

    Details

    • Testing Instructions:
      Hide

      Requirements: The xhprof php extension must be installed. DB access is required.

      0) Ensure the the "profiling" table is empty.

      1) Logged in as admin, go to admin->development->profiling and enable: profilingenabled and profilingallowme.

      2) Go to admin->development->profiling runs

      3) You must see "Nothing to display" and also an "[Import] link.

      4) Follow the import link, drag the attached "test_admin.mpr" file and, as import prefix set "Imported!".

      5) You should get a "File "test_admin.mpr" imported successfully" message and get redirected back to the list of runs page, now showing 1 profiling run with url = "/admin/tool/profiling/index.php", date = current time and comment = "Imported!"

      6) Click on the date, then "View profiling details" and verify it shows, in a new tab/window, the standard xhprof report working as usual.

      7) Close the report tab/window.

      8) Try to import the same file again, you should end with error "Some problem happened importing the file "test_admin.mpr""

      9) Go to the frontpage. and add "?PROFILEME" to the URL. That will profile the frontpage.

      10) Go to admin->development->profiling runs. You should see a new run for "/index.php". Click on it and set the comment to "wow, comment", saving it. Then follow the "Export this profiling run" link.

      11) An automatic download should happen with a "md5hash.mpr" name. Rename it to "hello.zip". Unzip it. It contains 2 xml files, the "moodle_profiling_runs.xml" one and another "md5hash.xml" one.

      12) Try to import that profile run ("hello.zip"). It should fail because it already exists in the site.

      13) Empty the "profiling" table.

      14) Repeat 12) and now the profile should be imported without problem.

      15) You should see a new run for "/index.php". The default prefix "(I)" is applied to the comment "wow, comment". Click on it and follow the "View profiling details" link and verify it works as expected.

      Show
      Requirements: The xhprof php extension must be installed. DB access is required. 0) Ensure the the "profiling" table is empty. 1) Logged in as admin, go to admin->development->profiling and enable: profilingenabled and profilingallowme. 2) Go to admin->development->profiling runs 3) You must see "Nothing to display" and also an " [Import] link. 4) Follow the import link, drag the attached "test_admin.mpr" file and, as import prefix set "Imported!". 5) You should get a "File "test_admin.mpr" imported successfully" message and get redirected back to the list of runs page, now showing 1 profiling run with url = "/admin/tool/profiling/index.php", date = current time and comment = "Imported!" 6) Click on the date, then "View profiling details" and verify it shows, in a new tab/window, the standard xhprof report working as usual. 7) Close the report tab/window. 8) Try to import the same file again, you should end with error "Some problem happened importing the file "test_admin.mpr"" 9) Go to the frontpage. and add "?PROFILEME" to the URL. That will profile the frontpage. 10) Go to admin->development->profiling runs. You should see a new run for "/index.php". Click on it and set the comment to "wow, comment", saving it. Then follow the "Export this profiling run" link. 11) An automatic download should happen with a "md5hash.mpr" name. Rename it to "hello.zip". Unzip it. It contains 2 xml files, the "moodle_profiling_runs.xml" one and another "md5hash.xml" one. 12) Try to import that profile run ("hello.zip"). It should fail because it already exists in the site. 13) Empty the "profiling" table. 14) Repeat 12) and now the profile should be imported without problem. 15) You should see a new run for "/index.php". The default prefix "(I)" is applied to the comment "wow, comment". Click on it and follow the "View profiling details" link and verify it works as expected.
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull from Repository:
    • Pull 2.5 Branch:
    • Pull Master Branch:
    • Rank:
      50474

      Description

      It would be extremely useful to implement some simple format for exporting and importing profiling runs, enabling to share them between developers or to be stored for later comparisons.

        Activity

        Hide
        Eloy Lafuente (stronk7) added a comment - - edited

        Work in progress @ https://github.com/stronk7/moodle/compare/MDL-39733

        IMPL: export ui and backend. import ui.
        TODO: import backend.

        Show
        Eloy Lafuente (stronk7) added a comment - - edited Work in progress @ https://github.com/stronk7/moodle/compare/MDL-39733 IMPL: export ui and backend. import ui. TODO: import backend.
        Hide
        Rajesh Taneja added a comment -

        Putting this in backend backlog.

        Show
        Rajesh Taneja added a comment - Putting this in backend backlog.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Sending to integration. As far as it's 100% isolated from anything else, I think it's ok to apply it also to 25_STABLE, that would help to compare between versions.

        Show
        Eloy Lafuente (stronk7) added a comment - Sending to integration. As far as it's 100% isolated from anything else, I think it's ok to apply it also to 25_STABLE, that would help to compare between versions.
        Hide
        Sam Hemelryk added a comment -

        Thanks Eloy - I've integrated this now. Certainly useful for 2.5 so backported as well

        Show
        Sam Hemelryk added a comment - Thanks Eloy - I've integrated this now. Certainly useful for 2.5 so backported as well
        Hide
        Michael de Raadt added a comment -

        Test result: Successful.

        Tested in 2.5 and master.

        Well done, Eloy.

        Show
        Michael de Raadt added a comment - Test result: Successful. Tested in 2.5 and master. Well done, Eloy.
        Hide
        Damyon Wiese added a comment -

        This issue is fixed! Hurray! Hurray!
        Your issue is fixed, what a wonderful day!

        Cheers, Damyon

        Show
        Damyon Wiese added a comment - This issue is fixed! Hurray! Hurray! Your issue is fixed, what a wonderful day! Cheers, Damyon
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Getting rid of the "dev documentation required" label. Really i had not done this before because it's not clear for me if this should be in dev docs or in user docs. And it seems that none of them have a good candidate page for that.

        So, finally i just have added a paragraph @ http://docs.moodle.org/dev/Setting_up_xhprof_on_Moodle#Using_XHProf commenting the new feature and its potential uses.

        Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Getting rid of the "dev documentation required" label. Really i had not done this before because it's not clear for me if this should be in dev docs or in user docs. And it seems that none of them have a good candidate page for that. So, finally i just have added a paragraph @ http://docs.moodle.org/dev/Setting_up_xhprof_on_Moodle#Using_XHProf commenting the new feature and its potential uses. Ciao

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: