diff --git a/build/cache/cache.go b/build/cache/cache.go index c84d672c0..77985d90d 100644 --- a/build/cache/cache.go +++ b/build/cache/cache.go @@ -101,6 +101,16 @@ func ClearStats() { FilePaths = map[string]*FilePathStats{} } +func statsPath(path string) string { + if strings.HasPrefix(path, cacheRoot) { + path = `..` + path[len(cacheRoot):] + } + if len(path) > 20 { + path = path[:20] + } + return path +} + func StatsString() string { buf := &strings.Builder{} @@ -138,13 +148,13 @@ func StatsString() string { fmt.Fprintf(buf, "{%s: ", im) fp := FilePaths[im] if fp.StoreCount > 0 { - fmt.Fprintf(buf, "%s (%d)", fp.StorePath, fp.StoreCount) + fmt.Fprintf(buf, "%s (%d)", statsPath(fp.StorePath), fp.StoreCount) } if fp.LoadCount > 0 { if fp.StorePath == fp.LoadPath { - fmt.Fprintf(buf, " - \" (%d)", fp.LoadCount) + fmt.Fprintf(buf, "-(%d)", fp.LoadCount) } else { - fmt.Fprintf(buf, " - %s (%d)", fp.LoadPath, fp.LoadCount) + fmt.Fprintf(buf, "- %s (%d)", statsPath(fp.LoadPath), fp.LoadCount) } } fmt.Fprintf(buf, "}")