MCPcopy
hub / github.com/jaypipes/ghw / memoryCacheSize

Function memoryCacheSize

pkg/memory/memory_cache_linux.go:180–203  ·  view source on GitHub ↗
(
	ctx context.Context,
	paths *linuxpath.Paths,
	nodeID int,
	lpID int,
	cacheIndex int,
)

Source from the content-addressed store, hash-verified

178}
179
180func 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
205func memoryCacheType(
206 ctx context.Context,

Callers 1

CachesForNodeFunction · 0.85

Calls 2

WarnFunction · 0.92
NodeCPUCacheIndexMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…