Comments (3)
What exactly do you mean by cpuid?
If you mean the x86 instruction: hwinfo uses it on x86 machines to get processor information and provides them in the ˋhwinfo::CPUˋ class.
from hwinfo.
yes, in x86, this code could get the cpu id:
void getCpuId(int cpuInfo[], int infoType)
{
#if 0
#ifdef Q_OS_WIN
// #include "intrin.h"
//__cpuid(cpuInfo, infoType);return;
#if _MSC_VER
int excValue = 0;
_asm {
mov edi, cpuInfo;
mov eax, infoType;
mov ecx, excValue;
cpuid;
mov [edi], eax;
mov [edi+4], ebx;
mov [edi+8], ecx;
mov [edi+12], edx;
}
#else
asm volatile
(
"cpuid"
: "=a"(cpuInfo[0]), "=b"(cpuInfo[1]), "=c"(cpuInfo[2]), "=d"(cpuInfo[3])
: "a"(infoType)
);
#endif
#endif
#endif
}
QString getCpuId2()
{
QString cpu_id;
int cpuInfo[4] = {0};
getCpuId(cpuInfo, 1);
QString str0 = QString::number((quint32)cpuInfo[3], 16).toUpper();
str0 = str0.rightJustified(8, '0');
QString str1 = QString::number((quint32)cpuInfo[0], 16).toUpper();
str1 = str1.rightJustified(8, '0');
cpu_id = str0 + str1;
return cpu_id;
}
but how to get the cpuid in linux?
from hwinfo.
Looks like this question is not related to hwinfo. Please consider using c++/x86/assembler related forums for this kind of questions.
However cpuid.h implements a platform independent cpuid call.
from hwinfo.
Related Issues (20)
- Support for more monitoring features HOT 2
- Make OpenCL an optional dependency HOT 8
- Please allow using an external `libfmt`
- GitHub Action fails for MSVC build
- [Linux] PCIMapper pci.ids file location bug HOT 1
- RAM on Windows only returns the information for 1 DIMM HOT 2
- Memory Module information in Linux HOT 1
- Bringing back OSX support HOT 1
- Return objects by value to exploit NRVO
- Can you provide Findhwconfig.cmake for ease of use with CMake? HOT 1
- ubuntu20.04 arm,compile errors: HOT 1
- memory leak HOT 4
- Setup Release
- Touchpad support HOT 2
- Add support for uwp apps HOT 1
- Expose GPU vendor_id and device_id on Windows
- Mingw64 a build problem HOT 1
- Windows: Incorrect handling IEnumWbemClassObject::Next calls
- Make HWinfo modular HOT 2
- Problems with Qt GUI app on Windows11 and hwinfo HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hwinfo.