DtkDevice
DTK library for device.
dprocessdevice.h
1// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4#ifndef DPROCESSDEVICE_H
5#define DPROCESSDEVICE_H
6
7#include "dtkdevice_global.h"
8
9#include <QObject>
10
11DDEVICE_BEGIN_NAMESPACE
12
13class DProcessDevicePrivate;
14class LIBDTKDEVICESHARED_EXPORT DProcessDevice : public QObject
15{
16public:
18 QString name;
19 int type;
20 QString cmdline; //bool Process::readCmdline()
21 QString usrerName;
22 quint32 mask; // mask
23 pid_t pid; // pid
24 QByteArray icon;
25 };
26
28 quint64 vmsize; // vm size in kB
29 quint64 rss; // resident set size in kB
30 quint64 shm; // resident shared size in kB
31 };
32
34 quint64 readBytes; // disk read bytes
35 quint64 writeBytes; // disk write bytes
36 quint64 cancelledWriteBytes; // cancelled write bytes
37 };
38
40 quint64 recvBytes;
41 quint64 sentBytes;
42 };
43
45 char state; // process state
46 pid_t ppid; // parent process
47 gid_t pgid; // process group id
48 uid_t uid; // real uid
49 gid_t gid; // real gid
50 uid_t euid; // effective uid
51 gid_t egid; // effective gid
52 uid_t suid; // saved uid
53 gid_t sgid; // saved gid
54 uid_t fuid; // filesystem uid
55 gid_t fgid; // filesystem gid
56
57 quint32 processor; // cpu number
58 quint32 rtPrio; // real time priority
59 quint32 policy; // scheduling policy
60 quint32 nthreads; // number of threads
61 int nice; // process nice
62
63 quint64 utime; // user time
64 quint64 stime; // kernel time
65 qint64 cutime; // user time on waiting children
66 qint64 cstime; // kernel time on waiting children
67 quint64 startTime; // start time since system boot in clock ticks
68 quint64 guestTime; // guest time (virtual cpu time for guest os)
69 qint64 cguestTime; // children guest time in clock ticks
70 quint64 wtime; // time spent waiting on a runqueue
71 };
72
73 explicit DProcessDevice(QObject *parent = nullptr);
75
76 QList<pid_t> allPids();
77 QHash<QString, QString> environment(pid_t pid);
78 QString groupName(const gid_t &gid);
84
85private:
86 QScopedPointer<DProcessDevicePrivate> d_ptr;
87 Q_DECLARE_PRIVATE(DProcessDevice)
88};
89
90DDEVICE_END_NAMESPACE
91
92#endif // DPROCESSDEVICE_H
应用信息.
Definition: dprocessdevice.h:15
DProcessNetworkInfo networkInfo(pid_t pid)
获取指定应用的网络信息.
QString groupName(const gid_t &gid)
获取指定组的名称.
DProcessBaseInfo baseInfo(pid_t pid)
获取指定应用的基本信息.
DProcessMemoryInfo memoryInfo(pid_t pid)
获取指定应用的内存信息.
DProcessIOInfo ioInfo(pid_t pid)
获取指定应用的IO信息.
QList< pid_t > allPids()
获取所有应用ID.
DProcessStatus status(pid_t pid)
获取指定应用的状态信息.
QHash< QString, QString > environment(pid_t pid)
获取指定应用的环境信息.
应用基础信息
Definition: dprocessdevice.h:17
QString name
Definition: dprocessdevice.h:18
pid_t pid
Definition: dprocessdevice.h:23
QByteArray icon
Definition: dprocessdevice.h:24
quint32 mask
Definition: dprocessdevice.h:22
QString usrerName
Definition: dprocessdevice.h:21
int type
Definition: dprocessdevice.h:19
QString cmdline
Definition: dprocessdevice.h:20
应用IO状态信息
Definition: dprocessdevice.h:33
quint64 cancelledWriteBytes
Definition: dprocessdevice.h:36
quint64 writeBytes
Definition: dprocessdevice.h:35
quint64 readBytes
void Process::readIO()
Definition: dprocessdevice.h:34
应用内存状态信息
Definition: dprocessdevice.h:27
quint64 vmsize
bool Process::readStatm()
Definition: dprocessdevice.h:28
quint64 shm
Definition: dprocessdevice.h:30
quint64 rss
Definition: dprocessdevice.h:29
应用网络状态信息
Definition: dprocessdevice.h:39
quint64 sentBytes
Definition: dprocessdevice.h:41
quint64 recvBytes
Definition: dprocessdevice.h:40
应用状态信息
Definition: dprocessdevice.h:44
qint64 cguestTime
Definition: dprocessdevice.h:69
quint32 nthreads
Definition: dprocessdevice.h:60
gid_t pgid
Definition: dprocessdevice.h:47
quint64 startTime
Definition: dprocessdevice.h:67
pid_t ppid
Definition: dprocessdevice.h:46
quint32 processor
Definition: dprocessdevice.h:57
gid_t gid
Definition: dprocessdevice.h:49
quint64 utime
Definition: dprocessdevice.h:63
gid_t sgid
Definition: dprocessdevice.h:53
quint64 stime
Definition: dprocessdevice.h:64
quint32 rtPrio
Definition: dprocessdevice.h:58
uid_t fuid
Definition: dprocessdevice.h:54
uid_t euid
Definition: dprocessdevice.h:50
qint64 cutime
Definition: dprocessdevice.h:65
uid_t suid
Definition: dprocessdevice.h:52
char state
bool Process::readStat()
Definition: dprocessdevice.h:45
int nice
Definition: dprocessdevice.h:61
gid_t egid
Definition: dprocessdevice.h:51
quint64 wtime
Definition: dprocessdevice.h:70
quint64 guestTime
Definition: dprocessdevice.h:68
quint32 policy
Definition: dprocessdevice.h:59
uid_t uid
Definition: dprocessdevice.h:48
qint64 cstime
Definition: dprocessdevice.h:66
gid_t fgid
Definition: dprocessdevice.h:55