Lines Matching refs:cgroup

38 static struct cgroup *evlist__find_cgroup(struct evlist *evlist, const char *str)  in evlist__find_cgroup()
54 static struct cgroup *cgroup__new(const char *name, bool do_open) in cgroup__new()
56 struct cgroup *cgroup = zalloc(sizeof(*cgroup)); in cgroup__new() local
58 if (cgroup != NULL) { in cgroup__new()
59 refcount_set(&cgroup->refcnt, 1); in cgroup__new()
61 cgroup->name = strdup(name); in cgroup__new()
62 if (!cgroup->name) in cgroup__new()
66 cgroup->fd = open_cgroup(name); in cgroup__new()
67 if (cgroup->fd == -1) in cgroup__new()
70 cgroup->fd = -1; in cgroup__new()
74 return cgroup; in cgroup__new()
77 zfree(&cgroup->name); in cgroup__new()
79 free(cgroup); in cgroup__new()
83 struct cgroup *evlist__findnew_cgroup(struct evlist *evlist, const char *name) in evlist__findnew_cgroup()
85 struct cgroup *cgroup = evlist__find_cgroup(evlist, name); in evlist__findnew_cgroup() local
87 return cgroup ?: cgroup__new(name, true); in evlist__findnew_cgroup()
93 struct cgroup *cgrp = evlist__findnew_cgroup(evlist, str); in add_cgroup()
116 static void cgroup__delete(struct cgroup *cgroup) in cgroup__delete() argument
118 if (cgroup->fd >= 0) in cgroup__delete()
119 close(cgroup->fd); in cgroup__delete()
120 zfree(&cgroup->name); in cgroup__delete()
121 free(cgroup); in cgroup__delete()
124 void cgroup__put(struct cgroup *cgrp) in cgroup__put()
131 struct cgroup *cgroup__get(struct cgroup *cgroup) in cgroup__get() argument
133 if (cgroup) in cgroup__get()
134 refcount_inc(&cgroup->refcnt); in cgroup__get()
135 return cgroup; in cgroup__get()
138 static void evsel__set_default_cgroup(struct evsel *evsel, struct cgroup *cgroup) in evsel__set_default_cgroup() argument
141 evsel->cgrp = cgroup__get(cgroup); in evsel__set_default_cgroup()
144 void evlist__set_default_cgroup(struct evlist *evlist, struct cgroup *cgroup) in evlist__set_default_cgroup() argument
149 evsel__set_default_cgroup(evsel, cgroup); in evlist__set_default_cgroup()
157 struct cgroup *cgrp = NULL; in parse_cgroups()
210 struct cgroup *cgrp = NULL; in evlist__expand_cgroup()
301 static struct cgroup *__cgroup__findnew(struct rb_root *root, uint64_t id, in __cgroup__findnew()
306 struct cgroup *cgrp; in __cgroup__findnew()
310 cgrp = rb_entry(parent, struct cgroup, node); in __cgroup__findnew()
344 struct cgroup *cgroup__findnew(struct perf_env *env, uint64_t id, in cgroup__findnew()
347 struct cgroup *cgrp; in cgroup__findnew()
355 struct cgroup *cgroup__find(struct perf_env *env, uint64_t id) in cgroup__find()
357 struct cgroup *cgrp; in cgroup__find()
368 struct cgroup *cgrp; in perf_env__purge_cgroups()
373 cgrp = rb_entry(node, struct cgroup, node); in perf_env__purge_cgroups()