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

Function processorIDFromLogicalProcessorID

pkg/cpu/cpu_linux.go:167–176  ·  view source on GitHub ↗

processorIDFromLogicalProcessorID returns the processor physical package ID for the supplied logical processor ID

(ctx context.Context, lpID int)

Source from the content-addressed store, hash-verified

165// processorIDFromLogicalProcessorID returns the processor physical package ID
166// for the supplied logical processor ID
167func processorIDFromLogicalProcessorID(ctx context.Context, lpID int) int {
168 paths := linuxpath.New(ctx)
169 // Fetch CPU ID
170 path := filepath.Join(
171 paths.SysDevicesSystemCPU,
172 fmt.Sprintf("cpu%d", lpID),
173 "topology", "physical_package_id",
174 )
175 return util.SafeIntFromFile(ctx, path)
176}
177
178// coreIDFromLogicalProcessorID returns the core ID for the supplied logical
179// processor ID

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…