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

Upgrade XHProf to 2.3.9

XMLWordPrintable

    • MOODLE_403_STABLE
    • MDL-76397-master
    • Hide

      Copied form MDL-71705

      Important note

      === I am using mac so did not get the chance to test on linux ===

      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 dot and put the path in the config.php

        $CFG->pathtodot = '/opt/local/bin/dot';

      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.

      Mac install instructions

      1. Start the apple font if you encounter error regarding apple font

        sudo launchctl load -w /System/Library/LaunchAgents/com.apple.fontd.useragent.plist

      2. Restart your webserver

        brew services restart httpd 

      3. Make sure xhprof is enabled by going to "admin/phpinfo.php"

      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
      Copied form MDL-71705 Important note === I am using mac so did not get the chance to test on linux === 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 dot and put the path in the config.php $CFG->pathtodot = '/opt/local/bin/dot'; 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. Mac install instructions Start the apple font if you encounter error regarding apple font sudo launchctl load -w /System/Library/LaunchAgents/com.apple.fontd.useragent.plist Restart your webserver brew services restart httpd Make sure xhprof is enabled by going to "admin/phpinfo.php" 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).
    • 6
    • Team Hedgehog 2023 Sprint 1.4, Team Hedgehog 2023 Sprint 2.0, Team Hedgehog 2023 Sprint 2.1

      XHProf (/lib/xhprof/) 2.3.5 --> 2.3.9 : https://github.com/longxinH/xhprof/tags 

        1. MDL-76397_step08.png
          MDL-76397_step08.png
          79 kB
        2. MDL-76397_step10.png
          MDL-76397_step10.png
          19 kB
        3. MDL-76397_step12.png
          MDL-76397_step12.png
          284 kB
        4. MDL-76397_step14.png
          MDL-76397_step14.png
          17 kB
        5. xhprof.mov
          30.18 MB
        6. xhprof 2.3.8 - PHP74 & PHP80.png
          xhprof 2.3.8 - PHP74 & PHP80.png
          62 kB
        7. xhprof 2.3.8 - PHP81.png
          xhprof 2.3.8 - PHP81.png
          84 kB

            stevani.andolo@moodle.com Stevani Andolo
            Daniel Ziegenberg Daniel Ziegenberg
            Raquel Ortega Raquel Ortega
            Andrew Lyons Andrew Lyons
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 2 hours, 31 minutes
                1d 2h 31m

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