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

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

#include <windows.h>
#define MB (1024*1024)
//! network
void 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
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值