一、前言

之前在操作系统课程中,使用Java实现的任务管理器,使用了Swing界面、Runtime、Process相关类。文章总结和程序下载在下面:

Java调用批处理或可执行文件和Runtime、Process类实现Java版进程管理器:http://blog.csdn.net/ljheee/article/details/52067690

Java进程管理器MyProcess.rar----免积分下载:http://download.csdn.net/detail/ljheee/9598423

虽然基本功能实现了,Java跨平台的特性,也使得这个应用在Linux上跑,但是在实现这个版本之后就已经感觉到Java对操作系统信息的提取与封装是有限的,Process包含的进程信息有限,且操作不方便。

因此最近在Linux课程中,决定用Qt界面+Linux方式实现自己的Linux版任务管理器。在程序设计之前,有必要先了解下Linux系统进程信息提取方式,因为这种“Linux方式”不像Java的Process类封装那样,不管底层,只管调用  process.getInputStream();去读取流。

二、Linux下/proc目录简介

Linux内核提供了一种通过 /proc 文件系统,在运行时访问内核内部数据结构、改变内核设置的机制。proc文件系统是一个伪文件系统,它只存在内存当中,而不占用外存空间。它以文件系统的方式为访问系统内核数据的操作提供接口。

系统中当前运行的每一个进程都有对应的一个目录在/proc下,以进程的 PID号为目录名,它们是读取进程信息的接口。而self目录则是读取进程本身的信息接口,是一个link。

直接打开自己安装的Linux系统,进入/proc,可以看到很多数字命名的文件夹;文件夹名的数字,代表当前运行的一个进程的PID,它是读取进程信息的接口。

Linux下/proc下其他重要目录

/proc/cpuinfo     --cpu的信息

/proc/devices     --已经加载的设备并分类

/proc/modules     --所有加载到内核的模块列表

/proc/stat        --所有的CPU活动信息,可采点计算cpu的利用率

/proc/version     --Linux内核版本和gcc版本

三、Qt实现Linux版任务管理器

用户和应用程序可以通过/proc得到系统的信息,并可以改变内核的某些参数。由于系统的信息是动态改变的,所以用户或应用程序读取proc文件时,proc文件系统是动态从系统内核读出所需信息并提交的。

我们要显示系统信息,只需进行相应的文件操作就行了。

Qt的发展势头相当猛,qt的可移植性相当强,现在应用程序做界面基本都用Qt。Qt是诺基亚开发的一个跨平台的C++图形用户界面应用程序框架。Qt商业版只能试用30天,不过有GPL版的,可以免费使用。有一个非常不错的免费Qt集成开发环境QtCreator IDE。Linux版任务管理器采用的是Qt来实现图形界面。

步骤:

1、Linux下安装Qt Creator,打开新建一个工程,工程目录下,相关文件会有6个,具体见下图--工程文件夹:

编译完成后的实现效果:

“内存信息”模块:

“进程信息”模块:

“模块信息”模块:

“系统信息”模块:

“关于”模块:

完整源码如下:

main.cpp    工程运行的入口,创建工程时自动创建的,不需要修改。

#include <QApplication>
#include "mainwindow.h"int main(int argc, char *argv[])
{QApplication a(argc, argv);MainWindow w;w.show();return a.exec();
}

mainwindow.h  工程头文件,定义资源和事件响应函数声明。

#ifndef MAINWINDOW_H
#define MAINWINDOW_H#include <QMainWindow>
#include <QFile>
#include <QDir>
#include <QTimer>
#include <QMessageBox>
namespace Ui {
class MainWindow;
}class MainWindow : public QMainWindow
{Q_OBJECTpublic:explicit MainWindow(QWidget *parent = 0);~MainWindow();private:Ui::MainWindow *ui;//界面资源类,所有的界面元素都是通过该类来调用QTimer *timer; //计时器private slots:void on_pushButton_pkill_clicked();void on_pushButton_prefresh_clicked();void on_pushButton_Model_install_clicked();void on_pushButton_Model_remove_clicked();void on_pushButton_Model_refresh_clicked();void on_pushButton_reboot_clicked();void on_pushButton_halt_clicked();void on_tabWidget_INFO_currentChanged(int index);void timer_update_currentTabInfo();//显示tab中的内容void show_tabWidgetInfo(int index);
};#endif // MAINWINDOW_H

