Lines Matching refs:cgroup
66 int read_cgroup_id(struct cgroup *cgrp) in read_cgroup_id()
101 static struct cgroup *evlist__find_cgroup(struct evlist *evlist, const char *str) in evlist__find_cgroup()
117 struct cgroup *cgroup__new(const char *name, bool do_open) in cgroup__new()
119 struct cgroup *cgroup = zalloc(sizeof(*cgroup)); in cgroup__new() local
121 if (cgroup != NULL) { in cgroup__new()
122 refcount_set(&cgroup->refcnt, 1); in cgroup__new()
124 cgroup->name = strdup(name); in cgroup__new()
125 if (!cgroup->name) in cgroup__new()
129 cgroup->fd = open_cgroup(name); in cgroup__new()
130 if (cgroup->fd == -1) in cgroup__new()
133 cgroup->fd = -1; in cgroup__new()
137 return cgroup; in cgroup__new()
140 zfree(&cgroup->name); in cgroup__new()
142 free(cgroup); in cgroup__new()
146 struct cgroup *evlist__findnew_cgroup(struct evlist *evlist, const char *name) in evlist__findnew_cgroup()
148 struct cgroup *cgroup = evlist__find_cgroup(evlist, name); in evlist__findnew_cgroup() local
150 return cgroup ?: cgroup__new(name, true); in evlist__findnew_cgroup()
156 struct cgroup *cgrp = evlist__findnew_cgroup(evlist, str); in add_cgroup()
179 static void cgroup__delete(struct cgroup *cgroup) in cgroup__delete() argument
181 if (cgroup->fd >= 0) in cgroup__delete()
182 close(cgroup->fd); in cgroup__delete()
183 zfree(&cgroup->name); in cgroup__delete()
184 free(cgroup); in cgroup__delete()
187 void cgroup__put(struct cgroup *cgrp) in cgroup__put()
194 struct cgroup *cgroup__get(struct cgroup *cgroup) in cgroup__get() argument
196 if (cgroup) in cgroup__get()
197 refcount_inc(&cgroup->refcnt); in cgroup__get()
198 return cgroup; in cgroup__get()
201 static void evsel__set_default_cgroup(struct evsel *evsel, struct cgroup *cgroup) in evsel__set_default_cgroup() argument
204 evsel->cgrp = cgroup__get(cgroup); in evsel__set_default_cgroup()
207 void evlist__set_default_cgroup(struct evlist *evlist, struct cgroup *cgroup) in evlist__set_default_cgroup() argument
212 evsel__set_default_cgroup(evsel, cgroup); in evlist__set_default_cgroup()
364 struct cgroup *cgrp = NULL; in parse_cgroups()
422 struct cgroup *cgrp = NULL; in evlist__expand_cgroup()
521 static struct cgroup *__cgroup__findnew(struct rb_root *root, uint64_t id, in __cgroup__findnew()
526 struct cgroup *cgrp; in __cgroup__findnew()
530 cgrp = rb_entry(parent, struct cgroup, node); in __cgroup__findnew()
564 struct cgroup *cgroup__findnew(struct perf_env *env, uint64_t id, in cgroup__findnew()
567 struct cgroup *cgrp; in cgroup__findnew()
575 struct cgroup *__cgroup__find(struct rb_root *root, uint64_t id) in __cgroup__find()
580 struct cgroup *cgroup__find(struct perf_env *env, uint64_t id) in cgroup__find()
582 struct cgroup *cgrp; in cgroup__find()
593 struct cgroup *cgrp; in perf_env__purge_cgroups()
598 cgrp = rb_entry(node, struct cgroup, node); in perf_env__purge_cgroups()