public unsafe LogicalProcessorInformationIterator(LogicalProcessorRelationship relationship,
                                                              Span <byte> buffer)
            {
                uint length = (uint)buffer.Length;
                bool success;

                fixed(byte *p = buffer)
                {
                    success = GetLogicalProcessorInformationEx(relationship,
                                                               (IntPtr)p,
                                                               ref length);
                }

                if (success)
                {
                    _buffer = buffer.Slice(0, (int)length);
                }
                else
                {
                    int error = Marshal.GetLastWin32Error();
                    if (error != 122 /* ERROR_INSUFFICIENT_BUFFER */)
                    {
                        throw new Win32Exception(error);
                    }

                    _buffer = new Span <byte>();
                }

                _start = 0;
                _next  = 0;
            }
Exemplo n.º 2
0
 private void VerifyRelationship(LogicalProcessorRelationship relationship)
 {
     if (Relationship == relationship)
     {
         return;
     }
     throw new InvalidOperationException("Property not valid for this relationship.");
 }
 private extern static bool GetLogicalProcessorInformationEx(
     LogicalProcessorRelationship relationshipType,
     IntPtr buffer,
     ref uint returnedLength);
Exemplo n.º 4
0
 internal LogicalProcessorInformation(Int64 processorMask, LogicalProcessorRelationship relationship, Byte processorCore)
     : this(processorMask, relationship)
 {
     m_processorCore = processorCore;
 }
Exemplo n.º 5
0
 internal LogicalProcessorInformation(Int64 processorMask, LogicalProcessorRelationship relationship, Int32 numaNode)
     : this(processorMask, relationship)
 {
     m_numaNode = numaNode;
 }
Exemplo n.º 6
0
 internal LogicalProcessorInformation(Int64 processorMask, LogicalProcessorRelationship relationship, CacheDescriptor cacheDescriptor)
     : this(processorMask, relationship)
 {
     m_cacheDescriptor = cacheDescriptor;
 }
Exemplo n.º 7
0
 internal LogicalProcessorInformation(Int64 processorMask, LogicalProcessorRelationship relationship)
 {
     m_processorMask = processorMask;
     m_relationship  = relationship;
 }