Aaron Schulz has submitted this change and it was merged.

Change subject: Enabled 1:1 profiling for cli scripts and put "cli" in the 
profile ID.
......................................................................


Enabled 1:1 profiling for cli scripts and put "cli" in the profile ID.

Change-Id: Ic9869df24c0f4761ac3df171a78f4c032c83b754
---
M wmf-config/StartProfiler.php
1 file changed, 4 insertions(+), 8 deletions(-)

Approvals:
  Aaron Schulz: Verified; Looks good to me, approved



diff --git a/wmf-config/StartProfiler.php b/wmf-config/StartProfiler.php
index 23c88ca..6e16fe0 100644
--- a/wmf-config/StartProfiler.php
+++ b/wmf-config/StartProfiler.php
@@ -17,22 +17,18 @@
        $wgProfiler = new ProfilerSimpleUDP( array() );
        $wgProfiler->setProfileID( 'test2' );
 # Normal case: randomly selected for logged profiling sample
-} elseif ( ( mt_rand( 0, 0x7fffffff ) % 50 ) == 0 ) {
+} elseif ( PHP_SAPI == 'cli' || ( mt_rand( 0, 0x7fffffff ) % 50 ) == 0 ) {
        require_once( $IP . '/includes/profiler/ProfilerSimpleUDP.php' );
        $wgProfiler = new ProfilerSimpleUDP( array() );
        // $IP is something like '/usr/local/apache/common-local/php-1.19'
        $version = str_replace( 'php-', '', basename( $IP ) );
-       if ( strpos( @$_SERVER['REQUEST_URI'], '/w/thumb.php' ) !== false ) {
+       if ( PHP_SAPI == 'cli' ) {
+               $wgProfiler->setProfileID( "cli-$version" );
+       } elseif ( strpos( @$_SERVER['REQUEST_URI'], '/w/thumb.php' ) !== false 
) {
                $wgProfiler->setProfileID( "thumb-$version" );
        } else {
                $wgProfiler->setProfileID( $version );
        }
-       /*
-       if ( PHP_SAPI == 'cli' ) {
-               $wgProfiler->setProfileID( 'cli' );
-       } else {
-               $wgProfiler->setProfileID( 'all' );
-       }*/
        # $wgProfiler->setMinimum(5 /* seconds */);
 # WTF is this for?
 } elseif ( defined( 'MW_FORCE_PROFILE' ) ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/59425
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic9869df24c0f4761ac3df171a78f4c032c83b754
Gerrit-PatchSet: 3
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Denny Vrandecic <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to