From: compudj Date: Thu, 9 Mar 2006 20:28:34 +0000 (+0000) Subject: new ltt-usertrace X-Git-Tag: v0.12.20~1849 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ddeda2eebdd06ce9aa5fa9872b0ca9bd1985118b;p=lttv.git new ltt-usertrace git-svn-id: http://ltt.polymtl.ca/svn@1640 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt-usertrace/ltt/ltt-generic.h b/ltt-usertrace/ltt/ltt-generic.h deleted file mode 100644 index 9d52ad70..00000000 --- a/ltt-usertrace/ltt/ltt-generic.h +++ /dev/null @@ -1,90 +0,0 @@ -/***************************************************************************** - * ltt-generic.h - * - * LTT generic userspace tracing header - * - * Mathieu Desnoyers, March 2006 - */ - -#ifndef _LTT_GENERIC_H -#define _LTT_GENERIC_H - -#include -#include -#include -#include -#include -#include -#include - -#ifndef min -#define min(a,b) ((a)<(b)?(a):(b)) -#endif - -//Put in asm-i486/unistd.h -#define __NR_ltt_trace_generic 294 -#define __NR_ltt_register_generic 295 - -#undef NR_syscalls -#define NR_syscalls 296 - -//FIXME : setup for ARM -//FIXME : setup for MIPS - -#ifndef _LIBC -// Put in bits/syscall.h -#define SYS_ltt_trace_generic __NR_ltt_trace_generic -#define SYS_ltt_register_generic __NR_ltt_register_generic -#endif - -#define FACNAME_LEN 32 - -/* LTT userspace tracing is non blocking by default when buffers are full */ -#ifndef LTT_BLOCKING -#define LTT_BLOCKING 0 -#endif //LTT_BLOCKING - -typedef unsigned int ltt_facility_t; - -struct user_facility_info { - char name[FACNAME_LEN]; - unsigned int num_events; - size_t alignment; - uint32_t checksum; - size_t int_size; - size_t long_size; - size_t pointer_size; - size_t size_t_size; -}; - -static inline __attribute__((no_instrument_function)) -_syscall5(int, ltt_trace_generic, unsigned int, facility_id, - unsigned int, event_id, void *, data, size_t, data_size, int, blocking) -static inline __attribute__((no_instrument_function)) -_syscall2(int, ltt_register_generic, unsigned int *, facility_id, - const struct user_facility_info *, info) - -#ifndef LTT_PACK -/* Calculate the offset needed to align the type */ -static inline unsigned int __attribute__((no_instrument_function)) - ltt_align(size_t align_drift, - size_t size_of_type) -{ - size_t alignment = min(sizeof(void*), size_of_type); - - return ((alignment - align_drift) & (alignment-1)); -} -#define LTT_ALIGN -#else -static inline unsigned int __attribute__((no_instrument_function)) - ltt_align(size_t align_drift, - size_t size_of_type) -{ - return 0; -} -#define LTT_ALIGN __attribute__((packed)) -#endif //LTT_PACK - -#endif //_LTT_GENERIC_H - - diff --git a/ltt-usertrace/ltt/ltt-usertrace.h b/ltt-usertrace/ltt/ltt-usertrace.h new file mode 100644 index 00000000..9d52ad70 --- /dev/null +++ b/ltt-usertrace/ltt/ltt-usertrace.h @@ -0,0 +1,90 @@ +/***************************************************************************** + * ltt-generic.h + * + * LTT generic userspace tracing header + * + * Mathieu Desnoyers, March 2006 + */ + +#ifndef _LTT_GENERIC_H +#define _LTT_GENERIC_H + +#include +#include +#include +#include +#include +#include +#include + +#ifndef min +#define min(a,b) ((a)<(b)?(a):(b)) +#endif + +//Put in asm-i486/unistd.h +#define __NR_ltt_trace_generic 294 +#define __NR_ltt_register_generic 295 + +#undef NR_syscalls +#define NR_syscalls 296 + +//FIXME : setup for ARM +//FIXME : setup for MIPS + +#ifndef _LIBC +// Put in bits/syscall.h +#define SYS_ltt_trace_generic __NR_ltt_trace_generic +#define SYS_ltt_register_generic __NR_ltt_register_generic +#endif + +#define FACNAME_LEN 32 + +/* LTT userspace tracing is non blocking by default when buffers are full */ +#ifndef LTT_BLOCKING +#define LTT_BLOCKING 0 +#endif //LTT_BLOCKING + +typedef unsigned int ltt_facility_t; + +struct user_facility_info { + char name[FACNAME_LEN]; + unsigned int num_events; + size_t alignment; + uint32_t checksum; + size_t int_size; + size_t long_size; + size_t pointer_size; + size_t size_t_size; +}; + +static inline __attribute__((no_instrument_function)) +_syscall5(int, ltt_trace_generic, unsigned int, facility_id, + unsigned int, event_id, void *, data, size_t, data_size, int, blocking) +static inline __attribute__((no_instrument_function)) +_syscall2(int, ltt_register_generic, unsigned int *, facility_id, + const struct user_facility_info *, info) + +#ifndef LTT_PACK +/* Calculate the offset needed to align the type */ +static inline unsigned int __attribute__((no_instrument_function)) + ltt_align(size_t align_drift, + size_t size_of_type) +{ + size_t alignment = min(sizeof(void*), size_of_type); + + return ((alignment - align_drift) & (alignment-1)); +} +#define LTT_ALIGN +#else +static inline unsigned int __attribute__((no_instrument_function)) + ltt_align(size_t align_drift, + size_t size_of_type) +{ + return 0; +} +#define LTT_ALIGN __attribute__((packed)) +#endif //LTT_PACK + +#endif //_LTT_GENERIC_H + +