cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

cgroup.h (1351B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2#ifndef __CGROUP_H__
      3#define __CGROUP_H__
      4
      5#include <linux/compiler.h>
      6#include <linux/refcount.h>
      7#include <linux/rbtree.h>
      8#include "util/env.h"
      9
     10struct option;
     11
     12struct cgroup {
     13	struct rb_node		node;
     14	u64			id;
     15	char			*name;
     16	int			fd;
     17	refcount_t		refcnt;
     18};
     19
     20extern int nr_cgroups; /* number of explicit cgroups defined */
     21extern bool cgrp_event_expanded;
     22
     23struct cgroup *cgroup__get(struct cgroup *cgroup);
     24void cgroup__put(struct cgroup *cgroup);
     25
     26struct evlist;
     27struct rblist;
     28
     29struct cgroup *evlist__findnew_cgroup(struct evlist *evlist, const char *name);
     30int evlist__expand_cgroup(struct evlist *evlist, const char *cgroups,
     31			  struct rblist *metric_events, bool open_cgroup);
     32
     33void evlist__set_default_cgroup(struct evlist *evlist, struct cgroup *cgroup);
     34
     35int parse_cgroups(const struct option *opt, const char *str, int unset);
     36
     37struct cgroup *cgroup__findnew(struct perf_env *env, uint64_t id,
     38			       const char *path);
     39struct cgroup *cgroup__find(struct perf_env *env, uint64_t id);
     40
     41void perf_env__purge_cgroups(struct perf_env *env);
     42
     43#ifdef HAVE_FILE_HANDLE
     44int read_cgroup_id(struct cgroup *cgrp);
     45#else
     46static inline int read_cgroup_id(struct cgroup *cgrp __maybe_unused)
     47{
     48	return -1;
     49}
     50#endif  /* HAVE_FILE_HANDLE */
     51
     52int cgroup_is_v2(const char *subsys);
     53
     54#endif /* __CGROUP_H__ */