mainwindow.cpp  工程最重要的源文件,完成主要的业务逻辑。

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QListWidget>
#include <QListWidgetItem>
#include <QStringList>int a0 = 0, a1 = 0, b0 = 0, b1 = 0;MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent),ui(new Ui::MainWindow)
{ui->setupUi(this);timer = new QTimer(this);QWidget::connect( timer, SIGNAL( timeout() ), this, SLOT( timer_update_currentTabInfo() ) );//ui控件-事件响应QWidget::connect( ui->tabWidget_INFO, SIGNAL( currentChanged() ),this, SLOT( on_tabWidget_currentChanged() ) );timer->start(1000);
}MainWindow::~MainWindow()
{delete ui;delete timer;
}void MainWindow::timer_update_currentTabInfo()
{int index = ui->tabWidget_INFO->currentIndex();//定时器只刷新内存tab页面,用于进度条动态显示if (index == 0){show_tabWidgetInfo(index);}
}void MainWindow::show_tabWidgetInfo(int index)
{QString tempStr; //读取文件信息字符串QFile tempFile; //用于打开系统文件int pos; //读取文件的位置if (index == 0) //内存資源{tempFile.setFileName("/proc/meminfo"); //打开内存信息文件if ( !tempFile.open(QIODevice::ReadOnly) ){QMessageBox::warning(this, tr("warning"), tr("The meminfo file can not open!"), QMessageBox::Yes);return ;}QString memTotal;QString memFree;QString memUsed;QString swapTotal;QString swapFree;QString swapUsed;int nMemTotal, nMemFree, nMemUsed, nSwapTotal, nSwapFree, nSwapUsed;while (1){tempStr = tempFile.readLine();pos = tempStr.indexOf("MemTotal");if (pos != -1){memTotal = tempStr.mid(pos+10, tempStr.length()-13);memTotal = memTotal.trimmed();nMemTotal = memTotal.toInt()/1024;}else if (pos = tempStr.indexOf("MemFree"), pos != -1){memFree = tempStr.mid(pos+9, tempStr.length()-12);memFree = memFree.trimmed();nMemFree = memFree.toInt()/1024;}else if (pos = tempStr.indexOf("SwapTotal"), pos != -1){swapTotal = tempStr.mid(pos+11, tempStr.length()-14);swapTotal = swapTotal.trimmed();nSwapTotal = swapTotal.toInt()/1024;}else if (pos = tempStr.indexOf("SwapFree"), pos != -1){swapFree = tempStr.mid(pos+10,tempStr.length()-13);swapFree = swapFree.trimmed();nSwapFree = swapFree.toInt()/1024;break;}}nMemUsed = nMemTotal - nMemFree;nSwapUsed = nSwapTotal - nSwapFree;memUsed = QString::number(nMemUsed, 10);swapUsed = QString::number(nSwapUsed, 10);memFree = QString::number(nMemFree, 10);memTotal = QString::number(nMemTotal, 10);swapFree = QString::number(nSwapFree, 10);swapTotal = QString::number(nSwapTotal, 10);ui->label_RAM_Used->setText(memUsed+" MB");ui->label_RAM_Left->setText(memFree+" MB");ui->label_RAM_Total->setText(memTotal+" MB");ui->label_SWAP_Used->setText(swapUsed+" MB");ui->label_SWAP_Left->setText(swapFree+" MB");ui->label_SWAP_Total->setText(swapTotal+" MB");ui->progressBar_RAM->setValue(nMemUsed*100/nMemTotal);ui->progressBar_SWAP->setValue(nSwapUsed*100/nSwapTotal);tempFile.close(); //关闭内存信息文件int tt = 2; //取2个点采样计算cpu当前利用律int cpuInfo[2][7];int cpuTotal[2][2];while (tt){tempFile.setFileName("/proc/stat"); //打开CPU使用状态信息if ( !tempFile.open(QIODevice::ReadOnly) ){QMessageBox::warning(this, tr("warning"), tr("The stat file can not open!"), QMessageBox::Yes);return;}tempStr = tempFile.readLine();for (int i = 0; i < 7; i++){cpuInfo[2-tt][i] = tempStr.section(" ", i+1, i+1).toInt();cpuTotal[1][2-tt] += cpuInfo[2-tt][i];if (i == 3){cpuTotal[0][2-tt] += cpuInfo[2-tt][i];}}tt--;tempFile.close(); //关闭stat文件}int a = cpuTotal[0][1] - cpuTotal[0][0];int b = cpuTotal[1][1] - cpuTotal[1][0];if (a < 0){a = -a;}if (b < 0){b = -b;}ui->progressBar_CPU->setValue(a*100/b);tempFile.setFileName("/proc/stat");  //linux下用/proc/stat文件来计算cpu的利用率//这个文件包含了所有CPU活动的信息,该文件中的所有值都是从系统启动开始累计到当前时刻。if ( !tempFile.open(QIODevice::ReadOnly) ){QMessageBox::warning(this, tr("warning"), tr("The stat file can not open!"), QMessageBox::Yes);return;}tempStr = tempFile.readLine();a0 = a1;b0 = b1;a1 = b1 = 0;int gg;for (int i = 0; i < 7; i++){b1 += tempStr.section(" ", i+2, i+2).toInt();gg = b1;if (i == 3){a1 += tempStr.section(" ", i+2, i+2).toInt();}}int m, n;m = a1 - a0;n = b1 - b0;if (m < 0){m = -m;}if (n < 0){n = -n;}ui->progressBar_CPU->setValue( (n-m)*100/n );tempFile.close(); //关闭stat文件}else if (index == 1) //进程信息{ui->listWidget_process->clear();QDir qd("/proc");QStringList qsList = qd.entryList();QString qs = qsList.join("\n");QString id_of_pro;bool ok;int find_start = 3;int a, b;int nProPid; //进程PIDint number_of_sleep = 0, number_of_run = 0, number_of_zombie = 0;int totalProNum = 0; //进程总数QString proName; //进程名QString proState; //进程状态QString proPri; //进程优先级QString proMem; //进程占用内存QListWidgetItem *title = new QListWidgetItem("PID\t" + QString::fromUtf8("名称") + "\t\t" +QString::fromUtf8("状态") + "\t" +QString::fromUtf8("优先级") + "\t" +QString::fromUtf8("占用内存"), ui->listWidget_process);//循环读取进程while (1){//获取进程PIDa = qs.indexOf("\n", find_start);b = qs.indexOf("\n", a+1);find_start = b;id_of_pro = qs.mid(a+1, b-a-1);totalProNum++;nProPid = id_of_pro.toInt(&ok, 10);if(!ok){break;}//打开PID所对应的进程状态文件tempFile.setFileName("/proc/" + id_of_pro + "/stat");if ( !tempFile.open(QIODevice::ReadOnly) ){QMessageBox::warning(this, tr("warning"), tr("The pid stat file can not open!"), QMessageBox::Yes);return;}tempStr = tempFile.readLine();if (tempStr.length() == 0){break;}a = tempStr.indexOf("(");b = tempStr.indexOf(")");proName = tempStr.mid(a+1, b-a-1);proName.trimmed(); //删除两端的空格proState = tempStr.section(" ", 2, 2);proPri = tempStr.section(" ", 17, 17);proMem = tempStr.section(" ", 22, 22);switch ( proState.at(0).toLatin1() ){case 'S':   number_of_sleep++; break; //Sleepcase 'R':   number_of_run++; break; //Runningcase 'Z':   number_of_zombie++; break; //Zombiedefault :   break;}if (proName.length() >= 12){QListWidgetItem *item = new QListWidgetItem(id_of_pro + "\t" +proName + "\t" +proState + "\t" +proPri + "\t" +proMem, ui->listWidget_process);}else{QListWidgetItem *item = new QListWidgetItem(id_of_pro + "\t" +proName + "\t\t" +proState + "\t" +proPri + "\t" +proMem, ui->listWidget_process);}}QString temp;temp = QString::number(totalProNum, 10);ui->label_pNum->setText(temp);temp = QString::number(number_of_run, 10);ui->label_pRun->setText(temp);temp = QString::number(number_of_sleep, 10);ui->label_pSleep->setText(temp);temp = QString::number(number_of_zombie, 10);ui->label_pZombie->setText(temp);tempFile.close(); //关闭该PID进程的状态文件}else if (index == 2) //模块信息{ui->listWidget_model->clear();//sys/module 是一个 sysfs 目录层次, 包含当前加载模块的信息. /proc/moudles 是旧式的, 那种信息的单个文件版本. 其中的条目包含了模块名, 每个模块占用的内存数量, 以及使用计数. 另外的字串追加到每行的末尾来指定标志, 对这个模块当前是活动的.tempFile.setFileName("/proc/modules"); //打开模块信息文件if ( !tempFile.open(QIODevice::ReadOnly) ){QMessageBox::warning(this, tr("warning"), tr("The modules file can not open!"), QMessageBox::Yes);return ;}//设置模块首行项目QListWidgetItem *title = new QListWidgetItem( QString::fromUtf8("名称") + "\t\t\t" +QString::fromUtf8("使用内存数") + "\t\t" +QString::fromUtf8("使用次數"), ui->listWidget_model);QString mod_Name, mod_Mem, mod_Num;//循环读取文件内容,查找需要的信息while (1){tempStr = tempFile.readLine();if (tempStr.length() == 0){break;}mod_Name = tempStr.section(" ", 0, 0);mod_Mem = tempStr.section(" ", 1, 1);mod_Num = tempStr.section(" ", 2, 2);if (mod_Name.length() > 10){QListWidgetItem *item = new QListWidgetItem(mod_Name + "\t\t" +mod_Mem + "\t\t" +mod_Num, ui->listWidget_model);}else{QListWidgetItem *item = new QListWidgetItem(mod_Name + "\t\t\t" +mod_Mem + "\t\t" +mod_Num, ui->listWidget_model);}}tempFile.close(); //关闭模块信息文件}else if (index == 3) //系统信息{//int ok;tempFile.setFileName("/proc/cpuinfo"); //打开CPU信息文件if ( !tempFile.open(QIODevice::ReadOnly) ){QMessageBox::warning(this, tr("warning"), tr("The cpuinfo file can not open!"), QMessageBox::Yes);return;}//循环读取文件内容,查找需要的信息while (1){tempStr = tempFile.readLine();//QMessageBox::warning(this, tr("msg"), tempStr, QMessageBox::Yes);if(tempStr==NULL){//文件读完,跳出break;}pos = tempStr.indexOf("model name");if (pos != -1){pos += 13; //跳过前面的"model name:"所占用的字符QString *cpu_name = new QString( tempStr.mid(pos, tempStr.length()-13) );ui->label_CPUName->setText(*cpu_name);}else if (pos = tempStr.indexOf("vendor_id"), pos != -1){pos += 12; //跳过前面的"vendor_id:"所占用的字符QString *cpu_type = new QString( tempStr.mid(pos, tempStr.length()-12) );ui->label_CPUType->setText(*cpu_type);}else if (pos = tempStr.indexOf("cpu MHz"), pos != -1){pos += 11; //跳过前面的"cpu MHz:"所占用的字符QString *cpu_frq = new QString( tempStr.mid(pos, tempStr.length()-11) );double cpufrq = cpu_frq->toDouble(); //4核CPUcpu_frq->setNum(cpufrq*4);ui->label_CPUFrequency->setText(*cpu_frq + " HZ");}else if (pos = tempStr.indexOf("cache size"), pos!=-1){pos += 13; //跳过前面的"cache size:"所占用的字符QString *cache_size = new QString( tempStr.mid(pos, tempStr.length()-16) );int cachesize = cache_size->toInt(); //4核CPUcache_size->setNum(cachesize*4);ui->label_CatheCapacity->setText(*cache_size + " KB");}else //跳过其他的内容{}}tempFile.close(); //关闭CPU信息文件//打开操作系统信息文件tempFile.setFileName("/proc/version");if ( !tempFile.open(QIODevice::ReadOnly) ){QMessageBox::warning(this, tr("warning"), tr("The version file can not open!"), QMessageBox::Yes);return ;}tempStr = tempFile.readLine();pos = tempStr.indexOf("version");QString *os_version = new QString( tempStr.mid(0, pos-1) );ui->label_SystemType->setText(*os_version);int pos1 = tempStr.indexOf("(");QString *os_type = new QString( tempStr.mid(pos, pos1-pos-1) );ui->label_SystemVersion->setText(*os_type);pos = tempStr.indexOf("gcc version");pos1 = tempStr.indexOf("#");QString *gcc_info = new QString( tempStr.mid(pos+12, pos1-pos-14) );ui->label_GCCVersion->setText(*gcc_info);tempFile.close(); //关闭操作系统信息文件}else //说明{}return;}void MainWindow::on_pushButton_halt_clicked(){system("halt");}void MainWindow::on_pushButton_reboot_clicked(){system("reboot");}void MainWindow::on_tabWidget_INFO_currentChanged(int index){show_tabWidgetInfo(index); //显示tab中的内容return ;}//杀死进程void MainWindow::on_pushButton_pkill_clicked(){//获得进程号QListWidgetItem *item = ui->listWidget_process->currentItem();QString pro = item->text();pro = pro.section("\t", 0, 0);system("kill " + pro.toLatin1());QMessageBox::warning(this, tr("kill"), QString::fromUtf8("该进程已被杀死!"), QMessageBox::Yes);//回到进程信息tab表show_tabWidgetInfo(1);}//刷新进程信息void MainWindow::on_pushButton_prefresh_clicked(){show_tabWidgetInfo(1);}void MainWindow::on_pushButton_Model_install_clicked(){show_tabWidgetInfo(2); //安装模块还不知道如何实现QMessageBox::warning(this, tr("tip"), tr("安装模块还不知道如何实现"), QMessageBox::Yes);}void MainWindow::on_pushButton_Model_remove_clicked(){show_tabWidgetInfo(2);//卸载模块还不知道如何实现QMessageBox::warning(this, tr("tip"), tr("卸载模块还不知道如何实现"), QMessageBox::Yes);}void MainWindow::on_pushButton_Model_refresh_clicked(){show_tabWidgetInfo(2);QMessageBox::warning(this, tr("tip"), tr("刷新模块还不知道如何实现"), QMessageBox::Yes);}

Mainwindow.ui 工程界面文件。

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"><class>MainWindow</class><widget class="QMainWindow" name="MainWindow"><property name="geometry"><rect><x>0</x><y>0</y><width>605</width><height>438</height></rect></property><property name="windowTitle"><string>MainWindow</string></property><widget class="QWidget" name="centralWidget"><widget class="QTabWidget" name="tabWidget_INFO"><property name="geometry"><rect><x>0</x><y>-10</y><width>611</width><height>341</height></rect></property><property name="cursor"><cursorShape>WaitCursor</cursorShape></property><property name="tabShape"><enum>QTabWidget::Triangular</enum></property><property name="currentIndex"><number>3</number></property><property name="movable"><bool>false</bool></property><widget class="QWidget" name="MemoryInfo"><property name="toolTip"><string><html><head/><body><p>内存信息</p></body></html></string></property><property name="whatsThis"><string><html><head/><body><p>内存信息</p></body></html></string></property><attribute name="title"><string>内存信息</string></attribute><widget class="QGroupBox" name="groupBox"><property name="geometry"><rect><x>0</x><y>0</y><width>591</width><height>81</height></rect></property><property name="title"><string>CPU</string></property><widget class="QProgressBar" name="progressBar_CPU"><property name="geometry"><rect><x>50</x><y>30</y><width>431</width><height>23</height></rect></property><property name="value"><number>24</number></property></widget><widget class="QLabel" name="label_11"><property name="geometry"><rect><x>0</x><y>30</y><width>66</width><height>17</height></rect></property><property name="text"><string>CPU:</string></property></widget></widget><widget class="QGroupBox" name="groupBox_2"><property name="geometry"><rect><x>0</x><y>80</y><width>591</width><height>231</height></rect></property><property name="title"><string>内存和交换分区</string></property><widget class="QProgressBar" name="progressBar_RAM"><property name="geometry"><rect><x>50</x><y>50</y><width>431</width><height>23</height></rect></property><property name="value"><number>24</number></property></widget><widget class="QProgressBar" name="progressBar_SWAP"><property name="geometry"><rect><x>50</x><y>140</y><width>431</width><height>23</height></rect></property><property name="value"><number>24</number></property></widget><widget class="QLabel" name="label_9"><property name="geometry"><rect><x>0</x><y>50</y><width>66</width><height>17</height></rect></property><property name="text"><string>内存:</string></property></widget><widget class="QLabel" name="label_10"><property name="geometry"><rect><x>0</x><y>140</y><width>66</width><height>17</height></rect></property><property name="text"><string>交换</string></property></widget><widget class="QLabel" name="label_12"><property name="geometry"><rect><x>50</x><y>80</y><width>66</width><height>17</height></rect></property><property name="text"><string>Used:</string></property></widget><widget class="QLabel" name="label_13"><property name="geometry"><rect><x>200</x><y>80</y><width>66</width><height>17</height></rect></property><property name="text"><string>Left:</string></property></widget><widget class="QLabel" name="label_14"><property name="geometry"><rect><x>380</x><y>80</y><width>66</width><height>17</height></rect></property><property name="text"><string>Total:</string></property></widget><widget class="QLabel" name="label_15"><property name="geometry"><rect><x>380</x><y>170</y><width>66</width><height>17</height></rect></property><property name="text"><string>Total:</string></property></widget><widget class="QLabel" name="label_16"><property name="geometry"><rect><x>50</x><y>170</y><width>66</width><height>17</height></rect></property><property name="text"><string>Used:</string></property></widget><widget class="QLabel" name="label_20"><property name="geometry"><rect><x>200</x><y>170</y><width>66</width><height>17</height></rect></property><property name="text"><string>Left:</string></property></widget><widget class="QLabel" name="label_RAM_Used"><property name="geometry"><rect><x>90</x><y>80</y><width>66</width><height>17</height></rect></property><property name="text"><string>0</string></property></widget><widget class="QLabel" name="label_RAM_Left"><property name="geometry"><rect><x>240</x><y>80</y><width>66</width><height>17</height></rect></property><property name="text"><string>0</string></property></widget><widget class="QLabel" name="label_RAM_Total"><property name="geometry"><rect><x>420</x><y>80</y><width>66</width><height>17</height></rect></property><property name="text"><string>0</string></property></widget><widget class="QLabel" name="label_SWAP_Total"><property name="geometry"><rect><x>420</x><y>170</y><width>66</width><height>17</height></rect></property><property name="text"><string>0</string></property></widget><widget class="QLabel" name="label_SWAP_Used"><property name="geometry"><rect><x>90</x><y>170</y><width>66</width><height>17</height></rect></property><property name="text"><string>0</string></property></widget><widget class="QLabel" name="label_SWAP_Left"><property name="geometry"><rect><x>240</x><y>170</y><width>66</width><height>17</height></rect></property><property name="text"><string>0</string></property></widget></widget></widget><widget class="QWidget" name="Process"><attribute name="title"><string>进程信息</string></attribute><widget class="QListWidget" name="listWidget_process"><property name="geometry"><rect><x>0</x><y>0</y><width>421</width><height>271</height></rect></property></widget><widget class="QPushButton" name="pushButton_pkill"><property name="geometry"><rect><x>20</x><y>280</y><width>98</width><height>27</height></rect></property><property name="text"><string>kill</string></property></widget><widget class="QPushButton" name="pushButton_prefresh"><property name="geometry"><rect><x>170</x><y>280</y><width>98</width><height>27</height></rect></property><property name="text"><string>refresh</string></property></widget><widget class="QLabel" name="label"><property name="geometry"><rect><x>430</x><y>30</y><width>66</width><height>17</height></rect></property><property name="text"><string>进程数:</string></property></widget><widget class="QLabel" name="label_pNum"><property name="geometry"><rect><x>490</x><y>30</y><width>66</width><height>17</height></rect></property><property name="text"><string>0</string></property></widget><widget class="QLabel" name="label_2"><property name="geometry"><rect><x>430</x><y>60</y><width>66</width><height>17</height></rect></property><property name="text"><string>运行数:</string></property></widget><widget class="QLabel" name="label_3"><property name="geometry"><rect><x>430</x><y>100</y><width>66</width><height>17</height></rect></property><property name="text"><string>睡眠数:</string></property></widget><widget class="QLabel" name="label_4"><property name="geometry"><rect><x>430</x><y>140</y><width>66</width><height>17</height></rect></property><property name="text"><string>浆死数:</string></property></widget><widget class="QLabel" name="label_pRun"><property name="geometry"><rect><x>490</x><y>60</y><width>66</width><height>17</height></rect></property><property name="text"><string>0</string></property></widget><widget class="QLabel" name="label_pSleep"><property name="geometry"><rect><x>490</x><y>100</y><width>66</width><height>17</height></rect></property><property name="text"><string>0</string></property></widget><widget class="QLabel" name="label_pZombie"><property name="geometry"><rect><x>490</x><y>140</y><width>66</width><height>17</height></rect></property><property name="text"><string>0</string></property></widget></widget><widget class="QWidget" name="Module"><attribute name="title"><string>模块信息</string></attribute><widget class="QPushButton" name="pushButton_Model_install"><property name="geometry"><rect><x>20</x><y>280</y><width>98</width><height>27</height></rect></property><property name="text"><string>Install</string></property></widget><widget class="QPushButton" name="pushButton_Model_remove"><property name="geometry"><rect><x>180</x><y>280</y><width>98</width><height>27</height></rect></property><property name="text"><string>Romove</string></property></widget><widget class="QPushButton" name="pushButton_Model_refresh"><property name="geometry"><rect><x>350</x><y>280</y><width>98</width><height>27</height></rect></property><property name="text"><string>refresh</string></property></widget><widget class="QListWidget" name="listWidget_model"><property name="geometry"><rect><x>0</x><y>0</y><width>561</width><height>271</height></rect></property></widget></widget><widget class="QWidget" name="System"><attribute name="title"><string>系统信息</string></attribute><widget class="QGroupBox" name="groupBox_3"><property name="geometry"><rect><x>0</x><y>0</y><width>591</width><height>171</height></rect></property><property name="title"><string>处理器信息</string></property><widget class="QLabel" name="label_5"><property name="geometry"><rect><x>50</x><y>30</y><width>66</width><height>17</height></rect></property><property name="text"><string>CPU名称:</string></property></widget><widget class="QLabel" name="label_6"><property name="geometry"><rect><x>50</x><y>60</y><width>66</width><height>17</height></rect></property><property name="text"><string>CPU类型:</string></property></widget><widget class="QLabel" name="label_7"><property name="geometry"><rect><x>50</x><y>90</y><width>66</width><height>17</height></rect></property><property name="text"><string>CPU频率:</string></property></widget><widget class="QLabel" name="label_8"><property name="geometry"><rect><x>50</x><y>120</y><width>81</width><height>17</height></rect></property><property name="text"><string>Cache大小:</string></property></widget><widget class="QLabel" name="label_CPUName"><property name="geometry"><rect><x>140</x><y>30</y><width>321</width><height>17</height></rect></property><property name="text"><string>未知</string></property></widget><widget class="QLabel" name="label_CPUType"><property name="geometry"><rect><x>140</x><y>60</y><width>151</width><height>17</height></rect></property><property name="text"><string>未知</string></property></widget><widget class="QLabel" name="label_CPUFrequency"><property name="geometry"><rect><x>140</x><y>90</y><width>66</width><height>17</height></rect></property><property name="text"><string>未知</string></property></widget><widget class="QLabel" name="label_CatheCapacity"><property name="geometry"><rect><x>140</x><y>120</y><width>66</width><height>17</height></rect></property><property name="text"><string>未知</string></property></widget></widget><widget class="QGroupBox" name="groupBox_4"><property name="geometry"><rect><x>0</x><y>180</y><width>591</width><height>121</height></rect></property><property name="title"><string>操作系统信息</string></property><widget class="QLabel" name="label_17"><property name="geometry"><rect><x>70</x><y>30</y><width>111</width><height>17</height></rect></property><property name="text"><string>操作系统类型:</string></property></widget><widget class="QLabel" name="label_18"><property name="geometry"><rect><x>70</x><y>60</y><width>111</width><height>17</height></rect></property><property name="text"><string>操作系统版本:</string></property></widget><widget class="QLabel" name="label_19"><property name="geometry"><rect><x>70</x><y>90</y><width>111</width><height>17</height></rect></property><property name="text"><string>GCC编译器:</string></property></widget><widget class="QLabel" name="label_SystemType"><property name="geometry"><rect><x>190</x><y>30</y><width>151</width><height>17</height></rect></property><property name="text"><string>未知</string></property></widget><widget class="QLabel" name="label_SystemVersion"><property name="geometry"><rect><x>190</x><y>60</y><width>281</width><height>17</height></rect></property><property name="text"><string>未知</string></property></widget><widget class="QLabel" name="label_GCCVersion"><property name="geometry"><rect><x>190</x><y>90</y><width>291</width><height>17</height></rect></property><property name="text"><string>未知</string></property></widget></widget></widget><widget class="QWidget" name="tab"><attribute name="title"><string>关于</string></attribute><widget class="QLabel" name="label_21"><property name="geometry"><rect><x>20</x><y>30</y><width>66</width><height>17</height></rect></property><property name="text"><string>项目名:</string></property></widget><widget class="QLabel" name="label_22"><property name="geometry"><rect><x>100</x><y>30</y><width>191</width><height>17</height></rect></property><property name="text"><string>Linux下Qt实现任务管理器</string></property></widget><widget class="QLabel" name="label_23"><property name="geometry"><rect><x>100</x><y>70</y><width>191</width><height>17</height></rect></property><property name="text"><string>ljheee  </string></property></widget><widget class="QLabel" name="label_24"><property name="geometry"><rect><x>20</x><y>70</y><width>66</width><height>17</height></rect></property><property name="text"><string>作者:</string></property></widget><widget class="QLabel" name="label_25"><property name="geometry"><rect><x>100</x><y>110</y><width>191</width><height>17</height></rect></property><property name="text"><string>2017-4-10</string></property></widget><widget class="QLabel" name="label_26"><property name="geometry"><rect><x>20</x><y>110</y><width>66</width><height>17</height></rect></property><property name="text"><string>时间:</string></property></widget><widget class="QLabel" name="label_27"><property name="geometry"><rect><x>100</x><y>150</y><width>191</width><height>17</height></rect></property><property name="text"><string>QQ554278334</string></property></widget><widget class="QLabel" name="label_28"><property name="geometry"><rect><x>20</x><y>150</y><width>66</width><height>17</height></rect></property><property name="text"><string>联系:</string></property></widget></widget></widget><widget class="QPushButton" name="pushButton_reboot"><property name="geometry"><rect><x>380</x><y>340</y><width>98</width><height>27</height></rect></property><property name="text"><string>reboot</string></property></widget><widget class="QPushButton" name="pushButton_halt"><property name="geometry"><rect><x>500</x><y>340</y><width>98</width><height>27</height></rect></property><property name="text"><string>shutdown</string></property></widget></widget><widget class="QMenuBar" name="menuBar"><property name="geometry"><rect><x>0</x><y>0</y><width>605</width><height>26</height></rect></property><widget class="QMenu" name="menuSysMontior"><property name="title"><string>SysMontior</string></property></widget><addaction name="menuSysMontior"/></widget><widget class="QToolBar" name="mainToolBar"><attribute name="toolBarArea"><enum>TopToolBarArea</enum></attribute><attribute name="toolBarBreak"><bool>false</bool></attribute></widget><widget class="QStatusBar" name="statusBar"/></widget><layoutdefault spacing="6" margin="11"/><resources/><connections/>
</ui>

 Qt实现Linux任务管理器SysMonitor.ziphttp://download.csdn.net/detail/ljheee/9817990

 

 

 

 

 

 

自己实现Linux系统任务管理器(附源码)相关推荐

  1. 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(10)-系统菜单栏[附源码]

    构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(10)-系统菜单栏[附源码] 原文:构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后 ...

  2. java计算机毕业设计钢材出入库管理系统(附源码、数据库)

    java计算机毕业设计钢材出入库管理系统(附源码.数据库) 项目运行 环境配置: Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX(Webstorm也行)+ Eclispe ...

  3. java计算机毕业设计BS用户小票系统(附源码、数据库)

    java计算机毕业设计BS用户小票系统(附源码.数据库) 项目运行 环境配置: Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX(Webstorm也行)+ Eclispe( ...

  4. JAVA计算机毕业设计校园订餐系统(附源码、数据库)

    JAVA计算机毕业设计校园订餐系统(附源码.数据库) 目运行 环境项配置: Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX(Webstorm也行)+ Eclispe(In ...

  5. JAVA计算机毕业设计喜枫日料店自助点餐系统(附源码、数据库)

    JAVA计算机毕业设计喜枫日料店自助点餐系统(附源码.数据库) 目运行 环境项配置: Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX(Webstorm也行)+ Eclis ...

  6. JAVA计算机毕业设计网课系统(附源码、数据库)

    JAVA计算机毕业设计网课系统(附源码.数据库) 目运行 环境项配置: Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX(Webstorm也行)+ Eclispe(Inte ...

  7. JAVA计算机毕业设计漫画网站系统(附源码、数据库)

    JAVA计算机毕业设计漫画网站系统(附源码.数据库) 目运行 环境项配置: Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX(Webstorm也行)+ Eclispe(In ...

  8. 一款仿网易云音乐Java开源系统(附源码)

    嗨喽!Java后端编程的各位小伙伴们,由于公众号做了乱序推送改版,为了保证公众号的推文能够第一时间及时送达到大家手上,大家记得将公众号 加星标置顶 ,公众号每天会送上Java技术干货推文 ! 上篇推文 ...

  9. java计算机毕业设计飞机航班信息查询系统(附源码、数据库)

    java计算机毕业设计飞机航班信息查询系统(附源码.数据库) 项目运行 环境配置: Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX(Webstorm也行)+ Eclisp ...

最新文章

  1. mysql update 有中文_MySQL Update语句一个非常经典的“坑”
  2. 开发日记-20190514 关键词 汇编语言(七)
  3. Qt程序运行提示“it could not find or load the QT platform plugin “windows””
  4. buu [BJDCTF 2nd]rsa0
  5. python sendto函数返回值_有返回值的函数amp;闭包(python)
  6. 并发运行的最佳实践_并发最佳实践
  7. Java8 Stream详解~ 提取/组合
  8. linux实战(1)
  9. 笨办法学 Python · 续 练习 24:URL 快速路由
  10. php多维数组key交换,php 根据key计算多维数组的和功能实例
  11. Python中列表的增、删、改、查、排序
  12. 机器学习与神经网络的学习
  13. 朱利亚 matlab分形图,分形实例的赏析
  14. HTML网页头部小图标
  15. 在家佛弟子对待工作的态度——世俗八正道
  16. python识别图片中的人_Python实现识别图片中的所有人脸并显示出来
  17. 100% 搭建你自己的匿名网站(暗网网站)
  18. 怎么用python编写个apk_【android】如何利用python做Android项目自动化构建,并一键实现构建结果发送到钉钉通知以及通过二维码下载apk或者其他处理等功能...
  19. Android 自定义下拉菜单的实现(基于PopupWindow+RecyclerView)
  20. Opencv中waitKey()

热门文章

  1. 皇家贝贝《秦俑情》开机 杜淳安以轩“接棒”张艺谋巩俐
  2. 制作API离线chm帮助文件教程
  3. ATM模拟器(附代码及运行结果)
  4. emeditor正则表达式_Emeditor中使用正则表达式的一些技巧
  5. Spring-Cloud-Config快速开始
  6. 龙应台:孩子,我为什么要求你读书?
  7. opencv球体追踪
  8. 小程序——调用手机地图app
  9. 【交叉编译】什么是交叉编译,为何要有交叉编译?
  10. 易语言大漠插件模块制作后台设置后台绑定窗口句柄