diff --git a/LibreHardwareMonitorLib/Hardware/Cpu/AmdCpu.cs b/LibreHardwareMonitorLib/Hardware/Cpu/AmdCpu.cs index c64ec65..906cd8f 100644 --- a/LibreHardwareMonitorLib/Hardware/Cpu/AmdCpu.cs +++ b/LibreHardwareMonitorLib/Hardware/Cpu/AmdCpu.cs @@ -14,7 +14,7 @@ namespace LibreHardwareMonitor.Hardware.CPU protected uint GetPciAddress(byte function, ushort deviceId) { // assemble the pci address - uint address = Ring0.GetPciAddress(PCI_BUS, (byte)(PCI_BASE_DEVICE + _processorIndex), function); + uint address = Ring0.GetPciAddress(PCI_BUS, (byte)(PCI_BASE_DEVICE + Index), function); // verify that we have the correct bus, device and function if (!Ring0.ReadPciConfig(address, DEVICE_VENDOR_ID_REGISTER, out uint deviceVendor)) diff --git a/LibreHardwareMonitorLib/Hardware/Cpu/GenericCpu.cs b/LibreHardwareMonitorLib/Hardware/Cpu/GenericCpu.cs index a691141..dc8895f 100644 --- a/LibreHardwareMonitorLib/Hardware/Cpu/GenericCpu.cs +++ b/LibreHardwareMonitorLib/Hardware/Cpu/GenericCpu.cs @@ -6,7 +6,6 @@ using System; using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Text; @@ -18,9 +17,8 @@ namespace LibreHardwareMonitor.Hardware.CPU protected readonly CpuId[][] _cpuId; protected readonly uint _family; protected readonly uint _model; - protected readonly int _processorIndex; - protected readonly uint _stepping; protected readonly uint _packageType; + protected readonly uint _stepping; private readonly Sensor[] _coreLoads; private readonly CpuLoad _cpuLoad; @@ -32,7 +30,6 @@ namespace LibreHardwareMonitor.Hardware.CPU private long _lastTime; private ulong _lastTimeStampCount; - [SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] public GenericCpu(int processorIndex, CpuId[][] cpuId, ISettings settings) : base(cpuId[0][0].Name, CreateIdentifier(cpuId[0][0].Vendor, processorIndex), settings) { _cpuId = cpuId; @@ -42,7 +39,7 @@ namespace LibreHardwareMonitor.Hardware.CPU _stepping = cpuId[0][0].Stepping; _packageType = cpuId[0][0].PkgType; - _processorIndex = processorIndex; + Index = processorIndex; _coreCount = cpuId.Length; // check if processor has MSRs @@ -108,6 +105,11 @@ namespace LibreHardwareMonitor.Hardware.CPU public bool HasTimeStampCounter { get; } + /// + /// Gets the CPU index. + /// + public int Index { get; } + public double TimeStampCounterFrequency { get; private set; } protected string CoreString(int i) @@ -209,7 +211,7 @@ namespace LibreHardwareMonitor.Hardware.CPU public override string GetReport() { - StringBuilder r = new StringBuilder(); + StringBuilder r = new(); switch (_vendor) {