small changed
This commit is contained in:
@@ -47,9 +47,9 @@ namespace StgSharp.Common.HighPerformance.ProcessorAbstraction
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
[DefaultDllImportSearchPaths(DllImportSearchPath.AssemblyDirectory)]
|
||||
public static partial int GetNumaEach(
|
||||
int numaId,
|
||||
Span<ulong> coreCountInNuma,
|
||||
Span<ulong> globalCpuIdInNuma
|
||||
uint numaId,
|
||||
Span<ulong> CpuIndexInNuma,
|
||||
Span<uint> globalCpuIdInNuma
|
||||
);
|
||||
|
||||
[LibraryImport(Native.LibName, EntryPoint = "sn_get_numa_overall")]
|
||||
@@ -68,12 +68,22 @@ namespace StgSharp.Common.HighPerformance.ProcessorAbstraction
|
||||
throw new InvalidOperationException("Failed to get NUMA overall information.");
|
||||
}
|
||||
_numaNodes = new NumaNode[numaNodeCount];
|
||||
for (int i = 0; i < numaNodeCount; i++)
|
||||
{
|
||||
NumaNode node = new(coreCountInNuma[i]);
|
||||
GetNumaEach(i, coreCountInNuma, node.GlobalCpuIds);
|
||||
for (uint i = 0; i < numaNodeCount; i++) {
|
||||
_numaNodes[i] = InitNumaNode(i, coreCountInNuma[(int)i]);
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
private static NumaNode InitNumaNode(
|
||||
uint numaId,
|
||||
int count
|
||||
)
|
||||
{
|
||||
Span<uint> globalIndex = stackalloc uint[count];
|
||||
Span<ulong> groupIndex = stackalloc ulong[count];
|
||||
_ = GetNumaEach(numaId, groupIndex, globalIndex);
|
||||
return new(numaId, count, globalIndex);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user