| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 } | 58 } |
| 59 if *runIDWithPatch == "" { | 59 if *runIDWithPatch == "" { |
| 60 glog.Error("Must specify --run_id_withpatch") | 60 glog.Error("Must specify --run_id_withpatch") |
| 61 return | 61 return |
| 62 } | 62 } |
| 63 if *benchmarkName == "" { | 63 if *benchmarkName == "" { |
| 64 glog.Error("Must specify --benchmark_name") | 64 glog.Error("Must specify --benchmark_name") |
| 65 return | 65 return |
| 66 } | 66 } |
| 67 | 67 |
| 68 // Reset the local chromium checkout. |
| 69 if err := util.ResetCheckout(util.ChromiumSrcDir); err != nil { |
| 70 glog.Errorf("Could not reset %s: %s", util.ChromiumSrcDir, err) |
| 71 return |
| 72 } |
| 68 // Sync the local chromium checkout. | 73 // Sync the local chromium checkout. |
| 69 if err := util.SyncDir(util.ChromiumSrcDir); err != nil { | 74 if err := util.SyncDir(util.ChromiumSrcDir); err != nil { |
| 70 glog.Errorf("Could not gclient sync %s: %s", util.ChromiumSrcDir
, err) | 75 glog.Errorf("Could not gclient sync %s: %s", util.ChromiumSrcDir
, err) |
| 71 return | 76 return |
| 72 } | 77 } |
| 73 | 78 |
| 74 // Create the task file so that the master knows this worker is still bu
sy. | 79 // Create the task file so that the master knows this worker is still bu
sy. |
| 75 skutil.LogErr(util.CreateTaskFile(util.ACTIVITY_RUNNING_CHROMIUM_PERF)) | 80 skutil.LogErr(util.CreateTaskFile(util.ACTIVITY_RUNNING_CHROMIUM_PERF)) |
| 76 defer util.DeleteTaskFile(util.ACTIVITY_RUNNING_CHROMIUM_PERF) | 81 defer util.DeleteTaskFile(util.ACTIVITY_RUNNING_CHROMIUM_PERF) |
| 77 | 82 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 } | 324 } |
| 320 writer := csv.NewWriter(csvFile) | 325 writer := csv.NewWriter(csvFile) |
| 321 defer writer.Flush() | 326 defer writer.Flush() |
| 322 for _, row := range [][]string{headers, values} { | 327 for _, row := range [][]string{headers, values} { |
| 323 if err := writer.Write(row); err != nil { | 328 if err := writer.Write(row); err != nil { |
| 324 return fmt.Errorf("Could not write to %s: %s", csvPath,
err) | 329 return fmt.Errorf("Could not write to %s: %s", csvPath,
err) |
| 325 } | 330 } |
| 326 } | 331 } |
| 327 return nil | 332 return nil |
| 328 } | 333 } |
| OLD | NEW |