-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathProcVmstat.h
50 lines (38 loc) · 1.2 KB
/
ProcVmstat.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
/*
* 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_PROC_VMSTAT_H
#define AEP_PROC_VMSTAT_H
// interface to /proc/vmstat and /sys/devices/system/node/node*/vmstat
#include <string>
#include <vector>
#include <unordered_map>
typedef std::unordered_map<std::string, unsigned long> vmstat_map;
class NumaNodeCollection;
class ProcVmstat
{
public:
int load_vmstat();
int load_numa_vmstat();
void clear() { proc_vmstat.clear(); numa_vmstat.clear(); };
unsigned long vmstat(std::string name);
unsigned long vmstat(int nid, std::string name);
unsigned long vmstat(std::vector<int>& nid);
const std::vector<vmstat_map>& get_numa_vmstat() { return numa_vmstat; }
const vmstat_map & get_proc_vmstat() { return proc_vmstat; }
unsigned long anon_capacity();
unsigned long anon_capacity(int nid);
void show_numa_stats(NumaNodeCollection* numa_collection);
private:
vmstat_map __load_vmstat(const char *path);
private:
std::vector<vmstat_map> numa_vmstat;
vmstat_map proc_vmstat;
};
#endif
// vim:set ts=2 sw=2 et: