QT 获取计算机当前cup 内存 等信息

来源:互联网 发布:centos解压命令 编辑:程序博客网 时间:2024/06/05 05:40

http://blog.csdn.net/amars_ding/article/details/54580441

#include <windows.h>#define MB (1024*1024)//! networkvoid MainWindow::on_network_clicked(){    SYSTEM_INFO systemInfo;    GetSystemInfo(&systemInfo);    qDebug() << QString::fromUtf8("处理器掩码:") << systemInfo.dwActiveProcessorMask;    qDebug() << QString::fromUtf8("处理器个数:") << systemInfo.dwNumberOfProcessors;    qDebug() << QString::fromUtf8("处理器分页大小:") << systemInfo.dwPageSize;    qDebug() << QString::fromUtf8("处理器类型:") << systemInfo.dwProcessorType;    qDebug() << QString::fromUtf8("最大寻址单元:") << systemInfo.lpMaximumApplicationAddress;    qDebug() << QString::fromUtf8("最小寻址单元:") << systemInfo.lpMinimumApplicationAddress;    qDebug() << QString::fromUtf8("处理器等级:") << systemInfo.wProcessorLevel;    qDebug() << QString::fromUtf8("处理器版本:") << systemInfo.wProcessorRevision;    qDebug() << "----------------------------------------";    MEMORYSTATUSEX statex;    statex.dwLength = sizeof (statex);    GlobalMemoryStatusEx (&statex);    qDebug() << /*QString::fromUtf8("物理内存使用率:") <<*/ statex.dwMemoryLoad;    qDebug() <</* QString::fromUtf8("物理内存总量:") <<*/ statex.ullTotalPhys/MB;    qDebug() << /*QString::fromUtf8("可用的物理内存:") <<*/ statex.ullAvailPhys/MB;    qDebug() << /*QString::fromUtf8("系统页面文件大小:") <<*/ statex.ullTotalPageFile/MB;    qDebug() << /*QString::fromUtf8("系统可用页面文件大小:") <<*/ statex.ullAvailPageFile/MB;    qDebug() << /*QString::fromUtf8("虚拟内存总量:") << */statex.ullTotalVirtual/MB;    qDebug() << /*QString::fromUtf8("可用的虚拟内存:") << */statex.ullAvailVirtual/MB;    qDebug() << /*QString::fromUtf8("保留(值为0):") <<*/ statex.ullAvailExtendedVirtual/MB;}



0 0
原创粉丝点击