| OLD | NEW |
| 1 // run_chromium_perf is an application that runs the specified benchmark over CT
's | 1 // run_chromium_perf is an application that runs the specified benchmark over CT
's |
| 2 // webpage archives. | 2 // webpage archives. |
| 3 package main | 3 package main |
| 4 | 4 |
| 5 import ( | 5 import ( |
| 6 "bytes" | 6 "bytes" |
| 7 "encoding/csv" | 7 "encoding/csv" |
| 8 "flag" | 8 "flag" |
| 9 "fmt" | 9 "fmt" |
| 10 "io/ioutil" | 10 "io/ioutil" |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 benchmark, | 298 benchmark, |
| 299 "--also-run-disabled-tests", | 299 "--also-run-disabled-tests", |
| 300 "--user-agent=" + decodedPageset.UserAgent, | 300 "--user-agent=" + decodedPageset.UserAgent, |
| 301 "--urls-list=" + decodedPageset.UrlsList, | 301 "--urls-list=" + decodedPageset.UrlsList, |
| 302 "--archive-data-file=" + decodedPageset.ArchiveDataFile, | 302 "--archive-data-file=" + decodedPageset.ArchiveDataFile, |
| 303 } | 303 } |
| 304 | 304 |
| 305 // Need to capture output for all benchmarks. | 305 // Need to capture output for all benchmarks. |
| 306 outputDirArgValue := filepath.Join(localOutputDir, pagesetName) | 306 outputDirArgValue := filepath.Join(localOutputDir, pagesetName) |
| 307 args = append(args, "--output-dir="+outputDirArgValue) | 307 args = append(args, "--output-dir="+outputDirArgValue) |
| 308 » // Figure out which browser should be used. | 308 » // Figure out which browser and device should be used. |
| 309 if *targetPlatform == util.PLATFORM_ANDROID { | 309 if *targetPlatform == util.PLATFORM_ANDROID { |
| 310 if err := util.InstallChromeAPK(chromiumBuildName); err != nil { | 310 if err := util.InstallChromeAPK(chromiumBuildName); err != nil { |
| 311 return fmt.Errorf("Error while installing APK: %s", err) | 311 return fmt.Errorf("Error while installing APK: %s", err) |
| 312 } | 312 } |
| 313 args = append(args, "--browser=android-chromium") | 313 args = append(args, "--browser=android-chromium") |
| 314 } else { | 314 } else { |
| 315 args = append(args, "--browser=exact", "--browser-executable="+c
hromiumBinary) | 315 args = append(args, "--browser=exact", "--browser-executable="+c
hromiumBinary) |
| 316 args = append(args, "--device=desktop") |
| 316 } | 317 } |
| 317 // Split benchmark args if not empty and append to args. | 318 // Split benchmark args if not empty and append to args. |
| 318 if *benchmarkExtraArgs != "" { | 319 if *benchmarkExtraArgs != "" { |
| 319 » » for _, benchmarkArg := range strings.Fields(*benchmarkExtraArgs)
{ | 320 » » args = append(args, strings.Fields(*benchmarkExtraArgs)...) |
| 320 » » » args = append(args, benchmarkArg) | |
| 321 » » } | |
| 322 } | 321 } |
| 323 // Add the number of times to repeat. | 322 // Add the number of times to repeat. |
| 324 args = append(args, fmt.Sprintf("--page-repeat=%d", *repeatBenchmark)) | 323 args = append(args, fmt.Sprintf("--page-repeat=%d", *repeatBenchmark)) |
| 325 // Add browserArgs if not empty to args. | 324 // Add browserArgs if not empty to args. |
| 326 if browserExtraArgs != "" { | 325 if browserExtraArgs != "" { |
| 327 args = append(args, "--extra-browser-args="+browserExtraArgs) | 326 args = append(args, "--extra-browser-args="+browserExtraArgs) |
| 328 } | 327 } |
| 329 // Set the PYTHONPATH to the pagesets and the telemetry dirs. | 328 // Set the PYTHONPATH to the pagesets and the telemetry dirs. |
| 330 env := []string{ | 329 env := []string{ |
| 331 fmt.Sprintf("PYTHONPATH=%s:%s:%s:%s:$PYTHONPATH", pathToPagesets
, util.TelemetryBinariesDir, util.TelemetrySrcDir, util.CatapultSrcDir), | 330 fmt.Sprintf("PYTHONPATH=%s:%s:%s:%s:$PYTHONPATH", pathToPagesets
, util.TelemetryBinariesDir, util.TelemetrySrcDir, util.CatapultSrcDir), |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 return fmt.Errorf("Could not write to %s: %s", csvPath, err) | 424 return fmt.Errorf("Could not write to %s: %s", csvPath, err) |
| 426 } | 425 } |
| 427 // Write all values. | 426 // Write all values. |
| 428 for _, row := range values { | 427 for _, row := range values { |
| 429 if err := writer.Write(row); err != nil { | 428 if err := writer.Write(row); err != nil { |
| 430 return fmt.Errorf("Could not write to %s: %s", csvPath,
err) | 429 return fmt.Errorf("Could not write to %s: %s", csvPath,
err) |
| 431 } | 430 } |
| 432 } | 431 } |
| 433 return nil | 432 return nil |
| 434 } | 433 } |
| OLD | NEW |