From 4df264b25d1f52f067b72415d964718649934592 Mon Sep 17 00:00:00 2001 From: compudj Date: Tue, 20 Jun 2006 15:35:50 +0000 Subject: [PATCH] test block git-svn-id: http://ltt.polymtl.ca/svn@1939 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt-usertrace/Makefile | 4 +++- ltt-usertrace/sample-block.c | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 ltt-usertrace/sample-block.c diff --git a/ltt-usertrace/Makefile b/ltt-usertrace/Makefile index c7ca3cf5..c59c0edf 100644 --- a/ltt-usertrace/Makefile +++ b/ltt-usertrace/Makefile @@ -15,10 +15,12 @@ all: libs samples #SAMPLE PROGRAMS samples: sample sample-highspeed sample-printf \ - sample-instrument-fct sample-thread-slow sample-thread-fast sample-thread-brand + sample-instrument-fct sample-thread-slow sample-thread-fast sample-thread-brand sample-block sample: sample.c ltt-facility-loader-user_generic.c $(CC) $(LTT_CFLAGS) $(CFLAGS) -o $@ $^ +sample-block: sample-block.c ltt-facility-loader-user_generic.c + $(CC) $(LTT_CFLAGS) $(CFLAGS) -o $@ $^ sample-thread-brand: sample-thread-brand.c ltt-facility-loader-user_generic.c $(CC) $(LTT_CFLAGS) $(CFLAGS) -o $@ $^ diff --git a/ltt-usertrace/sample-block.c b/ltt-usertrace/sample-block.c new file mode 100644 index 00000000..10c4bdd9 --- /dev/null +++ b/ltt-usertrace/sample-block.c @@ -0,0 +1,25 @@ + +#include +#include + +#define LTT_TRACE +#define LTT_BLOCKING 1 +#include + + +int main(int argc, char **argv) +{ + printf("Will trace the following string : \"Hello world! Have a nice day.\"\n"); + printf("every second.\n"); + printf("Abort with CTRL-C.\n"); + printf("No file is created with this example : it logs through a kernel\n"); + printf("system call. See the LTTng lttctl command to start tracing.\n"); + + while(1) { + trace_user_generic_string("Hello world! Have a nice day."); + usleep(1); + } + + return 0; +} + -- 2.34.1