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>
42 #elif defined(__SH4__)
43 #include <ltt/kernelutils-sh.h>
45 #error "Unsupported architecture"
49 #define min(a,b) ((a)<(b)?(a):(b))
53 #define __NR_ltt_trace_generic 328
54 #define __NR_ltt_register_generic 329
56 #define NR_syscalls 330
60 #define __NR_ltt_trace_generic 286
61 #define __NR_ltt_register_generic 287
63 #define NR_syscalls 288
67 #define __NR_ltt_trace_generic 309
68 #define __NR_ltt_register_generic 310
70 #define NR_syscalls 311
74 #define __NR_ltt_trace_generic 309
75 #define __NR_ltt_register_generic 310
77 #define NR_syscalls 311
81 #define __NR_ltt_trace_generic 352
82 #define __NR_ltt_register_generic 353
84 #define NR_syscalls 354
87 //FIXME : setup for MIPS
90 // Put in bits/syscall.h
91 #define SYS_ltt_trace_generic __NR_ltt_trace_generic
92 #define SYS_ltt_register_generic __NR_ltt_register_generic
95 #define FACNAME_LEN 32
97 /* LTT userspace tracing is non blocking by default when buffers are full */
99 #define LTT_BLOCKING 0
100 #endif //LTT_BLOCKING
102 typedef unsigned int ltt_facility_t
;
104 struct user_facility_info
{
105 char name
[FACNAME_LEN
];
111 uint32_t pointer_size
;
112 uint32_t size_t_size
;
115 static inline __attribute__((no_instrument_function
))
116 _syscall5(int, ltt_trace_generic
, unsigned int, facility_id
,
117 unsigned int, event_id
, void *, data
, size_t, data_size
, int, blocking
)
118 static inline __attribute__((no_instrument_function
))
119 _syscall2(int, ltt_register_generic
, unsigned int *, facility_id
,
120 const struct user_facility_info
*, info
)
123 #define ltt_register_generic(...) syscall(__NR_ltt_register_generic, __VA_ARGS__)
124 #define ltt_trace_generic(...) syscall(__NR_ltt_trace_generic, __VA_ARGS__)
126 static inline unsigned int __attribute__((no_instrument_function
))
127 ltt_align(size_t align_drift
, size_t size_of_type
);
130 /* Calculate the offset needed to align the type */
131 static inline unsigned int
132 ltt_align(size_t align_drift
, size_t size_of_type
)
134 size_t alignment
= min(sizeof(void*), size_of_type
);
136 return ((alignment
- align_drift
) & (alignment
-1));
140 static inline unsigned int ltt_align(size_t align_drift
, size_t size_of_type
)
144 #define LTT_ALIGN __attribute__((packed))
148 } /* end of extern "C" */
151 #ifdef LTT_TRACE_FAST
152 #include <ltt/ltt-usertrace-fast.h>
153 #endif //LTT_TRACE_FAST
155 #endif //_LTT_USERTRACE_H
This page took 0.035936 seconds and 4 git commands to generate.