Welcome to "Little 5 Lecture Hall", hello everyone, I am Full Stack Little 5.
This is the "Drive Sequence" article. Each article will be explained from the perspective of the blogger's understanding,
especially the concepts of knowledge points. Most of the articles will verify these concepts with actual examples to deepen the understanding. Understanding and mastering of knowledge points.
Warm reminder: The blogger's ability and understanding are limited. Please correct me if there is something wrong!
Table of contents
CPU information
Generally, CPU hardware will have that information!
Basic Information
Manufacturer, processor, number of cores, number of threads, architecture, processor ID
Effect
code
Task.Run(() =>
{
// 创建 ManagementObjectSearcher 对象
ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from Win32_Processor");
// 执行查询并获取结果集
ManagementObjectCollection collection = searcher.Get();
// 遍历结果集并输出 CPU 信息
foreach (ManagementObject obj in collection)
{
textBox1.AppendText($"处理器: {
obj["Name"]}\r\n");
textBox1.AppendText($"制造商: {
obj["Manufacturer"]}\r\n");
textBox1.AppendText($"核心数量: {
obj["NumberOfCores"]}\r\n");
textBox1.AppendText($"线程数量: {
obj["NumberOfLogicalProcessors"]}\r\n");
textBox1.AppendText($"架构: {
obj["Architecture"]}\r\n");
textBox1.AppendText($"处理器ID: {
obj["Architecture"]}\r\n");
//textBox1.AppendText($"CPU 驱动版本: {obj["DriverVersion"]}\r\n");
}
});
details
See the complete fields and explanations of the Win32_Processor class in the official Microsoft documentation.
Link to the documentation for this class: Win32_Processor class (Windows)
On the left side of the documentation page you can find all the fields of this class in the "Properties" section.
Click on each field name, and you can view its detailed description, data type, access permissions, and the required WMI service and object name with this field.
Effect
code
using System;
using System.Management;
namespace CPUDetails
{
class Program
{
static void Main(string[] args)
{
ManagementClass mc = new ManagementClass("Win32_Processor");
foreach (PropertyData prop in mc.Properties)
{
Console.WriteLine(prop.Name);
}
}
}
}
Field description
The following is only the literal meaning of the fields. If there is anything wrong, please correct me.
serial number | Chinese | English |
---|---|---|
1 | AddressWidth | Address length |
2 | Architecture | Architecture |
3 | AssetTag | Asset tag information |
4 | Availability | processor |
5 | Caption | describe |
6 | Caption | describe |
CPU brand
Why is it necessary to collect brand information? As you can see from the CPU information output above, the output is all in English, so it needs to be converted from English into the familiar Chinese.
Later, the CPU brand can be saved separately in the database table, and a mapping relationship can be made to facilitate matching and display.
Common brands
serial number | Chinese | English |
---|---|---|
1 | Godson | Loongson |
2 | Intel | Intel |
3 | Qualcomm | Qualcomm |
4 | Nvidia | NVIDIA |
5 | AMD | Advanced Micro Devices |
6 | Hynix | Hynix |
7 | Micron | Micron |
8 | Broadcom | Broadcom |
9 | MediaTek | Mediatek |
10 | HiSilicon | Hisilicon |
11 | core | kr |
12 | MSI | msi |
13 | soar | PYTHIUM |
14 | Shenwei | |
15 | Samsung | SAMSUNG |
16 | MediaTek | Mediatek |
Summary: Review the past and learn the new. Reviewing knowledge points at different stages will lead to different understandings and understandings. The blogger will consolidate the knowledge points and share them with everyone in a practical way. If it can be helpful and gainful, this will be a blog post. The Lord’s greatest creative motivation and honor. I also look forward to meeting more outstanding new and old bloggers.