forked from udacity/CppND-System-Monitor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcess.h
More file actions
50 lines (47 loc) · 1.17 KB
/
Process.h
File metadata and controls
50 lines (47 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <string>
using namespace std;
/*
Basic class for Process representation
It contains relevant attributes as shown below
*/
class Process {
private:
string pid;
string user;
string cmd;
string cpu;
string mem;
string upTime;
public:
Process(string pid){
this->pid = pid;
this->user = ProcessParser::getProcUser(pid);
//TODOs:
//complete for mem
//complete for cmd
//complete for upTime
//complete for cpu
}
void setPid(int pid);
string getPid()const;
string getUser()const;
string getCmd()const;
int getCpu()const;
int getMem()const;
string getUpTime()const;
string getProcess();
};
void Process::setPid(int pid){
this->pid = pid;
}
string Process::getPid()const {
return this->pid;
}
string Process::getProcess(){
if(!ProcessParser::isPidExisting(this->pid))
return "";
this->mem = ProcessParser::getVmSize(this->pid);
this->upTime = ProcessParser::getProcUpTime(this->pid);
this->cpu = ProcessParser::getCpuPercent(this->pid);
return (this->pid + " " + //TODO: finish the string! this->user + " "+ mem...cpu...upTime...;
}