| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } | 154 } |
| 155 // Split benchmark args if not empty and append to args. | 155 // Split benchmark args if not empty and append to args. |
| 156 if *benchmarkExtraArgs != "" { | 156 if *benchmarkExtraArgs != "" { |
| 157 » » args = append(args, strings.Split(*benchmarkExtraArgs, " ")...) | 157 » » args = append(args, strings.Fields(*benchmarkExtraArgs)...) |
| 158 } | 158 } |
| 159 // Add the number of times to repeat. | 159 // Add the number of times to repeat. |
| 160 args = append(args, fmt.Sprintf("--page-repeat=%d", *repeatBenchmark)) | 160 args = append(args, fmt.Sprintf("--page-repeat=%d", *repeatBenchmark)) |
| 161 // Add browserArgs if not empty to args. | 161 // Add browserArgs if not empty to args. |
| 162 if browserExtraArgs != "" { | 162 if browserExtraArgs != "" { |
| 163 args = append(args, "--extra-browser-args="+browserExtraArgs) | 163 args = append(args, "--extra-browser-args="+browserExtraArgs) |
| 164 } | 164 } |
| 165 // Set the PYTHONPATH to the pagesets and the telemetry dirs. | 165 // Set the PYTHONPATH to the pagesets and the telemetry dirs. |
| 166 env := []string{ | 166 env := []string{ |
| 167 fmt.Sprintf("PYTHONPATH=%s:$PYTHONPATH", *telemetryBinariesDir), | 167 fmt.Sprintf("PYTHONPATH=%s:$PYTHONPATH", *telemetryBinariesDir), |
| 168 "DISPLAY=:0", | 168 "DISPLAY=:0", |
| 169 } | 169 } |
| 170 timeoutSecs := 2 * 60 // 2 mins timeout | 170 timeoutSecs := 2 * 60 // 2 mins timeout |
| 171 if err := util.ExecuteCmd("python", args, env, time.Duration(timeoutSecs
)*time.Second, nil, nil); err != nil { | 171 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) | 172 glog.Errorf("Run benchmark command failed with: %s", err) |
| 173 } | 173 } |
| 174 return nil | 174 return nil |
| 175 } | 175 } |
| OLD | NEW |