Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-63031

Allow plugins to process profiling data via a callback

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.6
    • Fix Version/s: 3.6
    • Component/s: Administration
    • Labels:
    • Testing Instructions:
      Hide

      An extremely crude plugin has been built to test this:

      https://github.com/prg3/moodle_profilestorefile

      1. Install in local/profilestorefile
      2. Add "$CFG->disableprofilingtodatabase = True;" to config.php
      3. mkdir /tmp/output
      4. chmod 777 /tmp/output
      5. Enable profiling for all pages in Moodle (reference: https://docs.moodle.org/dev/Profiling_PHP
        • Clone the tideyways xhprof repo (git@github.com:tideways/php-xhprof-extension.git)
        • Run the following to build the extension:

          phpize
          ./configure
          make
          

        • Copy the 'modules/tideways_xhprof.so' into the same directory as the rest of your php extensions, probably something like /usr/lib/php/xxx.
        • Modify your php.ini (for apache) adding the line 'extension=tideways_xhprof.so'
        • Restart apache (sudo service apache2 restart)
        • In Moodle, search profiling in admininstration, and enable it. For 'Profile these' enter just * and save the page.
      6. Now, visit some pages in your moodle site.
      7. Verify that you can see the /tmp/output/ directory fill up with json encoded files.
      8. Now, inspect the moodle db directly (shell, pgadmin, whatever you prefer to use)
      9. Verify that executing the following SQL, returns 0:

        select count(*) from mdl_profiling;

      Show
      An extremely crude plugin has been built to test this: https://github.com/prg3/moodle_profilestorefile Install in local/profilestorefile Add "$CFG->disableprofilingtodatabase = True;" to config.php mkdir /tmp/output chmod 777 /tmp/output Enable profiling for all pages in Moodle (reference: https://docs.moodle.org/dev/Profiling_PHP )  Clone the tideyways xhprof repo (git@github.com:tideways/php-xhprof-extension.git) Run the following to build the extension: phpize ./configure make Copy the 'modules/tideways_xhprof.so' into the same directory as the rest of your php extensions, probably something like /usr/lib/php/xxx. Modify your php.ini (for apache) adding the line 'extension=tideways_xhprof.so' Restart apache (sudo service apache2 restart) In Moodle, search profiling in admininstration, and enable it. For 'Profile these' enter just * and save the page. Now, visit some pages in your moodle site. Verify that you can see the /tmp/output/ directory fill up with json encoded files. Now, inspect the moodle db directly (shell, pgadmin, whatever you prefer to use) Verify that executing the following SQL, returns 0: select count(*) from mdl_profiling;
    • Affected Branches:
      MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-63031-master

      Description

      It would be very useful for the profiling data to be saved somewhere outside of the database, so adding a callback that allows plugin writers to process this data however they see fit.

      Also, add a wrapper around the default DB commit to disable pushing data into the DB when using alternate export strategies.

        Attachments

          Activity

            People

            • Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                3/Dec/18