| OLD | NEW |
| 1 // run_chromium_perf_swarming is an application that is meant to be run on | 1 // run_chromium_perf_swarming is an application that is meant to be run on |
| 2 // a swarming slave. It runs the specified benchmark over CT's webpage | 2 // a swarming slave. It runs the specified benchmark over CT's webpage |
| 3 // archives and uploads results to chromeperf.appspot.com | 3 // archives and uploads results to chromeperf.appspot.com |
| 4 package main | 4 package main |
| 5 | 5 |
| 6 import ( | 6 import ( |
| 7 "flag" | 7 "flag" |
| 8 "fmt" | 8 "fmt" |
| 9 "io/ioutil" | 9 "io/ioutil" |
| 10 "os" | 10 "os" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // Documentation is here: http://www.chromium.org/developers/spe
ed-infra/performance-dashboard/sending-data-to-the-performance-dashboard | 136 // Documentation is here: http://www.chromium.org/developers/spe
ed-infra/performance-dashboard/sending-data-to-the-performance-dashboard |
| 137 "--output-format=chartjson", | 137 "--output-format=chartjson", |
| 138 // Upload traces. | 138 // Upload traces. |
| 139 "--upload-results", | 139 "--upload-results", |
| 140 "--upload-bucket=output", | 140 "--upload-bucket=output", |
| 141 } | 141 } |
| 142 | 142 |
| 143 // Need to capture output for all benchmarks. | 143 // Need to capture output for all benchmarks. |
| 144 outputDirArgValue := filepath.Join(localOutputDir, pagesetName) | 144 outputDirArgValue := filepath.Join(localOutputDir, pagesetName) |
| 145 args = append(args, "--output-dir="+outputDirArgValue) | 145 args = append(args, "--output-dir="+outputDirArgValue) |
| 146 » // Figure out which browser should be used. | 146 » // Figure out which browser and device should be used. |
| 147 if *targetPlatform == util.PLATFORM_ANDROID { | 147 if *targetPlatform == util.PLATFORM_ANDROID { |
| 148 if err := util.InstallChromeAPK(chromiumBuildName); err != nil { | 148 if err := util.InstallChromeAPK(chromiumBuildName); err != nil { |
| 149 return fmt.Errorf("Error while installing APK: %s", err) | 149 return fmt.Errorf("Error while installing APK: %s", err) |
| 150 } | 150 } |
| 151 args = append(args, "--browser=android-chromium") | 151 args = append(args, "--browser=android-chromium") |
| 152 } else { | 152 } else { |
| 153 args = append(args, "--browser=exact", "--browser-executable="+c
hromiumBinary) | 153 args = append(args, "--browser=exact", "--browser-executable="+c
hromiumBinary) |
| 154 args = append(args, "--device=desktop") |
| 154 } | 155 } |
| 155 // Split benchmark args if not empty and append to args. | 156 // Split benchmark args if not empty and append to args. |
| 156 if *benchmarkExtraArgs != "" { | 157 if *benchmarkExtraArgs != "" { |
| 157 args = append(args, strings.Fields(*benchmarkExtraArgs)...) | 158 args = append(args, strings.Fields(*benchmarkExtraArgs)...) |
| 158 } | 159 } |
| 159 // Add the number of times to repeat. | 160 // Add the number of times to repeat. |
| 160 args = append(args, fmt.Sprintf("--page-repeat=%d", *repeatBenchmark)) | 161 args = append(args, fmt.Sprintf("--page-repeat=%d", *repeatBenchmark)) |
| 161 // Add browserArgs if not empty to args. | 162 // Add browserArgs if not empty to args. |
| 162 if browserExtraArgs != "" { | 163 if browserExtraArgs != "" { |
| 163 args = append(args, "--extra-browser-args="+browserExtraArgs) | 164 args = append(args, "--extra-browser-args="+browserExtraArgs) |
| 164 } | 165 } |
| 165 // Set the PYTHONPATH to the pagesets and the telemetry dirs. | 166 // Set the PYTHONPATH to the pagesets and the telemetry dirs. |
| 166 env := []string{ | 167 env := []string{ |
| 167 fmt.Sprintf("PYTHONPATH=%s:$PYTHONPATH", *telemetryBinariesDir), | 168 fmt.Sprintf("PYTHONPATH=%s:$PYTHONPATH", *telemetryBinariesDir), |
| 168 "DISPLAY=:0", | 169 "DISPLAY=:0", |
| 169 } | 170 } |
| 170 timeoutSecs := 2 * 60 // 2 mins timeout | 171 timeoutSecs := 2 * 60 // 2 mins timeout |
| 171 if err := util.ExecuteCmd("python", args, env, time.Duration(timeoutSecs
)*time.Second, nil, nil); err != nil { | 172 if err := util.ExecuteCmd("python", args, env, time.Duration(timeoutSecs
)*time.Second, nil, nil); err != nil { |
| 172 glog.Errorf("Run benchmark command failed with: %s", err) | 173 glog.Errorf("Run benchmark command failed with: %s", err) |
| 173 } | 174 } |
| 174 return nil | 175 return nil |
| 175 } | 176 } |
| OLD | NEW |