[tools] Fix the loading of historic months data
When a new month starts, perfmon will fail to find a results file for the current month, and would give up scanning.
Fix this by scanning up to 10 year's worth of data.
Change-Id: Ie6b02e9166528addd468f699782e91c251d8f166
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/182460
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/tools/src/cmd/perfmon/main.go b/tools/src/cmd/perfmon/main.go
index 26a46fc..f3c9dd2 100644
--- a/tools/src/cmd/perfmon/main.go
+++ b/tools/src/cmd/perfmon/main.go
@@ -695,15 +695,15 @@
func (e env) allResultFilePaths() (paths []string, err error) {
year := time.Now().Year()
month := time.Now().Month()
- for {
+ monthsToScan := 12 * 10 // 10 years
+ for i := 0; i < monthsToScan; i++ {
path, err := e.resultsFilePathForDate(year, month)
if err != nil {
return nil, err
}
- if !fileutils.IsFile(path) {
- return paths, nil
+ if fileutils.IsFile(path) {
+ paths = append(paths, path)
}
- paths = append(paths, path)
month--
if month == 0 {
@@ -711,6 +711,8 @@
month = 12
}
}
+
+ return paths, nil
}
// loadHistoricResults loads and returns the result files as a single HistoricResults