From 972a52cf6db894cfd025b4c4375b6e07c9f77717 Mon Sep 17 00:00:00 2001 From: compudj Date: Mon, 6 Mar 2006 07:09:46 +0000 Subject: [PATCH] add high speed blocking test git-svn-id: http://ltt.polymtl.ca/svn@1579 04897980-b3bd-0310-b5e0-8ef037075253 --- usertrace-generic/Makefile | 5 ++++- .../ltt/ltt-facility-user_generic.h | 4 ++-- usertrace-generic/ltt/ltt-generic.h | 9 +++++++-- usertrace-generic/sample-highspeed.c | 20 +++++++++++++++++++ usertrace-generic/sample.c | 1 + 5 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 usertrace-generic/sample-highspeed.c diff --git a/usertrace-generic/Makefile b/usertrace-generic/Makefile index 94a5a6a2..8d02d71b 100644 --- a/usertrace-generic/Makefile +++ b/usertrace-generic/Makefile @@ -2,13 +2,16 @@ CC=gcc -all: sample-thread sample +all: sample-thread sample sample-highspeed sample-thread: sample-thread.c ltt-facility-loader-user_generic.c $(CC) $(CFLAGS) -I. -lpthread -o $@ $^ sample: sample.c ltt-facility-loader-user_generic.c $(CC) $(CFLAGS) -I. -o $@ $^ + +sample-highspeed: sample-highspeed.c ltt-facility-loader-user_generic.c + $(CC) $(CFLAGS) -I. -o $@ $^ .PHONY : clean diff --git a/usertrace-generic/ltt/ltt-facility-user_generic.h b/usertrace-generic/ltt/ltt-facility-user_generic.h index c5b9bd03..1529fe2e 100644 --- a/usertrace-generic/ltt/ltt-facility-user_generic.h +++ b/usertrace-generic/ltt/ltt-facility-user_generic.h @@ -97,7 +97,7 @@ static inline int trace_user_generic_string( *len = 0; } - ret = ltt_trace_generic(ltt_facility_user_generic_411B0F83, event_user_generic_string, stack_buffer, sizeof(stack_buffer)); + ret = ltt_trace_generic(ltt_facility_user_generic_411B0F83, event_user_generic_string, stack_buffer, sizeof(stack_buffer), LTT_BLOCKING); } return ret; @@ -226,7 +226,7 @@ static inline int trace_user_generic_string_pointer( *len = 0; } - ret = ltt_trace_generic(ltt_facility_user_generic_411B0F83, event_user_generic_string_pointer, stack_buffer, sizeof(stack_buffer)); + ret = ltt_trace_generic(ltt_facility_user_generic_411B0F83, event_user_generic_string_pointer, stack_buffer, sizeof(stack_buffer), LTT_BLOCKING); } return ret; diff --git a/usertrace-generic/ltt/ltt-generic.h b/usertrace-generic/ltt/ltt-generic.h index ab9423d3..efa338c3 100644 --- a/usertrace-generic/ltt/ltt-generic.h +++ b/usertrace-generic/ltt/ltt-generic.h @@ -39,6 +39,11 @@ #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 { @@ -52,8 +57,8 @@ struct user_facility_info { size_t size_t_size; }; -static inline _syscall4(int, ltt_trace_generic, unsigned int, facility_id, - unsigned int, event_id, void *, data, size_t, data_size) +static inline _syscall5(int, ltt_trace_generic, unsigned int, facility_id, + unsigned int, event_id, void *, data, size_t, data_size, int, blocking) static inline _syscall2(int, ltt_register_generic, unsigned int *, facility_id, const struct user_facility_info *, info) #ifndef LTT_PACK diff --git a/usertrace-generic/sample-highspeed.c b/usertrace-generic/sample-highspeed.c new file mode 100644 index 00000000..bd9ea37a --- /dev/null +++ b/usertrace-generic/sample-highspeed.c @@ -0,0 +1,20 @@ + +#include +#include + +#define LTT_TRACE +#define LTT_BLOCKING 1 +#include + + +int main(int argc, char **argv) +{ + printf("Will trace the following string : Running fast! in a infinite loop.\n"); + + while(1) { + trace_user_generic_string("Running fast!"); + } + + return 0; +} + diff --git a/usertrace-generic/sample.c b/usertrace-generic/sample.c index 7692ee72..efe4110b 100644 --- a/usertrace-generic/sample.c +++ b/usertrace-generic/sample.c @@ -3,6 +3,7 @@ #include #define LTT_TRACE +#define LTT_BLOCKING 1 #include -- 2.34.1