mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2025-12-14 02:52:03 +08:00
大体功能完成
This commit is contained in:
48
VM-source/infoutils.h
Normal file
48
VM-source/infoutils.h
Normal file
@@ -0,0 +1,48 @@
|
||||
#ifndef INFOUTILS_H
|
||||
#define INFOUTILS_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#define PROC_UPTIME "/proc/uptime"
|
||||
#define PROC_CPU "/proc/stat"
|
||||
#define PROC_MEM "/proc/meminfo"
|
||||
#define PROC_NET "/proc/net/dev"
|
||||
|
||||
class infoUtils : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum RateUnit {
|
||||
RateBit,
|
||||
RateByte,
|
||||
RateKb,
|
||||
RateMb,
|
||||
RateGb,
|
||||
RateTb,
|
||||
RateUnknow
|
||||
};
|
||||
Q_ENUM(RateUnit)
|
||||
|
||||
enum Sensitive {
|
||||
Default, // 大小写混合
|
||||
Upper, // 全部大写
|
||||
Lower // 全部小写
|
||||
};
|
||||
public:
|
||||
explicit infoUtils(QObject *parent = nullptr);
|
||||
|
||||
static QString setRateUnitSensitive(RateUnit unit, Sensitive sensitive);
|
||||
static double autoRateUnits(long speed, RateUnit &unit);
|
||||
|
||||
static void uptime(double &run, double &idle);
|
||||
static void netRate(long &netDown, long &netUpload);
|
||||
static void cpuRate(long &cpuAll, long &cpuFree);
|
||||
static void memoryRate(long &memory, long &memoryAll, long &swap, long &swapAll);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
};
|
||||
|
||||
#endif // INFOUTILS_H
|
||||
Reference in New Issue
Block a user