File tree 1 file changed +13
-3
lines changed
1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,16 @@ func ClearStats() {
101
101
FilePaths = map [string ]* FilePathStats {}
102
102
}
103
103
104
+ func statsPath (path string ) string {
105
+ if strings .HasPrefix (path , cacheRoot ) {
106
+ path = `..` + path [len (cacheRoot ):]
107
+ }
108
+ if len (path ) > 20 {
109
+ path = path [:20 ]
110
+ }
111
+ return path
112
+ }
113
+
104
114
func StatsString () string {
105
115
buf := & strings.Builder {}
106
116
@@ -138,13 +148,13 @@ func StatsString() string {
138
148
fmt .Fprintf (buf , "{%s: " , im )
139
149
fp := FilePaths [im ]
140
150
if fp .StoreCount > 0 {
141
- fmt .Fprintf (buf , "%s (%d)" , fp .StorePath , fp .StoreCount )
151
+ fmt .Fprintf (buf , "%s (%d)" , statsPath ( fp .StorePath ) , fp .StoreCount )
142
152
}
143
153
if fp .LoadCount > 0 {
144
154
if fp .StorePath == fp .LoadPath {
145
- fmt .Fprintf (buf , " - \" (%d)" , fp .LoadCount )
155
+ fmt .Fprintf (buf , "- (%d)" , fp .LoadCount )
146
156
} else {
147
- fmt .Fprintf (buf , " - %s (%d)" , fp .LoadPath , fp .LoadCount )
157
+ fmt .Fprintf (buf , "- %s (%d)" , statsPath ( fp .LoadPath ) , fp .LoadCount )
148
158
}
149
159
}
150
160
fmt .Fprintf (buf , "}" )
You can’t perform that action at this time.
0 commit comments