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

Function coreIDFromLogicalProcessorID

pkg/cpu/cpu_linux.go:180–189  ·  view source on GitHub ↗

coreIDFromLogicalProcessorID returns the core ID for the supplied logical processor ID

(ctx context.Context, lpID int)

Source from the content-addressed store, hash-verified

178// coreIDFromLogicalProcessorID returns the core ID for the supplied logical
179// processor ID
180func coreIDFromLogicalProcessorID(ctx context.Context, lpID int) int {
181 paths := linuxpath.New(ctx)
182 // Fetch CPU ID
183 path := filepath.Join(
184 paths.SysDevicesSystemCPU,
185 fmt.Sprintf("cpu%d", lpID),
186 "topology", "core_id",
187 )
188 return util.SafeIntFromFile(ctx, path)
189}
190
191func CoresForNode(ctx context.Context, nodeID int) ([]*ProcessorCore, error) {
192 // The /sys/devices/system/node/nodeX directory contains a subdirectory

Callers 1

processorsGetFunction · 0.85

Calls 2

NewFunction · 0.92
SafeIntFromFileFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…