1 /* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1)
5 * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 #ifndef _LTTNG_WRAPPER_PERF_H
9 #define _LTTNG_WRAPPER_PERF_H
11 #include <linux/perf_event.h>
13 #ifdef CONFIG_PERF_EVENTS
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
,
19 struct task_struct
*task
,
20 perf_overflow_handler_t callback
)
22 return perf_event_create_kernel_counter(attr
, cpu
, task
, callback
, NULL
);
24 #else /* (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,1,0)) */
26 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(2,6,37))
27 static inline struct perf_event
*
28 wrapper_perf_event_create_kernel_counter(struct perf_event_attr
*attr
,
30 struct task_struct
*task
,
31 perf_overflow_handler_t callback
)
33 return perf_event_create_kernel_counter(attr
, cpu
, task
, callback
);
35 #else /* (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(2,6,37)) */
36 static inline struct perf_event
*
37 wrapper_perf_event_create_kernel_counter(struct perf_event_attr
*attr
,
39 struct task_struct
*task
,
40 perf_overflow_handler_t callback
)
49 return perf_event_create_kernel_counter(attr
, cpu
, pid
, callback
);
52 #endif /* (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(2,6,37)) */
54 #if (LTTNG_LINUX_VERSION_CODE < LTTNG_KERNEL_VERSION(2,6,36))
55 #define local64_read(l) atomic64_read(l)
58 #endif /* (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,1,0)) */
60 #endif /* CONFIG_PERF_EVENTS */
62 #endif /* _LTTNG_WRAPPER_PERF_H */