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

Upgrade XHProf to 2.3.5

XMLWordPrintable

    • MOODLE_400_STABLE
    • MOODLE_400_STABLE
    • MDL-71705-master
    • Hide

      Important note

      While looking to this issue I detected that there are some problems with this extension and PHP 8.0 and up (see https://github.com/tideways/php-xhprof-extension/issues/107). To workaround that, there are 2 alternatives:

      • Use PHP 7.4 / 7.3
      • Use the PECL xhprof extension instead of tideways one (not tested here!)

      Install the tideways_xhprof PHP extension

      Install the tideways extension for PHP7, see https://github.com/tideways/php-profiler-extension for Installation instructions. Or if you're on Ubuntu/LinuxMint, follow the instructions below

      Ubuntu/LinuxMint install instructions
      1. Update your system

        sudo apt update && sudo apt upgrade -y

      2. Download the precompiled tideways_xhprof extension installer for Debian-based systems:

        wget https://github.com/tideways/php-xhprof-extension/releases/download/v5.0.4/tideways-xhprof_5.0.4_amd64.deb

      3. Install the package

        sudo dpkg -i tideways-xhprof_5.0.4_amd64.deb
        

      4. Check your PHP version

        php -v
        

      5. Check the contents of /usr/lib/tideways_xhprof

        ls /usr/lib/tideways_xhprof

      6. Make sure that there is a .so file that matches your current PHP version. For example, if you're on PHP 7.4, then confirm that tideways_xhprof-7.4.so is available in that folder.
      7. Using your favourite editor, create a "tideways_xhprof.ini" under /etc/php/[YOUR_PHPVERSION]/mods-available. e.g. if you're on PHP 7.4 on LinuxMint with xed as the editor:

        sudo xed /etc/php/7.4/mods-available/tideways_xhprof.ini
        

      8. Paste the following line in tideways_xhprof.ini pointing to the path of the tideways_xhprof extension file matching your PHP version.

        extension=/usr/lib/tideways_xhprof/tideways_xhprof-7.4.so
        

      9. Enable the tideways_xhprof extension

        sudo phpenmod tideways_xhprof
        

      10. Install Graphviz. (This is required for generating the callgraph of the profiling run)

        sudo apt install graphviz
        

      11. Restart your webserver

        sudo service apache2 restart
        

      12. Check your phpinfo() page. Search for tideways_xhprof and confirm that it is present.

      Test

      1. Make sure "Developer mode" is turned on.
      2. Go to "Site administration / Development / Profiling"
      3. Tick "Enable profiling".
      4. Under "Profile these", enter "/index.php"
      5. Go to the "Site home".
      6. Scroll down to the bottom of the page. Confirm that there is a link named "This script has been profiled"
      7. Click the "This script has been profiled" link.
      8. Confirm that it loads okay.
      9. Click "Export this profiling run"
      10. Confirm that a .mpr file archive is downloaded containing XML files is generated (rename it to .zip and uncompress if needed).
      11. Click "View profiling details".
      12. Confirm that a table of function calls is displayed.
      13. Click on "View Full Callgraph"
      14. Confirm that the call graph is generated (can take a while, depending of the complexity of the request).
      Show
      Important note While looking to this issue I detected that there are some problems with this extension and PHP 8.0 and up (see https://github.com/tideways/php-xhprof-extension/issues/107 ). To workaround that, there are 2 alternatives: Use PHP 7.4 / 7.3 Use the PECL xhprof extension instead of tideways one (not tested here!) Install the tideways_xhprof PHP extension Install the tideways extension for PHP7, see https://github.com/tideways/php-profiler-extension for Installation instructions. Or if you're on Ubuntu/LinuxMint, follow the instructions below Ubuntu/LinuxMint install instructions Update your system sudo apt update && sudo apt upgrade -y Download the precompiled tideways_xhprof extension installer for Debian-based systems: wget https://github.com/tideways/php-xhprof-extension/releases/download/v5.0.4/tideways-xhprof_5.0.4_amd64.deb Install the package sudo dpkg -i tideways-xhprof_5.0.4_amd64.deb Check your PHP version php -v Check the contents of /usr/lib/tideways_xhprof ls /usr/lib/tideways_xhprof Make sure that there is a .so file that matches your current PHP version. For example, if you're on PHP 7.4, then confirm that tideways_xhprof-7.4.so is available in that folder. Using your favourite editor, create a " tideways_xhprof.ini " under /etc/php/ [YOUR_PHPVERSION] /mods-available. e.g. if you're on PHP 7.4 on LinuxMint with xed as the editor: sudo xed /etc/php/7.4/mods-available/tideways_xhprof.ini Paste the following line in tideways_xhprof.ini pointing to the path of the tideways_xhprof extension file matching your PHP version. extension=/usr/lib/tideways_xhprof/tideways_xhprof-7.4.so Enable the tideways_xhprof extension sudo phpenmod tideways_xhprof Install Graphviz. (This is required for generating the callgraph of the profiling run) sudo apt install graphviz Restart your webserver sudo service apache2 restart Check your phpinfo() page. Search for tideways_xhprof and confirm that it is present. Test Make sure " Developer mode " is turned on. Go to " Site administration / Development / Profiling " Tick " Enable profiling ". Under " Profile these ", enter " /index.php " Go to the " Site home ". Scroll down to the bottom of the page. Confirm that there is a link named " This script has been profiled " Click the " This script has been profiled " link. Confirm that it loads okay. Click " Export this profiling run " Confirm that a .mpr file archive is downloaded containing XML files is generated (rename it to .zip and uncompress if needed). Click " View profiling details ". Confirm that a table of function calls is displayed. Click on " View Full Callgraph " Confirm that the call graph is generated (can take a while, depending of the complexity of the request).
    • Moppies Kanban

      XHProf (/lib/xhprof/) 2.2.3 --> 2.3.5 : http://pecl.php.net/package/xhprof 
       

        1. image-2021-12-21-11-30-06-186.png
          42 kB
          Amaia Anabitarte
        2. image-2021-12-21-11-30-28-346.png
          231 kB
          Amaia Anabitarte
        3. image-2021-12-21-11-31-26-627.png
          137 kB
          Amaia Anabitarte

            ilyatregubov Ilya Tregubov
            sarjona Sara Arjona (@sarjona)
            Carlos Escobedo Carlos Escobedo
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Amaia Anabitarte Amaia Anabitarte
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 15 minutes
                2h 15m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.