Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Unified Diff: perf/server/src/tilebuilder/main.go

Issue 374393002: Fix tilebuilder bug when looking for start time. (Closed) Base URL: https://skia.googlesource.com/buildbot.git@master
Patch Set: rebase Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: perf/server/src/tilebuilder/main.go
diff --git a/perf/server/src/tilebuilder/main.go b/perf/server/src/tilebuilder/main.go
index 6413bb5cf135dabbdd67416cc92062d18089db25..3feabbea19cdc74f6457e43a1b13ab0427b8428f 100644
--- a/perf/server/src/tilebuilder/main.go
+++ b/perf/server/src/tilebuilder/main.go
@@ -38,6 +38,7 @@ import (
"fmt"
"net"
"net/http"
+ "sort"
"text/template"
"time"
)
@@ -154,6 +155,8 @@ func startConditions(store types.TileStore) (config.QuerySince, int, error) {
}
// Start querying from the timestamp of the last commit in the last full tile.
startTime = config.NewQuerySince(time.Unix(tile.Commits[len(tile.Commits)-1].CommitTime, 0))
+ glog.Infof("Picking from range: First: %v", time.Unix(tile.Commits[0].CommitTime, 0))
+ glog.Infof("Picking from range: Last: %v", time.Unix(tile.Commits[len(tile.Commits)-1].CommitTime, 0))
}
}
return startTime, nextTile, nil
@@ -169,13 +172,23 @@ func tablePrefixFromDatasetName(name config.DatasetName) string {
return "perf_skps_v2.skpbench"
}
+type CommitSlice []*types.Commit
+
+type CommitSliceSortable []*types.Commit
+
+func (p CommitSliceSortable) Len() int { return len(p) }
+func (p CommitSliceSortable) Less(i, j int) bool { return p[i].CommitTime < p[j].CommitTime }
+func (p CommitSliceSortable) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
+
// gitCommits returns all the Commits that have associated test data, going
// from now back to 'startTime'.
func gitCommits(service *bigquery.Service, datasetName config.DatasetName, startTime config.QuerySince) (map[string][]string, []*types.Commit, error) {
dateMap := make(map[string][]string)
allCommits := make([]*types.Commit, 0)
- commitHistory, err := db.readCommitsFromDB()
+ commitHashMap := make(map[string]bool)
+
+ commitHistory, err := db.ReadCommitsFromDB()
if err != nil {
return nil, nil, fmt.Errorf("gitCommits: Did not get the commits history from the database: ", err)
}
@@ -223,18 +236,22 @@ ORDER BY
}
}
totalCommits++
- allCommits = append(allCommits, c)
+ // Data may show up for a commit across more than one day, track if a
+ // commit has already been added, and only add if new.
+ if _, ok := commitHashMap[c.Hash]; !ok {
+ commitHashMap[c.Hash] = true
+ allCommits = append(allCommits, c)
+ }
}
dateMap[dates.Date()] = gitHashesForDay
glog.Infof("Finding hashes with data, finished day %s, total commits so far %d", dates.Date(), totalCommits)
}
- // Now reverse allCommits so that it is oldest first.
- reversedCommits := make([]*types.Commit, len(allCommits), len(allCommits))
- for i, c := range allCommits {
- reversedCommits[len(allCommits)-i-1] = c
+ sort.Sort(CommitSliceSortable(allCommits))
+ for _, c := range allCommits {
+ glog.Infof("gitCommits: allcommits: %s %d\n", c.Hash, c.CommitTime)
}
- return dateMap, reversedCommits, nil
+ return dateMap, allCommits, nil
}
// populateParamSet returns the set of all possible values for all the 'params'
@@ -396,7 +413,7 @@ func updateAllTileSets(service *bigquery.Service) {
store := filetilestore.NewFileTileStore(*tileDir, string(datasetName))
startTime, nextTile, err := startConditions(store)
- glog.Infoln("Found startTime", startTime, "nextTile", nextTile)
+ glog.Infoln("Found startTime", startTime.SqlTsColumn(), "nextTile", nextTile)
if err != nil {
glog.Errorf("Failed to compute start conditions for dataset %s: %s", string(datasetName), err)
continue
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698