From: compudj Date: Thu, 9 Mar 2006 20:57:20 +0000 (+0000) Subject: new ltt-usertrace X-Git-Tag: v0.12.20~1846 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=976db1b3ea97f6714590ec9cf36ea30b9b6aa59b;p=lttv.git new ltt-usertrace git-svn-id: http://ltt.polymtl.ca/svn@1643 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt-usertrace/Makefile b/ltt-usertrace/Makefile index 292a5bc8..2b607996 100644 --- a/ltt-usertrace/Makefile +++ b/ltt-usertrace/Makefile @@ -4,7 +4,21 @@ INCLUDE_DIR=/usr/include LIB_DIR=/usr/lib RANLIB=ranlib -all: libltt-instrument-functions.a libltt-instrument-functions.so.0 sample-thread sample sample-highspeed sample-printf sample-instrument-fct +CFLAGS=-I. -O3 +LDFLAGS=-L. + +#For testing lib ltt-usertrace-fast +#CFLAGS+=-DLTT_SUBBUF_SIZE_CPU=134217728 +#CFLAGS+=-DLTT_NULL_OUTPUT_TEST + +all: libs samples + + +libs: libltt-instrument-functions.a libltt-instrument-functions.so.0 \ + libltt-usertrace-fast.a libltt-usertrace-fast.so.0 + +samples: sample-thread sample sample-highspeed sample-printf \ + sample-instrument-fct sample-thread: sample-thread.c ltt-facility-loader-user_generic.c $(CC) $(CFLAGS) -lpthread -o $@ $^ @@ -13,7 +27,7 @@ sample: sample.c ltt-facility-loader-user_generic.c $(CC) $(CFLAGS) -o $@ $^ sample-highspeed: sample-highspeed.c ltt-facility-loader-user_generic.c - $(CC) $(CFLAGS) -o $@ $^ + $(CC) $(CFLAGS) -L. -lltt-usertrace-fast -o $@ $^ sample-printf: sample-printf.c ltt-facility-loader-user_generic.c $(CC) $(CFLAGS) -o $@ $^ @@ -21,23 +35,34 @@ sample-printf: sample-printf.c ltt-facility-loader-user_generic.c sample-instrument-fct: sample-instrument-fct.c $(CC) $(CFLAGS) -L. -g -finstrument-functions -lltt-instrument-functions -o $@ $^ -libltt-instrument-functions.a: ltt-instrument-functions.o ltt-facility-loader-user_generic.o +libltt-usertrace-fast.a: ltt-usertrace-fast.o ltt-facility-loader-user_generic.o + @rm -f libltt-usertrace-fast.a + $(AR) rc $@ $^ + $(RANLIB) $@ + +libltt-usertrace-fast.so.0: ltt-usertrace-fast.o ltt-facility-loader-user_generic.o + @rm -f libltt-usertrace-fast.so libltt-usertrace-fast.so.0 + $(CC) $(CFLAGS) -lpthread -shared -Wl,-soname,libltt-usertrace-fast.so -o $@ $^ + ln -s libltt-usertrace-fast.so.0 libltt-usertrace-fast.so + +libltt-instrument-functions.a: ltt-instrument-functions.o ltt-facility-loader-user_generic.o ltt-usertrace-fast.o @rm -f libltt-instrument-functions.a $(AR) rc $@ $^ $(RANLIB) $@ -libltt-instrument-functions.so.0: ltt-instrument-functions.o ltt-facility-loader-user_generic.o +libltt-instrument-functions.so.0: ltt-instrument-functions.o ltt-facility-loader-user_generic.o ltt-usertrace-fast.o @rm -f libltt-instrument-functions.so libltt-instrument-functions.so.0 - $(CC) $(CFLAGS) -shared -Wl,-soname,libltt-instrument-functions.so -o $@ $^ + $(CC) $(CFLAGS) -lpthread -shared -Wl,-soname,libltt-instrument-functions.so -o $@ $^ ln -s libltt-instrument-functions.so.0 libltt-instrument-functions.so -.PHONY : clean install +.PHONY : clean install libs samples install: if [ ! -e "$(INCLUDE_DIR)/ltt" ] ; then mkdir $(INCLUDE_DIR)/ltt ; fi cp -f ltt/*.h $(INCLUDE_DIR)/ltt cp -df libltt-instrument-functions.so* libltt-instrument-functions.a $(LIB_DIR) + cp -df libltt-usertrace-fast.so* libltt-usertrace-fast.a $(LIB_DIR) clean: - rm -fr *.o *~ sample-thread sample sample-highspeed sample-printf sample-instrument-fct libltt-instrument-functions.so* libltt-instrument-functions.a + rm -fr *.o *~ sample-thread sample sample-highspeed sample-printf sample-instrument-fct libltt-instrument-functions.so* libltt-instrument-functions.a libltt-usertrace-fast.a libltt-usertrace-fast.so.0 diff --git a/ltt-usertrace/ltt-usertrace-fast.c b/ltt-usertrace/ltt-usertrace-fast.c index 1a57db15..863d4fa3 100644 --- a/ltt-usertrace/ltt-usertrace-fast.c +++ b/ltt-usertrace/ltt-usertrace-fast.c @@ -45,6 +45,7 @@ #define _GNU_SOURCE #define LTT_TRACE +#define LTT_TRACE_FAST #include #include #include @@ -70,7 +71,7 @@ _syscall0(pid_t,gettid) -#include +#include #ifdef LTT_SHOW_DEBUG #define dbg_printf(...) dbg_printf(__VA_ARGS__) diff --git a/ltt-usertrace/ltt/ltt-usertrace-fast.h b/ltt-usertrace/ltt/ltt-usertrace-fast.h index 4d7c56ba..b0d222f8 100644 --- a/ltt-usertrace/ltt/ltt-usertrace-fast.h +++ b/ltt-usertrace/ltt/ltt-usertrace-fast.h @@ -21,7 +21,6 @@ #include #include -#include #ifndef LTT_N_SUBBUFS #define LTT_N_SUBBUFS 2 @@ -58,8 +57,6 @@ #define atomic_cmpxchg(v, old, new) ((int)cmpxchg(&((v)->counter), old, new)) #endif //atomic_cmpxchg -typedef unsigned int ltt_facility_t; - struct ltt_trace_header { uint32_t magic_number; uint32_t arch_type; diff --git a/ltt-usertrace/ltt/ltt-usertrace.h b/ltt-usertrace/ltt/ltt-usertrace.h index dbd48c34..d64f4f21 100644 --- a/ltt-usertrace/ltt/ltt-usertrace.h +++ b/ltt-usertrace/ltt/ltt-usertrace.h @@ -17,10 +17,6 @@ #include #include -#ifdef LTT_TRACE_FAST -#include -#endif //LTT_TRACE_FAST - #ifndef min #define min(a,b) ((a)<(b)?(a):(b)) #endif @@ -89,6 +85,10 @@ static inline unsigned int __attribute__((no_instrument_function)) #define LTT_ALIGN __attribute__((packed)) #endif //LTT_PACK +#ifdef LTT_TRACE_FAST +#include +#endif //LTT_TRACE_FAST + #endif //_LTT_USERTRACE_H