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 "encoding/csv" | 6 "encoding/csv" |
7 "flag" | 7 "flag" |
8 "fmt" | 8 "fmt" |
9 "io/ioutil" | 9 "io/ioutil" |
10 "os" | 10 "os" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 } | 237 } |
238 } | 238 } |
239 | 239 |
240 func runBenchmark(fileInfoName, pathToPagesets, pathToPyFiles, localOutputDir, c
hromiumBuildName, chromiumBinary, runID, browserExtraArgs string) error { | 240 func runBenchmark(fileInfoName, pathToPagesets, pathToPyFiles, localOutputDir, c
hromiumBuildName, chromiumBinary, runID, browserExtraArgs string) error { |
241 pagesetBaseName := filepath.Base(fileInfoName) | 241 pagesetBaseName := filepath.Base(fileInfoName) |
242 if pagesetBaseName == util.TIMESTAMP_FILE_NAME || filepath.Ext(pagesetBa
seName) == ".pyc" { | 242 if pagesetBaseName == util.TIMESTAMP_FILE_NAME || filepath.Ext(pagesetBa
seName) == ".pyc" { |
243 // Ignore timestamp files and .pyc files. | 243 // Ignore timestamp files and .pyc files. |
244 return nil | 244 return nil |
245 } | 245 } |
246 | 246 |
247 » // Convert the filename into a format consumable by the run_benchmarks | 247 » // Read the pageset. |
248 » // binary. | |
249 pagesetName := strings.TrimSuffix(pagesetBaseName, filepath.Ext(pagesetB
aseName)) | 248 pagesetName := strings.TrimSuffix(pagesetBaseName, filepath.Ext(pagesetB
aseName)) |
250 pagesetPath := filepath.Join(pathToPagesets, fileInfoName) | 249 pagesetPath := filepath.Join(pathToPagesets, fileInfoName) |
| 250 decodedPageset, err := util.ReadPageset(pagesetPath) |
| 251 if err != nil { |
| 252 return fmt.Errorf("Could not read %s: %s", pagesetPath, err) |
| 253 } |
251 | 254 |
252 glog.Infof("===== Processing %s for %s =====", pagesetPath, runID) | 255 glog.Infof("===== Processing %s for %s =====", pagesetPath, runID) |
253 | |
254 skutil.LogErr(os.Chdir(pathToPyFiles)) | |
255 args := []string{ | 256 args := []string{ |
256 » » util.BINARY_RUN_BENCHMARK, | 257 » » filepath.Join(util.TelemetryBinariesDir, util.BINARY_RUN_BENCHMA
RK), |
257 » » fmt.Sprintf("%s.%s", *benchmarkName, util.BenchmarksToPagesetNam
e[*benchmarkName]), | 258 » » util.BenchmarksToPagesetName[*benchmarkName], |
258 » » "--page-set-name=" + pagesetName, | |
259 » » "--page-set-base-dir=" + pathToPagesets, | |
260 "--also-run-disabled-tests", | 259 "--also-run-disabled-tests", |
| 260 "--user-agent=" + decodedPageset.UserAgent, |
| 261 "--urls-list=" + decodedPageset.UrlsList, |
| 262 "--archive-data-file=" + decodedPageset.ArchiveDataFile, |
261 } | 263 } |
262 | 264 |
263 // Need to capture output for all benchmarks. | 265 // Need to capture output for all benchmarks. |
264 outputDirArgValue := filepath.Join(localOutputDir, pagesetName) | 266 outputDirArgValue := filepath.Join(localOutputDir, pagesetName) |
265 args = append(args, "--output-dir="+outputDirArgValue) | 267 args = append(args, "--output-dir="+outputDirArgValue) |
266 // Figure out which browser should be used. | 268 // Figure out which browser should be used. |
267 if *targetPlatform == util.PLATFORM_ANDROID { | 269 if *targetPlatform == util.PLATFORM_ANDROID { |
268 if err := util.InstallChromeAPK(chromiumBuildName); err != nil { | 270 if err := util.InstallChromeAPK(chromiumBuildName); err != nil { |
269 return fmt.Errorf("Error while installing APK: %s", err) | 271 return fmt.Errorf("Error while installing APK: %s", err) |
270 } | 272 } |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 return fmt.Errorf("Could not write to %s: %s", csvPath, err) | 385 return fmt.Errorf("Could not write to %s: %s", csvPath, err) |
384 } | 386 } |
385 // Write all values. | 387 // Write all values. |
386 for _, row := range values { | 388 for _, row := range values { |
387 if err := writer.Write(row); err != nil { | 389 if err := writer.Write(row); err != nil { |
388 return fmt.Errorf("Could not write to %s: %s", csvPath,
err) | 390 return fmt.Errorf("Could not write to %s: %s", csvPath,
err) |
389 } | 391 } |
390 } | 392 } |
391 return nil | 393 return nil |
392 } | 394 } |
OLD | NEW |