( ctx context.Context, paths *linuxpath.Paths, nodeID int, lpID int, cacheIndex int, )
| 154 | } |
| 155 | |
| 156 | func memoryCacheID( |
| 157 | ctx context.Context, |
| 158 | paths *linuxpath.Paths, |
| 159 | nodeID int, |
| 160 | lpID int, |
| 161 | cacheIndex int, |
| 162 | ) int { |
| 163 | idPath := filepath.Join( |
| 164 | paths.NodeCPUCacheIndex(nodeID, lpID, cacheIndex), |
| 165 | "id", |
| 166 | ) |
| 167 | idContents, err := os.ReadFile(idPath) |
| 168 | if err != nil { |
| 169 | // The id file may not exist in early kernel versions, so we don't warn |
| 170 | return -1 |
| 171 | } |
| 172 | id, err := strconv.Atoi(string(idContents[:len(idContents)-1])) |
| 173 | if err != nil { |
| 174 | log.Warn(ctx, "Unable to parse int from %s", idContents) |
| 175 | return -1 |
| 176 | } |
| 177 | return id |
| 178 | } |
| 179 | |
| 180 | func memoryCacheSize( |
| 181 | ctx context.Context, |
no test coverage detected
searching dependent graphs…