예제 #1
0
        public AMD17CPU(int processorIndex, CPUID[][] cpuid, ISettings settings)
            : base(processorIndex, cpuid, settings)
        {
            // add all numa nodes
            // Register ..1E_ECX, [10:8] + 1
            _ryzen = new Processor(this);
            int NodesPerProcessor = 1 + (int)((cpuid[0][0].ExtData[0x1e, ECX] >> 8) & 0x7);

            // add all numa nodes
            foreach (CPUID[] cpu in cpuid)
            {
                CPUID thread = cpu[0];

                // coreID
                // Register ..1E_EBX, [7:0]
                int core_id = (int)(thread.ExtData[0x1e, EBX] & 0xff);

                // nodeID
                // Register ..1E_ECX, [7:0]
                int node_id = (int)(thread.ExtData[0x1e, ECX] & 0xff);

                _ryzen.AppendThread(null, node_id, core_id);
            }

            // add all threads to numa nodes and specific core
            foreach (CPUID[] cpu in cpuid)
            {
                CPUID thread = cpu[0];

                // coreID
                // Register ..1E_EBX, [7:0]
                int core_id = (int)(thread.ExtData[0x1e, EBX] & 0xff);

                // nodeID
                // Register ..1E_ECX, [7:0]
                int node_id = (int)(thread.ExtData[0x1e, ECX] & 0xff);

                _ryzen.AppendThread(thread, node_id, core_id);
            }
            Update();
        }
예제 #2
0
        public Amd17Cpu(int processorIndex, CpuId[][] cpuId, ISettings settings) : base(processorIndex, cpuId, settings)
        {
            _sensorTypeIndex = new Dictionary <SensorType, int>();
            foreach (SensorType type in Enum.GetValues(typeof(SensorType)))
            {
                _sensorTypeIndex.Add(type, 0);
            }

            _sensorTypeIndex[SensorType.Load] = _active.Count(x => x.SensorType == SensorType.Load);

            _smu = new RyzenSMU(_family, _model, _packageType);

            // Add all numa nodes.
            // Register ..1E_2, [10:8] + 1
            _processor = new Processor(this);

            // Add all numa nodes.
            int coreId     = 0;
            int lastCoreId = -1; // Invalid id.

            // Ryzen 3000's skip some core ids.
            // So start at 1 and count upwards when the read core changes.
            foreach (CpuId[] cpu in cpuId.OrderBy(x => x[0].ExtData[0x1e, 1] & 0xFF))
            {
                CpuId thread = cpu[0];

                // CPUID_Fn8000001E_EBX, Register ..1E_1, [7:0]
                // threads per core =  CPUID_Fn8000001E_EBX[15:8] + 1
                // CoreId: core ID =  CPUID_Fn8000001E_EBX[7:0]
                int coreIdRead = (int)(thread.ExtData[0x1e, 1] & 0xff);

                // CPUID_Fn8000001E_ECX, Node Identifiers, Register ..1E_2
                // NodesPerProcessor =  CPUID_Fn8000001E_ECX[10:8]
                // nodeID =  CPUID_Fn8000001E_ECX[7:0]
                int nodeId = (int)(thread.ExtData[0x1e, 2] & 0xff);

                if (coreIdRead != lastCoreId)
                {
                    coreId++;
                }

                lastCoreId = coreIdRead;

                _processor.AppendThread(thread, nodeId, coreId);
            }

            Update();
        }
예제 #3
0
        public AMD17CPU(int processorIndex, CPUID[][] cpuid, ISettings settings)
            : base(processorIndex, cpuid, settings)
        {
            // add all numa nodes
            // Register ..1E_ECX, [10:8] + 1
            _ryzen = new Processor(this);

            // add all numa nodes

            const int initialCoreId = 1_000_000_000;

            int coreId     = 1;
            int lastCoreId = initialCoreId;

            // Ryzen 3000's skip some core ids.
            // So start at 1 and count upwards when the read core changes.

            foreach (CPUID[] cpu in cpuid.OrderBy(x => x[0].ExtData[0x1e, EBX] & 0xFF))
            {
                CPUID thread = cpu[0];

                // coreID
                // Register ..1E_EBX, [7:0]
                int coreIdRead = (int)(thread.ExtData[0x1e, EBX] & 0xff);

                // nodeID
                // Register ..1E_ECX, [7:0]
                int nodeId = (int)(thread.ExtData[0x1e, ECX] & 0xff);

                _ryzen.AppendThread(thread, nodeId, coreId);

                if (lastCoreId != initialCoreId && coreIdRead != lastCoreId)
                {
                    coreId++;
                }

                lastCoreId = coreIdRead;
            }

            Update();
        }
예제 #4
0
        public Amd17Cpu(int processorIndex, CpuId[][] cpuId, ISettings settings) : base(processorIndex, cpuId, settings)
        {
            // Add all numa nodes.
            // Register ..1E_2, [10:8] + 1
            _processor = new Processor(this);

            // Add all numa nodes.
            int coreId     = 0;
            int lastCoreId = -1; // Invalid id.

            // Ryzen 3000's skip some core ids.
            // So start at 1 and count upwards when the read core changes.
            foreach (CpuId[] cpu in cpuId.OrderBy(x => x[0].ExtData[0x1e, 1] & 0xFF))
            {
                CpuId thread = cpu[0];

                // CPUID_Fn8000001E_EBX, Register ..1E_1, [7:0]
                // threads per core =  CPUID_Fn8000001E_EBX[15:8] + 1
                // CoreId: core ID =  CPUID_Fn8000001E_EBX[7:0]
                int coreIdRead = (int)(thread.ExtData[0x1e, 1] & 0xff);

                // CPUID_Fn8000001E_ECX, Node Identifiers, Register ..1E_2
                // NodesPerProcessor =  CPUID_Fn8000001E_ECX[10:8]
                // nodeID =  CPUID_Fn8000001E_ECX[7:0]
                int nodeId = (int)(thread.ExtData[0x1e, 2] & 0xff);

                if (coreIdRead != lastCoreId)
                {
                    coreId++;
                }
                lastCoreId = coreIdRead;

                _processor.AppendThread(thread, nodeId, coreId);
            }

            Update();
        }