( ctx context.Context, paths *linuxpath.Paths, nodeID int, lpID int, cacheIndex int, )
| 178 | } |
| 179 | |
| 180 | func memoryCacheSize( |
| 181 | ctx context.Context, |
| 182 | paths *linuxpath.Paths, |
| 183 | nodeID int, |
| 184 | lpID int, |
| 185 | cacheIndex int, |
| 186 | ) int { |
| 187 | sizePath := filepath.Join( |
| 188 | paths.NodeCPUCacheIndex(nodeID, lpID, cacheIndex), |
| 189 | "size", |
| 190 | ) |
| 191 | sizeContents, err := os.ReadFile(sizePath) |
| 192 | if err != nil { |
| 193 | log.Warn(ctx, "%s", err) |
| 194 | return -1 |
| 195 | } |
| 196 | // size comes as XK\n, so we trim off the K and the newline. |
| 197 | size, err := strconv.Atoi(string(sizeContents[:len(sizeContents)-2])) |
| 198 | if err != nil { |
| 199 | log.Warn(ctx, "Unable to parse int from %s", sizeContents) |
| 200 | return -1 |
| 201 | } |
| 202 | return size |
| 203 | } |
| 204 | |
| 205 | func memoryCacheType( |
| 206 | ctx context.Context, |
no test coverage detected
searching dependent graphs…