Loading...
1#ifndef __CGROUP_H__
2#define __CGROUP_H__
3
4#include <linux/atomic.h>
5
6struct option;
7
8struct cgroup_sel {
9 char *name;
10 int fd;
11 atomic_t refcnt;
12};
13
14
15extern int nr_cgroups; /* number of explicit cgroups defined */
16void close_cgroup(struct cgroup_sel *cgrp);
17int parse_cgroups(const struct option *opt, const char *str, int unset);
18
19#endif /* __CGROUP_H__ */
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __CGROUP_H__
3#define __CGROUP_H__
4
5#include <linux/refcount.h>
6#include <linux/rbtree.h>
7#include "util/env.h"
8
9struct option;
10
11struct cgroup {
12 struct rb_node node;
13 u64 id;
14 char *name;
15 int fd;
16 refcount_t refcnt;
17};
18
19extern int nr_cgroups; /* number of explicit cgroups defined */
20
21struct cgroup *cgroup__get(struct cgroup *cgroup);
22void cgroup__put(struct cgroup *cgroup);
23
24struct evlist;
25
26struct cgroup *evlist__findnew_cgroup(struct evlist *evlist, const char *name);
27
28void evlist__set_default_cgroup(struct evlist *evlist, struct cgroup *cgroup);
29
30int parse_cgroups(const struct option *opt, const char *str, int unset);
31
32struct cgroup *cgroup__findnew(struct perf_env *env, uint64_t id,
33 const char *path);
34struct cgroup *cgroup__find(struct perf_env *env, uint64_t id);
35
36void perf_env__purge_cgroups(struct perf_env *env);
37
38#endif /* __CGROUP_H__ */