-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathProcess.h
64 lines (53 loc) · 1.28 KB
/
Process.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* SPDX-License-Identifier: GPL-2.0
*
* Copyright (c) 2018 Intel Corporation
*
* Authors: Fengguang Wu <fengguang.wu@intel.com>
* Yao Yuan <yuan.yao@intel.com>
*/
#ifndef AEP_PROCESS_H
#define AEP_PROCESS_H
#include <memory>
#include <vector>
#include <unordered_map>
#include "ProcPid.h"
#include "ProcMaps.h"
#include "ProcStatus.h"
#include "Option.h"
#include "PidContext.h"
class EPTMigrate;
typedef std::vector<std::shared_ptr<EPTMigrate>> IdleRanges;
class Process
{
public:
int load(pid_t n);
int split_ranges();
IdleRanges& get_ranges() { return idle_ranges; }
void set_policy(Policy* pol);
bool match_policy(Policy& policy);
Policy* match_policies(PolicySet& policies);
private:
void add_range(unsigned long start, unsigned long end);
public:
pid_t pid;
Policy policy;
ProcStatus proc_status;
ProcMaps proc_maps;
IdleRanges idle_ranges;
PidContext context;
};
typedef std::unordered_map<pid_t, std::shared_ptr<Process>> ProcessHash;
class ProcessCollection
{
public:
int collect();
int collect(PolicySet& policies);
ProcessHash& get_proccesses() { return proccess_hash; }
void dump();
private:
ProcPid pids;
ProcessHash proccess_hash;
};
#endif
// vim:set ts=2 sw=2 et: