| 1 | /* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) |
| 2 | * |
| 3 | * wrapper/perf.h |
| 4 | * |
| 5 | * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 6 | */ |
| 7 | |
| 8 | #ifndef _LTTNG_WRAPPER_PERF_H |
| 9 | #define _LTTNG_WRAPPER_PERF_H |
| 10 | |
| 11 | #include <linux/perf_event.h> |
| 12 | |
| 13 | #ifdef CONFIG_PERF_EVENTS |
| 14 | |
| 15 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,1,0)) |
| 16 | static inline struct perf_event * |
| 17 | wrapper_perf_event_create_kernel_counter(struct perf_event_attr *attr, |
| 18 | int cpu, |
| 19 | struct task_struct *task, |
| 20 | perf_overflow_handler_t callback) |
| 21 | { |
| 22 | return perf_event_create_kernel_counter(attr, cpu, task, callback, NULL); |
| 23 | } |
| 24 | #else /* (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,1,0)) */ |
| 25 | static inline struct perf_event * |
| 26 | wrapper_perf_event_create_kernel_counter(struct perf_event_attr *attr, |
| 27 | int cpu, |
| 28 | struct task_struct *task, |
| 29 | perf_overflow_handler_t callback) |
| 30 | { |
| 31 | return perf_event_create_kernel_counter(attr, cpu, task, callback); |
| 32 | } |
| 33 | #endif /* (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,1,0)) */ |
| 34 | |
| 35 | #endif /* CONFIG_PERF_EVENTS */ |
| 36 | |
| 37 | #endif /* _LTTNG_WRAPPER_PERF_H */ |