-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathProcStatus.h
More file actions
39 lines (30 loc) · 716 Bytes
/
ProcStatus.h
File metadata and controls
39 lines (30 loc) · 716 Bytes
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
/*
* SPDX-License-Identifier: GPL-2.0
*
* Copyright (c) 2018 Intel Corporation
*
* Authors: Fengguang Wu <fengguang.wu@intel.com>
*/
#ifndef AEP_PROC_STATUS_H
#define AEP_PROC_STATUS_H
#include <vector>
#include <string>
#include <unordered_map>
class ProcStatus
{
public:
int load(pid_t n);
void clear();
bool empty() const { return status_map.empty(); }
const std::string& get_name() const { return name; }
unsigned long get_number(std::string key) const;
private:
int parse_file(FILE *file);
int parse_line(char *line);
private:
pid_t pid;
std::string name;
std::unordered_map<std::string, unsigned long> status_map;
};
#endif
// vim:set ts=2 sw=2 et: