diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/perf_event.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 724d3720c9b1..cae4a9481777 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -53,6 +53,7 @@ struct perf_guest_info_callbacks { | |||
53 | #include <linux/sysfs.h> | 53 | #include <linux/sysfs.h> |
54 | #include <linux/perf_regs.h> | 54 | #include <linux/perf_regs.h> |
55 | #include <linux/workqueue.h> | 55 | #include <linux/workqueue.h> |
56 | #include <linux/cgroup.h> | ||
56 | #include <asm/local.h> | 57 | #include <asm/local.h> |
57 | 58 | ||
58 | struct perf_callchain_entry { | 59 | struct perf_callchain_entry { |
@@ -547,6 +548,35 @@ struct perf_output_handle { | |||
547 | int page; | 548 | int page; |
548 | }; | 549 | }; |
549 | 550 | ||
551 | #ifdef CONFIG_CGROUP_PERF | ||
552 | |||
553 | /* | ||
554 | * perf_cgroup_info keeps track of time_enabled for a cgroup. | ||
555 | * This is a per-cpu dynamically allocated data structure. | ||
556 | */ | ||
557 | struct perf_cgroup_info { | ||
558 | u64 time; | ||
559 | u64 timestamp; | ||
560 | }; | ||
561 | |||
562 | struct perf_cgroup { | ||
563 | struct cgroup_subsys_state css; | ||
564 | struct perf_cgroup_info __percpu *info; | ||
565 | }; | ||
566 | |||
567 | /* | ||
568 | * Must ensure cgroup is pinned (css_get) before calling | ||
569 | * this function. In other words, we cannot call this function | ||
570 | * if there is no cgroup event for the current CPU context. | ||
571 | */ | ||
572 | static inline struct perf_cgroup * | ||
573 | perf_cgroup_from_task(struct task_struct *task) | ||
574 | { | ||
575 | return container_of(task_css(task, perf_event_cgrp_id), | ||
576 | struct perf_cgroup, css); | ||
577 | } | ||
578 | #endif /* CONFIG_CGROUP_PERF */ | ||
579 | |||
550 | #ifdef CONFIG_PERF_EVENTS | 580 | #ifdef CONFIG_PERF_EVENTS |
551 | 581 | ||
552 | extern int perf_pmu_register(struct pmu *pmu, const char *name, int type); | 582 | extern int perf_pmu_register(struct pmu *pmu, const char *name, int type); |