forked from udacity/CppND-System-Monitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProcessParser.h
47 lines (43 loc) · 1.27 KB
/
ProcessParser.h
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
#include <algorithm>
#include <iostream>
#include <math.h>
#include <thread>
#include <chrono>
#include <iterator>
#include <string>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include <fstream>
#include <sstream>
#include <stdexcept>
#include <cerrno>
#include <cstring>
#include <dirent.h>
#include <time.h>
#include <unistd.h>
#include "constants.h"
using namespace std;
class ProcessParser{
private:
std::ifstream stream;
public:
static string getCmd(string pid);
static vector<string> getPidList();
static std::string getVmSize(string pid);
static std::string getCpuPercent(string pid);
static long int getSysUpTime();
static std::string getProcUpTime(string pid);
static string getProcUser(string pid);
static vector<string> getSysCpuPercent(string coreNumber = "");
static float getSysRamPercent();
static string getSysKernelVersion();
static int getNumberOfCores();
static int getTotalThreads();
static int getTotalNumberOfProcesses();
static int getNumberOfRunningProcesses();
static string getOSName();
static std::string PrintCpuStats(std::vector<std::string> values1, std::vector<std::string>values2);
static bool isPidExisting(string pid);
};
// TODO: Define all of the above functions below: