Fix: client_packet_header() uses wrong packet
[lttng-modules.git] / wrapper / perf.h
1 #ifndef _LTTNG_WRAPPER_PERF_H
2 #define _LTTNG_WRAPPER_PERF_H
3
4 /*
5 * wrapper/perf.h
6 *
7 * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; only
12 * version 2.1 of the License.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24 #include <linux/perf_event.h>
25
26 #if defined(CONFIG_PERF_EVENTS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,99))
27 static inline struct perf_event *
28 wrapper_perf_event_create_kernel_counter(struct perf_event_attr *attr,
29 int cpu,
30 struct task_struct *task,
31 perf_overflow_handler_t callback)
32 {
33 return perf_event_create_kernel_counter(attr, cpu, task, callback, NULL);
34 }
35 #else /* defined(CONFIG_PERF_EVENTS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,99)) */
36
37 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
38 static inline struct perf_event *
39 wrapper_perf_event_create_kernel_counter(struct perf_event_attr *attr,
40 int cpu,
41 struct task_struct *task,
42 perf_overflow_handler_t callback)
43 {
44 return perf_event_create_kernel_counter(attr, cpu, task, callback);
45 }
46 #else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) */
47 static inline struct perf_event *
48 wrapper_perf_event_create_kernel_counter(struct perf_event_attr *attr,
49 int cpu,
50 struct task_struct *task,
51 perf_overflow_handler_t callback)
52 {
53 pid_t pid;
54
55 if (!task)
56 pid = -1;
57 else
58 pid = task->pid;
59
60 return perf_event_create_kernel_counter(attr, cpu, pid, callback);
61 }
62
63 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) */
64
65 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
66 #define local64_read(l) atomic64_read(l)
67 #endif
68
69 #endif /* defined(CONFIG_PERF_EVENTS) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,99)) */
70
71 #endif /* _LTTNG_WRAPPER_PERF_H */
This page took 0.030234 seconds and 4 git commands to generate.