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

Support selective xhprof / tideways profiling of cli scripts using env vars

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      1) Enable the php-tideways extension and restart apache:

      sudo apt-get install php-tideways
      sudo phpenmod tideways
      sudo service apache2 restart 

      2) Enable profiling generally $CFG->profilingenabled = 1;

      3) Enable selective profiling $CFG->profilingallowme = 1;

      4) Run a random cli script:

       php admin/cli/purge_caches.php

      5) Confirm that no profile is made in /admin/tool/profiling/index.php (just visit the page and nothing should be listed there yet)

      6) Run the same script with an env var set:

       PROFILEME=1 php admin/cli/purge_caches.php

      7) Confirm that a profile is made in /admin/tool/profiling/index.php 
      8) You may wish to then disable the profiling extension

      sudo phpdismod tideways
      sudo service apache2 restart 

       

      Show
      1) Enable the php-tideways extension and restart apache: sudo apt-get install php-tideways sudo phpenmod tideways sudo service apache2 restart 2) Enable profiling generally $CFG->profilingenabled = 1; 3) Enable selective profiling $CFG->profilingallowme = 1; 4) Run a random cli script: php admin/cli/purge_caches.php 5) Confirm that no profile is made in /admin/tool/profiling/index.php (just visit the page and nothing should be listed there yet) 6) Run the same script with an env var set: PROFILEME= 1 php admin/cli/purge_caches.php 7) Confirm that a profile is made in /admin/tool/profiling/index.php  8) You may wish to then disable the profiling extension sudo phpdismod tideways sudo service apache2 restart  
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_311_STABLE
    • Fixed Branches:
      MOODLE_311_STABLE
    • Pull Master Branch:
      MDL-67081-profile-cli

      Description

      eg set the env var of PROFILEME and then fire the cli off in the same way as the web.

       

        Attachments

          Activity

            People

            Assignee:
            brendanheywood Brendan Heywood
            Reporter:
            brendanheywood Brendan Heywood
            Integrator:
            Jake Dallimore
            Tester:
            Janelle Barcega
            Participants:
            Component watchers:
            Matteo Scaramuccia, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              10/May/21

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 11 minutes
                1h 11m