Add processor characteristics

This commit is contained in:
PhyxionNL
2022-06-24 13:42:18 +02:00
parent 90e6178079
commit 3552e644c5
+61 -10
View File
@@ -301,6 +301,22 @@ namespace LibreHardwareMonitor.Hardware
Dsp,
VideoProcessor
}
/// <summary>
/// Processor characteristics based on <see href="https://www.dmtf.org/dsp/DSP0134">DMTF SMBIOS Reference Specification v.3.3.0, Chapter 7.5.9</see>.
/// </summary>
[Flags]
public enum ProcessorCharacteristics
{
None = 0,
_64BitCapable = 1,
MultiCore = 2,
HardwareThread = 4,
ExecuteProtection = 8,
EnhancedVirtualization = 16,
PowerPerformanceControl = 32,
_128BitCapable = 64
}
/// <summary>
/// Processor type based on <see href="https://www.dmtf.org/dsp/DSP0134">DMTF SMBIOS Reference Specification v.3.3.0, Chapter 7.5.1</see>.
@@ -744,11 +760,6 @@ namespace LibreHardwareMonitor.Hardware
/// </summary>
public SystemEnclosureState BootUpState { get; }
/// <summary>
/// Gets <inheritdoc cref="Type" />
/// </summary>
public SystemEnclosureType Type { get; }
/// <summary>
/// Gets or sets the system enclosure lock.
/// </summary>
@@ -796,6 +807,11 @@ namespace LibreHardwareMonitor.Hardware
/// </summary>
public SystemEnclosureState ThermalState { get; }
/// <summary>
/// Gets <inheritdoc cref="Type" />
/// </summary>
public SystemEnclosureType Type { get; }
/// <summary>
/// Gets the number of null-terminated string representing the chassis or enclosure version.
/// </summary>
@@ -864,6 +880,31 @@ namespace LibreHardwareMonitor.Hardware
Id = GetQword(0x08);
Handle = GetWord(0x02);
byte characteristics1 = GetByte(0x26);
byte characteristics2 = GetByte(0x27);
Characteristics = ProcessorCharacteristics.None;
if (IsBitSet(characteristics1, 2))
Characteristics |= ProcessorCharacteristics._64BitCapable;
if (IsBitSet(characteristics1, 3))
Characteristics |= ProcessorCharacteristics.MultiCore;
if (IsBitSet(characteristics1, 4))
Characteristics |= ProcessorCharacteristics.HardwareThread;
if (IsBitSet(characteristics1, 5))
Characteristics |= ProcessorCharacteristics.ExecuteProtection;
if (IsBitSet(characteristics1, 6))
Characteristics |= ProcessorCharacteristics.EnhancedVirtualization;
if (IsBitSet(characteristics1, 7))
Characteristics |= ProcessorCharacteristics.PowerPerformanceControl;
if (IsBitSet(characteristics2, 0))
Characteristics |= ProcessorCharacteristics._128BitCapable;
ProcessorType = (ProcessorType)GetByte(0x05);
Socket = (ProcessorSocket)GetByte(0x19);
@@ -873,8 +914,18 @@ namespace LibreHardwareMonitor.Hardware
L1CacheHandle = GetWord(0x1A);
L2CacheHandle = GetWord(0x1C);
L3CacheHandle = GetWord(0x1E);
bool IsBitSet(byte b, int pos)
{
return (b & (1 << pos)) != 0;
}
}
/// <summary>
/// Gets the characteristics of the processor.
/// </summary>
public ProcessorCharacteristics Characteristics { get; }
/// <summary>
/// Gets the value that represents the number of cores per processor socket.
/// </summary>
@@ -1232,11 +1283,6 @@ namespace LibreHardwareMonitor.Hardware
/// </summary>
public BaseBoardInformation Board { get; }
/// <summary>
/// Gets <inheritdoc cref="LibreHardwareMonitor.Hardware.SystemEnclosure" />
/// </summary>
public SystemEnclosure SystemEnclosure { get; }
/// <summary>
/// Gets <inheritdoc cref="MemoryDevice" />
/// </summary>
@@ -1257,6 +1303,11 @@ namespace LibreHardwareMonitor.Hardware
/// </summary>
public SystemInformation System { get; }
/// <summary>
/// Gets <inheritdoc cref="LibreHardwareMonitor.Hardware.SystemEnclosure" />
/// </summary>
public SystemEnclosure SystemEnclosure { get; }
private static string ReadSysFs(string path)
{
try