2ac32b460fa0282705dc61947a32f1d746708066
1 /*****************************************************************************
4 * LTT userspace tracing header
6 * Mathieu Desnoyers, March 2006
9 #ifndef _LTT_USERTRACE_H
10 #define _LTT_USERTRACE_H
16 #include <sys/types.h>
23 #define inline inline __attribute__((always_inline))
25 #if defined(__powerpc__) || defined(__powerpc64__)
27 #include <ltt/atomic-ppc64.h>
28 #include <ltt/system-ppc64.h>
29 #include <asm/timex.h>
31 #include <ltt/ppc_asm-ppc.h>
32 #include <ltt/atomic-ppc.h>
33 #include <ltt/system-ppc.h>
34 #include <ltt/timex-ppc.h>
36 #elif defined(__x86_64__)
37 #include <ltt/kernelutils-x86_64.h>
38 #elif defined(__i386__)
39 #include <ltt/kernelutils-i386.h>
40 #elif defined(__arm__)
41 #include <ltt/kernelutils-arm.h>
43 #error "Unsupported architecture"
47 #define min(a,b) ((a)<(b)?(a):(b))
51 #define __NR_ltt_trace_generic 320
52 #define __NR_ltt_register_generic 321
54 #define NR_syscalls 322
58 #define __NR_ltt_trace_generic 281
59 #define __NR_ltt_register_generic 281
61 #define NR_syscalls 282
65 #define __NR_ltt_trace_generic 302
66 #define __NR_ltt_register_generic 303
68 #define NR_syscalls 304
72 #define __NR_ltt_trace_generic 302
73 #define __NR_ltt_register_generic 303
75 #define NR_syscalls 304
79 #define __NR_ltt_trace_generic 347
80 #define __NR_ltt_register_generic 348
82 #define NR_syscalls 349
85 //FIXME : setup for MIPS
88 // Put in bits/syscall.h
89 #define SYS_ltt_trace_generic __NR_ltt_trace_generic
90 #define SYS_ltt_register_generic __NR_ltt_register_generic
93 #define FACNAME_LEN 32
95 /* LTT userspace tracing is non blocking by default when buffers are full */
97 #define LTT_BLOCKING 0
100 typedef unsigned int ltt_facility_t
;
102 struct user_facility_info
{
103 char name
[FACNAME_LEN
];
104 unsigned int num_events
;
113 static inline __attribute__((no_instrument_function
))
114 _syscall5(int, ltt_trace_generic
, unsigned int, facility_id
,
115 unsigned int, event_id
, void *, data
, size_t, data_size
, int, blocking
)
116 static inline __attribute__((no_instrument_function
))
117 _syscall2(int, ltt_register_generic
, unsigned int *, facility_id
,
118 const struct user_facility_info
*, info
)
121 #define ltt_register_generic(...) syscall(__NR_ltt_register_generic, __VA_ARGS__)
122 #define ltt_trace_generic(...) syscall(__NR_ltt_trace_generic, __VA_ARGS__)
124 static inline unsigned int __attribute__((no_instrument_function
))
125 ltt_align(size_t align_drift
, size_t size_of_type
);
128 /* Calculate the offset needed to align the type */
129 static inline unsigned int
130 ltt_align(size_t align_drift
, size_t size_of_type
)
132 size_t alignment
= min(sizeof(void*), size_of_type
);
134 return ((alignment
- align_drift
) & (alignment
-1));
138 static inline unsigned int ltt_align(size_t align_drift
, size_t size_of_type
)
142 #define LTT_ALIGN __attribute__((packed))
146 } /* end of extern "C" */
149 #ifdef LTT_TRACE_FAST
150 #include <ltt/ltt-usertrace-fast.h>
151 #endif //LTT_TRACE_FAST
153 #endif //_LTT_USERTRACE_H
This page took 0.044585 seconds and 3 git commands to generate.