jenkins-bot has submitted this change and it was merged.

Change subject: Profile command line scripts the new way
......................................................................


Profile command line scripts the new way

Change-Id: I166e040b41439886e182809208ad0da0a4a63573
---
M WebVideoTranscode/WebVideoTranscodeJob.php
1 file changed, 12 insertions(+), 9 deletions(-)

Approvals:
  Gilles: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/WebVideoTranscode/WebVideoTranscodeJob.php 
b/WebVideoTranscode/WebVideoTranscodeJob.php
index 1bd3cb1..44aaaea 100644
--- a/WebVideoTranscode/WebVideoTranscodeJob.php
+++ b/WebVideoTranscode/WebVideoTranscodeJob.php
@@ -382,10 +382,8 @@
                $this->output( "Running cmd: \n\n" .$cmd . "\n" );
 
                // Right before we output remove the old file
-               wfProfileIn( 'ffmpeg_encode' );
                $retval = 0;
                $shellOutput = $this->runShellExec( $cmd, $retval );
-               wfProfileOut( 'ffmpeg_encode' );
 
                if( $retval != 0 ){
                        return $cmd .
@@ -668,10 +666,8 @@
 
                $this->output( "Running cmd: \n\n" .$cmd . "\n" );
 
-               wfProfileIn( 'ffmpeg2theora_encode' );
                $retval = 0;
                $shellOutput = $this->runShellExec( $cmd, $retval );
-               wfProfileOut( 'ffmpeg2theora_encode' );
 
                // ffmpeg2theora returns 0 status on some errors, so also check 
for file
                if( $retval != 0 || !is_file( $outputFile ) || filesize( 
$outputFile ) === 0 ){
@@ -691,11 +687,15 @@
         * @param $retval String, refrence variable to return the exit code
         * @return string
         */
-       public function runShellExec( $cmd, &$retval){
+       public function runShellExec( $cmd, &$retval ){
                global $wgTranscodeBackgroundTimeLimit,
                        $wgTranscodeBackgroundMemoryLimit,
                        $wgTranscodeBackgroundSizeLimit,
                        $wgEnableNiceBackgroundTranscodeJobs;
+
+               // For profiling
+               $caller = wfGetCaller();
+
                // Check if background tasks are enabled
                if( $wgEnableNiceBackgroundTranscodeJobs === false ){
                        // Directly execute the shell command:
@@ -704,7 +704,8 @@
                                "memory" => $wgTranscodeBackgroundMemoryLimit,
                                "time" => $wgTranscodeBackgroundTimeLimit
                        );
-                       return wfShellExec( $cmd . ' 2>&1', $retval , array(), 
$limits );
+                       return wfShellExec( $cmd . ' 2>&1', $retval , array(), 
$limits,
+                               array( 'profileMethod' => $caller ) );
                }
 
                $encodingLog = $this->getTargetEncodePath() . '.stdout.log';
@@ -728,7 +729,7 @@
                        return $errorMsg;
                } elseif ( $pid == 0) {
                        // we are the child
-                       $this->runChildCmd( $cmd, $retval, $encodingLog, 
$retvalLog);
+                       $this->runChildCmd( $cmd, $retval, $encodingLog, 
$retvalLog, $caller );
                        // dont remove any temp files in the child process, 
this is done
                        // once the parent is finished
                        $this->targetEncodeFile->preserve();
@@ -748,8 +749,9 @@
         * @param $retval
         * @param $encodingLog
         * @param $retvalLog
+        * @param string $caller The calling method
         */
-       public function runChildCmd( $cmd, &$retval, $encodingLog, $retvalLog ){
+       public function runChildCmd( $cmd, &$retval, $encodingLog, $retvalLog, 
$caller ){
                global $wgTranscodeBackgroundTimeLimit,
                        $wgTranscodeBackgroundMemoryLimit,
                        $wgTranscodeBackgroundSizeLimit;
@@ -770,7 +772,8 @@
                        "memory" => $wgTranscodeBackgroundMemoryLimit,
                        "time" => $wgTranscodeBackgroundTimeLimit
                );
-               $status = wfShellExec( $cmd . ' 2>&1', $retval , array(), 
$limits );
+               $status = wfShellExec( $cmd . ' 2>&1', $retval , array(), 
$limits,
+                       array( 'profileMethod' => $caller ) );
 
                // Output the status:
                wfSuppressWarnings();

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I166e040b41439886e182809208ad0da0a4a63573
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>
Gerrit-Reviewer: Gilles <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to