update ppc
[lttv.git] / ltt-usertrace / ltt / ltt-usertrace.h
1 /*****************************************************************************
2 * ltt-usertrace.h
3 *
4 * LTT userspace tracing header
5 *
6 * Mathieu Desnoyers, March 2006
7 */
8
9 #ifndef _LTT_USERTRACE_H
10 #define _LTT_USERTRACE_H
11
12 #include <errno.h>
13 #include <syscall.h>
14 #include <string.h>
15 #include <stdint.h>
16 #include <sys/types.h>
17 #include <linux/unistd.h>
18
19 #ifndef min
20 #define min(a,b) ((a)<(b)?(a):(b))
21 #endif
22
23 #ifdef i386
24 #define __NR_ltt_trace_generic 311
25 #define __NR_ltt_register_generic 312
26 #undef NR_syscalls
27 #define NR_syscalls 313
28 #endif
29
30 #ifdef powerpc
31 #define __NR_ltt_trace_generic 283
32 #define __NR_ltt_register_generic 284
33 #undef NR_syscalls
34 #define NR_syscalls 285
35 #endif
36
37 //FIXME : setup for ARM
38 //FIXME : setup for MIPS
39
40 #ifndef _LIBC
41 // Put in bits/syscall.h
42 #define SYS_ltt_trace_generic __NR_ltt_trace_generic
43 #define SYS_ltt_register_generic __NR_ltt_register_generic
44 #endif
45
46 #define FACNAME_LEN 32
47
48 /* LTT userspace tracing is non blocking by default when buffers are full */
49 #ifndef LTT_BLOCKING
50 #define LTT_BLOCKING 0
51 #endif //LTT_BLOCKING
52
53 typedef unsigned int ltt_facility_t;
54
55 struct user_facility_info {
56 char name[FACNAME_LEN];
57 unsigned int num_events;
58 size_t alignment;
59 uint32_t checksum;
60 size_t int_size;
61 size_t long_size;
62 size_t pointer_size;
63 size_t size_t_size;
64 };
65
66 static inline __attribute__((no_instrument_function))
67 _syscall5(int, ltt_trace_generic, unsigned int, facility_id,
68 unsigned int, event_id, void *, data, size_t, data_size, int, blocking)
69 static inline __attribute__((no_instrument_function))
70 _syscall2(int, ltt_register_generic, unsigned int *, facility_id,
71 const struct user_facility_info *, info)
72
73 #ifndef LTT_PACK
74 /* Calculate the offset needed to align the type */
75 static inline unsigned int __attribute__((no_instrument_function))
76 ltt_align(size_t align_drift,
77 size_t size_of_type)
78 {
79 size_t alignment = min(sizeof(void*), size_of_type);
80
81 return ((alignment - align_drift) & (alignment-1));
82 }
83 #define LTT_ALIGN
84 #else
85 static inline unsigned int __attribute__((no_instrument_function))
86 ltt_align(size_t align_drift,
87 size_t size_of_type)
88 {
89 return 0;
90 }
91 #define LTT_ALIGN __attribute__((packed))
92 #endif //LTT_PACK
93
94 #ifdef LTT_TRACE_FAST
95 #include <ltt/ltt-usertrace-fast.h>
96 #endif //LTT_TRACE_FAST
97
98 #endif //_LTT_USERTRACE_H
99
100
This page took 0.032956 seconds and 5 git commands to generate.