remove old usertrace
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 9 Mar 2006 20:23:52 +0000 (20:23 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Thu, 9 Mar 2006 20:23:52 +0000 (20:23 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@1635 04897980-b3bd-0310-b5e0-8ef037075253

30 files changed:
lttng-usertrace/Makefile [new file with mode: 0644]
lttng-usertrace/README [new file with mode: 0644]
lttng-usertrace/ltt-facility-loader-user_generic.c [new file with mode: 0644]
lttng-usertrace/ltt-facility-loader-user_generic.h [new file with mode: 0644]
lttng-usertrace/ltt-instrument-functions.c [new file with mode: 0644]
lttng-usertrace/ltt/ltt-facility-custom-user_generic.h [new file with mode: 0644]
lttng-usertrace/ltt/ltt-facility-id-user_generic.h [new file with mode: 0644]
lttng-usertrace/ltt/ltt-facility-user_generic.h [new file with mode: 0644]
lttng-usertrace/ltt/ltt-generic.h [new file with mode: 0644]
lttng-usertrace/sample-highspeed.c [new file with mode: 0644]
lttng-usertrace/sample-instrument-fct.c [new file with mode: 0644]
lttng-usertrace/sample-printf.c [new file with mode: 0644]
lttng-usertrace/sample-thread.c [new file with mode: 0644]
lttng-usertrace/sample.c [new file with mode: 0644]
lttng-usertrace/user_generic.xml [new file with mode: 0644]
usertrace-generic/Makefile [deleted file]
usertrace-generic/README [deleted file]
usertrace-generic/ltt-facility-loader-user_generic.c [deleted file]
usertrace-generic/ltt-facility-loader-user_generic.h [deleted file]
usertrace-generic/ltt-instrument-functions.c [deleted file]
usertrace-generic/ltt/ltt-facility-custom-user_generic.h [deleted file]
usertrace-generic/ltt/ltt-facility-id-user_generic.h [deleted file]
usertrace-generic/ltt/ltt-facility-user_generic.h [deleted file]
usertrace-generic/ltt/ltt-generic.h [deleted file]
usertrace-generic/sample-highspeed.c [deleted file]
usertrace-generic/sample-instrument-fct.c [deleted file]
usertrace-generic/sample-printf.c [deleted file]
usertrace-generic/sample-thread.c [deleted file]
usertrace-generic/sample.c [deleted file]
usertrace-generic/user_generic.xml [deleted file]

diff --git a/lttng-usertrace/Makefile b/lttng-usertrace/Makefile
new file mode 100644 (file)
index 0000000..292a5bc
--- /dev/null
@@ -0,0 +1,43 @@
+
+CC=gcc
+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
+
+sample-thread: sample-thread.c ltt-facility-loader-user_generic.c
+       $(CC) $(CFLAGS) -lpthread -o $@ $^
+
+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 $@ $^
+
+sample-printf: sample-printf.c ltt-facility-loader-user_generic.c
+       $(CC) $(CFLAGS) -o $@ $^
+
+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
+       @rm -f libltt-instrument-functions.a
+       $(AR) rc $@ $^
+       $(RANLIB) $@
+
+libltt-instrument-functions.so.0: ltt-instrument-functions.o ltt-facility-loader-user_generic.o
+       @rm -f libltt-instrument-functions.so libltt-instrument-functions.so.0
+       $(CC) $(CFLAGS) -shared -Wl,-soname,libltt-instrument-functions.so -o $@ $^
+       ln -s libltt-instrument-functions.so.0 libltt-instrument-functions.so
+
+.PHONY : clean install
+
+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)
+
+clean:
+       rm -fr *.o *~ sample-thread sample sample-highspeed sample-printf sample-instrument-fct libltt-instrument-functions.so* libltt-instrument-functions.a
+
diff --git a/lttng-usertrace/README b/lttng-usertrace/README
new file mode 100644 (file)
index 0000000..b9ac1fb
--- /dev/null
@@ -0,0 +1,193 @@
+
+LTTng usertrace generic package
+
+Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
+March 2006
+
+This package contains all the user space headers and c files necessary to make
+your application and library trace through an active LTTng tracer. Here is a
+short quickstart guide of it.
+
+Here are the currently supported architectures :
+x86
+(please add the ltt_* system calls to other architectures as you need them : it
+will work magically)
+
+* Compile your kernel with the latest LTTng patch. Make sure the option 
+  "Allow tracing from userspace" is _active_!
+  See the QUICKSTART guide at http://ltt.polymtl.ca/ for details about how to
+  setup a working tracer and viewer. See the genevent installation step : it is
+  required for method #2 below.
+  
+* Extract the latest usertrace-generic archive :
+su
+cd /usr/src
+wget http://ltt.polymtl.ca/packages/usertrace-generic-x.x.tar.gz
+gzip -cd usertrace-generic-x.x.tar.gz | tar xvof -
+
+* Build the sample programs and install the headers into your system :
+su
+cd /usr/src/usertrace-generic
+make
+make install
+
+* There are two ways to trace information from your application :
+
+1) Easy way, but slow (printf style)
+  See sample-printf.c for code example.
+
+- Add the following statements to your program source (the define must come
+  _before_ the includes!) :
+
+#define LTT_TRACE
+#define LTT_BLOCKING 1
+#include <ltt/ltt-facility-user_generic.h>
+#include <ltt/ltt-facility-custom-user_generic.h>
+
+Note the define of LTT_BLOCKING to 1 : if a trace buffer is full, your
+application will block. The default of this parameter is 0 (non blocking) :
+events are lost when trace buffer is full. The choice is up to you.
+
+- Add something like the following sample line in your code. Note that this is a
+  very standard format string, this is only a suggested presentation.
+  
+trace_user_generic_slow_printf("in: %s at: %s:%d: Counter value is: %u.",
+                               __FILE__, __func__, __LINE__, count);
+
+- Compile your application with at least these parameters to gcc (it is splitted
+  on two lines, joined by a "\") :
+gcc -D LTT_SHOW_DEBUG -I /usr/src/usertrace-generic -o myapp myapp.c \
+  /usr/src/usertrace-generic/ltt-facility-loader-user_generic.c
+
+To see what the final result looks like :
+- Start tracing
+- Start your application
+  ** You should see the following message when your program starts and the
+  LTT_SHOW_DEBUG is defined : 
+    "LTT : ltt-facility-user_generic init in userspace"
+    If you don't then you forgot to compile the facility loader in your
+    application. If you find this output annoying, you can remove the
+    "-D LTT_SHOW_DEBUG" gcc parameter, which will make the facility loader
+    silent.
+- Stop tracing
+Then, to see only the user_generic events :
+lttv -m textDump -t /tmp/trace1 -e "event.facility=user_generic"
+
+It will show :
+user_generic.slow_printf: 35885.922829472 (/cpu_0), 15521, 7453,  SYSCALL { "in: sample-printf.c at: main:18: Counter value is: 0." }
+user_generic.slow_printf: 35886.925685289 (/cpu_0), 15521, 7453,  SYSCALL { "in: sample-printf.c at: main:18: Counter value is: 1." }
+...
+
+
+
+2) The second way to log events is still easy, yet faster. It requires creating
+   your own XML description of your data structures. It will make it easier to
+   identify your data in the trace. Please read the comments in method 1)
+   explained previously, as they are not repeated here.
+   See sample.c for code example.
+
+- Go to the usertrace-generic directory
+su
+cd /usr/src/usertrace-generic
+
+- Create your own facility (i.e. user_myfacility.xml).
+  See the ones available in /usr/share/LinuxTraceToolkitViewer/facilities for
+  examples.
+  You facility _must_ be named following this standard : "user_*", where * is
+  whatever you like. If it is not, it will be rejected by the kernel with a
+  Operation not permitted (can be seen with the -D LTT_SHOW_DEBUG compilation
+  parameter).
+
+user_myfacility.xml:
+
+<facility name="user_myfacility">
+  <description>Sample facility</description>
+  <event name="myevent">
+    <description>Sample event</description>
+    <field name="file"><string></field>
+    <field name="function"><string></field>
+    <field name="line"><int></field>
+    <field name="firstval"><long></field>
+    <field name="secondval"><pointer></field>
+  </event>
+</facility>
+
+- AN IMPORTANT STEP FOLLOWS :
+  *copy* the user_myfacility.xml file in your system :
+su
+cp user_myfacility.xml /usr/share/LinuxTraceToolkitViewer/facilities
+
+- Use genevent to create the c code and headers :
+su
+cd /tmp
+mkdir genevent
+cd genevent
+for a in /usr/share/LinuxTraceToolkitViewer/facilities/user_*.xml;
+  do /usr/local/bin/genevent $a;
+done
+cd /usr/src/usertrace-generic
+cp /tmp/genevent/*load* .
+cd ltt
+cp /tmp/genevent/ltt-facility-id-user_myfacility.h .
+cp /tmp/genevent/ltt-facility-user_myfacility.h .
+cd ..
+make install
+
+- Add the following statements to your program source (the define must come
+  _before_ the includes!) :
+
+#define LTT_TRACE
+#define LTT_BLOCKING 1
+#include <ltt/ltt-facility-user_myfacility.h>
+
+- Add a call following the trace_user_myfacility_myevent function found in 
+  /usr/include/ltt/ltt-facility-user_myfacility.h in your program.
+For instance :
+trace_user_myfacility_myevent(__FILE__, __func__, __LINE__, 1234, (void*)0xF0F0F0F0);
+
+- Compile your application with at least these parameters to gcc (it is splitted
+  on two lines, joined by a "\") :
+gcc -I /usr/src/usertrace-generic -o myapp myapp.c \
+  /usr/src/usertrace-generic/ltt-facility-loader-user_myfacility.c
+
+To see what the final result looks like :
+- Start tracing
+- Start your application
+- Stop tracing
+Then, to see only the user_myfacility events :
+lttv -m textDump -t /tmp/trace1 -e "event.facility=user_myfacility"
+
+It will show, for example :
+user_myfacility.myevent: 39507.805584526 (/cpu_1), 15829, 15736,  SYSCALL { "myapp.c", "main", 8, 1234, 0xf0f0f0f0 }
+
+
+* Fun feature : function instrumentation
+
+Here is how to generate a full trace of you program function calls.
+See the sample-instrument-fct.c example program.
+
+- Compile your application with at least these parameters to gcc (it is splitted
+  on two lines, joined by a "\") :
+gcc -g -finstrument-functions \
+  -lltt-instrument-functions -o myapp myapp.c
+
+To see what the final result looks like :
+- Start tracing
+- Start your application
+- Stop tracing
+Then, to see only the function_entry and function_exit events :
+lttv -m textDump -t /tmp/trace1 -e "event.facility=user_generic & (event.name=function_entry & event.name=function_exit)"
+
+It will show, for example :
+user_generic.function_entry: 59329.709939111 (/cpu_0), 19250, 18581,  SYSCALL { 0x8048454, 0x80484c2 }
+user_generic.function_exit: 59329.709944613 (/cpu_0), 19250, 18581,  SYSCALL { 0x8048454, 0x80484c2 }
+
+you can then use (from the binutils package)
+addr2line -e sample-instrument-fct -i -f 0x8048454
+Which shows :
+test_function
+/usr/src/usertrace-generic/sample-instrument-fct.c:12
+
+The lookup in LTTV through libbfd has not been implemented yet.
+
+
diff --git a/lttng-usertrace/ltt-facility-loader-user_generic.c b/lttng-usertrace/ltt-facility-loader-user_generic.c
new file mode 100644 (file)
index 0000000..8cdb076
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * ltt-facility-loader-user_generic.c
+ *
+ * (C) Copyright  2005 - 
+ *          Mathieu Desnoyers (mathieu.desnoyers@polymtl.ca)
+ *
+ * Contains the LTT user space facility loader.
+ *
+ */
+
+
+#define LTT_TRACE
+#include <error.h>
+#include <stdio.h>
+#include <ltt/ltt-generic.h>
+#include "ltt-facility-loader-user_generic.h"
+
+static struct user_facility_info facility = {
+       .name = LTT_FACILITY_NAME,
+       .num_events = LTT_FACILITY_NUM_EVENTS,
+#ifndef LTT_PACK
+       .alignment = sizeof(void*),
+#else
+       .alignment = 0,
+#endif //LTT_PACK
+       .checksum = LTT_FACILITY_CHECKSUM,
+       .int_size = sizeof(int),
+       .long_size = sizeof(long),
+       .pointer_size = sizeof(void*),
+       .size_t_size = sizeof(size_t)
+};
+
+static void __attribute__((constructor)) __ltt_user_init(void)
+{
+       int err;
+#ifdef LTT_SHOW_DEBUG
+       printf("LTT : ltt-facility-user_generic init in userspace\n");
+#endif //LTT_SHOW_DEBUG
+
+       err = ltt_register_generic(&LTT_FACILITY_SYMBOL, &facility);
+       LTT_FACILITY_CHECKSUM_SYMBOL = LTT_FACILITY_SYMBOL;
+       
+       if(err) {
+#ifdef LTT_SHOW_DEBUG
+               perror("Error in ltt_register_generic");
+#endif //LTT_SHOW_DEBUG
+       }
+}
+
diff --git a/lttng-usertrace/ltt-facility-loader-user_generic.h b/lttng-usertrace/ltt-facility-loader-user_generic.h
new file mode 100644 (file)
index 0000000..1f93d1e
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef _LTT_FACILITY_LOADER_USER_GENERIC_H_
+#define _LTT_FACILITY_LOADER_USER_GENERIC_H_
+
+#include <ltt/ltt-generic.h>
+#include <ltt/ltt-facility-id-user_generic.h>
+
+ltt_facility_t ltt_facility_user_generic;
+ltt_facility_t ltt_facility_user_generic_F583779E;
+
+#define LTT_FACILITY_SYMBOL                                                    ltt_facility_user_generic
+#define LTT_FACILITY_CHECKSUM_SYMBOL           ltt_facility_user_generic_F583779E
+#define LTT_FACILITY_CHECKSUM                                          0xF583779E
+#define LTT_FACILITY_NAME                                                              "user_generic"
+#define LTT_FACILITY_NUM_EVENTS                                        facility_user_generic_num_events
+
+#endif //_LTT_FACILITY_LOADER_USER_GENERIC_H_
diff --git a/lttng-usertrace/ltt-instrument-functions.c b/lttng-usertrace/ltt-instrument-functions.c
new file mode 100644 (file)
index 0000000..5d1b276
--- /dev/null
@@ -0,0 +1,28 @@
+/****************************************************************************
+ * ltt-instrument-functions.c
+ *
+ * Mathieu Desnoyers
+ * March 2006
+ */
+
+#define LTT_TRACE
+#define LTT_BLOCKING 1
+#include <ltt/ltt-facility-user_generic.h>
+
+
+void __attribute__((no_instrument_function)) __cyg_profile_func_enter (
+               void *this_fn,
+               void *call_site)
+{
+       /* don't care about the return value */
+       trace_user_generic_function_entry(this_fn, call_site);
+}
+
+void __attribute__((no_instrument_function)) __cyg_profile_func_exit (
+               void *this_fn,
+               void *call_site)
+{
+       /* don't care about the return value */
+       trace_user_generic_function_exit(this_fn, call_site);
+}
+
diff --git a/lttng-usertrace/ltt/ltt-facility-custom-user_generic.h b/lttng-usertrace/ltt/ltt-facility-custom-user_generic.h
new file mode 100644 (file)
index 0000000..f3a77f7
--- /dev/null
@@ -0,0 +1,53 @@
+#ifndef _LTT_FACILITY_CUSTOM_USER_GENERIC_H_
+#define _LTT_FACILITY_CUSTOM_USER_GENERIC_H_
+
+#include <sys/types.h>
+#include <ltt/ltt-facility-id-user_generic.h>
+#include <ltt/ltt-generic.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+static inline int trace_user_generic_slow_printf(
+               const char *fmt, ...)
+#ifndef LTT_TRACE
+{
+}
+#else
+{
+       /* Guess we need no more than 100 bytes. */
+       int n, size = 100;
+       char *p, *np;
+       va_list ap;
+       int ret;
+
+       if ((p = malloc (size)) == NULL)
+               return -1;
+
+       while (1) {
+               /* Try to print in the allocated space. */
+               va_start(ap, fmt);
+               n = vsnprintf (p, size, fmt, ap);
+               va_end(ap);
+               /* If that worked, trace the string. */
+               if (n > -1 && n < size) {
+                       ret = trace_user_generic_slow_printf_param_buffer(p, n+1);
+                       free(p);
+                       return ret;
+               }
+               /* Else try again with more space. */
+               if (n > -1)    /* glibc 2.1 */
+                        size = n+1; /* precisely what is needed */
+               else           /* glibc 2.0 */
+                        size *= 2;  /* twice the old size */
+               if ((np = realloc (p, size)) == NULL) {
+                        free(p);
+                        return -1;
+               } else {
+                        p = np;
+               }
+       }
+}
+#endif //LTT_TRACE
+
+#endif //_LTT_FACILITY_CUSTOM_USER_GENERIC_H_
diff --git a/lttng-usertrace/ltt/ltt-facility-id-user_generic.h b/lttng-usertrace/ltt/ltt-facility-id-user_generic.h
new file mode 100644 (file)
index 0000000..87205eb
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef _LTT_FACILITY_ID_USER_GENERIC_H_
+#define _LTT_FACILITY_ID_USER_GENERIC_H_
+
+#ifdef LTT_TRACE
+#include <ltt/ltt-generic.h>
+
+/****  facility handle  ****/
+
+extern ltt_facility_t ltt_facility_user_generic_F583779E;
+extern ltt_facility_t ltt_facility_user_generic;
+
+
+/****  event index  ****/
+
+enum user_generic_event {
+       event_user_generic_string,
+       event_user_generic_string_pointer,
+       event_user_generic_slow_printf,
+       event_user_generic_function_entry,
+       event_user_generic_function_exit,
+       facility_user_generic_num_events
+};
+
+#endif //LTT_TRACE
+#endif //_LTT_FACILITY_ID_USER_GENERIC_H_
diff --git a/lttng-usertrace/ltt/ltt-facility-user_generic.h b/lttng-usertrace/ltt/ltt-facility-user_generic.h
new file mode 100644 (file)
index 0000000..94a636d
--- /dev/null
@@ -0,0 +1,1036 @@
+#ifndef _LTT_FACILITY_USER_GENERIC_H_
+#define _LTT_FACILITY_USER_GENERIC_H_
+
+#include <sys/types.h>
+#include <ltt/ltt-facility-id-user_generic.h>
+#include <ltt/ltt-generic.h>
+
+/* Named types */
+
+/* Event string structures */
+static inline void lttng_write_string_user_generic_string_data(
+               void *buffer,
+               size_t *to_base,
+               size_t *to,
+               const void **from,
+               size_t *len,
+               const char * obj)
+{
+       size_t size;
+       size_t align;
+
+       /* Flush pending memcpy */
+       if(*len != 0) {
+               if(buffer != NULL)
+                       memcpy(buffer+*to_base+*to, *from, *len);
+       }
+       *to += *len;
+       *len = 0;
+
+       align = sizeof(char);
+
+       if(*len == 0) {
+               *to += ltt_align(*to, align); /* align output */
+       } else {
+               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+       }
+
+       /* Contains variable sized fields : must explode the structure */
+
+       size = strlen(obj) + 1; /* Include final NULL char. */
+       if(buffer != NULL)
+               memcpy(buffer+*to_base+*to, obj, size);
+       *to += size;
+
+       /* Realign the *to_base on arch size, set *to to 0 */
+       *to += ltt_align(*to, sizeof(void *));
+       *to_base = *to_base+*to;
+       *to = 0;
+
+       /* Put source *from just after the C string */
+       *from += size;
+}
+
+
+/* Event string logging function */
+#ifndef LTT_TRACE_FAST
+static inline int trace_user_generic_string(
+               const char * lttng_param_data)
+#ifndef LTT_TRACE
+{
+}
+#else
+{
+       int ret = 0;
+       void *buffer = NULL;
+       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
+       size_t *to_base = &real_to_base;
+       size_t real_to = 0;
+       size_t *to = &real_to;
+       size_t real_len = 0;
+       size_t *len = &real_len;
+       size_t reserve_size;
+       size_t slot_size;
+       const void *real_from;
+       const void **from = &real_from;
+               /* For each field, calculate the field size. */
+       /* size = *to_base + *to + *len */
+       /* Assume that the padding for alignment starts at a
+        * sizeof(void *) address. */
+
+       *from = lttng_param_data;
+       lttng_write_string_user_generic_string_data(buffer, to_base, to, from, len, lttng_param_data);
+
+       reserve_size = *to_base + *to + *len;
+       {
+               char stack_buffer[reserve_size];
+               buffer = stack_buffer;
+
+               *to_base = *to = *len = 0;
+
+               *from = lttng_param_data;
+               lttng_write_string_user_generic_string_data(buffer, to_base, to, from, len, lttng_param_data);
+
+               /* Flush pending memcpy */
+               if(*len != 0) {
+                       memcpy(buffer+*to_base+*to, *from, *len);
+                       *to += *len;
+                       *len = 0;
+               }
+
+               ret = ltt_trace_generic(ltt_facility_user_generic_F583779E, event_user_generic_string, buffer, reserve_size, LTT_BLOCKING);
+       }
+
+       return ret;
+
+}
+#endif //LTT_TRACE
+#endif //!LTT_TRACE_FAST
+
+#ifdef LTT_TRACE_FAST
+static inline int trace_user_generic_string(
+               const char * lttng_param_data)
+#ifndef LTT_TRACE
+{
+}
+#else
+{
+       unsigned int index;
+       struct ltt_trace_info *trace = thread_trace_info;
+       struct ltt_buf *ltt_buf;
+       void *buffer = NULL;
+       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
+       size_t *to_base = &real_to_base;
+       size_t real_to = 0;
+       size_t *to = &real_to;
+       size_t real_len = 0;
+       size_t *len = &real_len;
+       size_t reserve_size;
+       size_t slot_size;
+       const void *real_from;
+       const void **from = &real_from;
+       uint64_t tsc;
+       size_t before_hdr_pad, after_hdr_pad, header_size;
+
+       if(!trace) {
+               ltt_thread_init();
+               trace = thread_trace_info;
+       }
+
+
+       /* For each field, calculate the field size. */
+       /* size = *to_base + *to + *len */
+       /* Assume that the padding for alignment starts at a
+        * sizeof(void *) address. */
+
+       *from = lttng_param_data;
+       lttng_write_string_user_generic_string_data(buffer, to_base, to, from, len, lttng_param_data);
+
+       reserve_size = *to_base + *to + *len;
+       trace->nesting++;
+       index = ltt_get_index_from_facility(ltt_facility_user_generic_F583779E,
+                                               event_user_generic_string);
+
+       {
+               ltt_buf = ltt_get_channel_from_index(trace, index);
+                               slot_size = 0;
+               buffer = ltt_reserve_slot(trace, ltt_buf,
+                       reserve_size, &slot_size, &tsc,
+                       &before_hdr_pad, &after_hdr_pad, &header_size);
+               if(!buffer) goto end; /* buffer full */
+
+               *to_base = *to = *len = 0;
+
+               ltt_write_event_header(trace, ltt_buf, buffer,
+                       ltt_facility_user_generic_F583779E, event_user_generic_string,
+                       reserve_size, before_hdr_pad, tsc);
+               *to_base += before_hdr_pad + after_hdr_pad + header_size;
+
+               *from = lttng_param_data;
+               lttng_write_string_user_generic_string_data(buffer, to_base, to, from, len, lttng_param_data);
+
+               /* Flush pending memcpy */
+               if(*len != 0) {
+                       memcpy(buffer+*to_base+*to, *from, *len);
+                       *to += *len;
+                       *len = 0;
+               }
+
+               ltt_commit_slot(ltt_buf, buffer, slot_size);
+
+}
+
+end:
+       trace->nesting--;
+}
+#endif //LTT_TRACE
+#endif //LTT_TRACE_FAST
+
+/* Event string_pointer structures */
+static inline void lttng_write_string_user_generic_string_pointer_string(
+               void *buffer,
+               size_t *to_base,
+               size_t *to,
+               const void **from,
+               size_t *len,
+               const char * obj)
+{
+       size_t size;
+       size_t align;
+
+       /* Flush pending memcpy */
+       if(*len != 0) {
+               if(buffer != NULL)
+                       memcpy(buffer+*to_base+*to, *from, *len);
+       }
+       *to += *len;
+       *len = 0;
+
+       align = sizeof(char);
+
+       if(*len == 0) {
+               *to += ltt_align(*to, align); /* align output */
+       } else {
+               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+       }
+
+       /* Contains variable sized fields : must explode the structure */
+
+       size = strlen(obj) + 1; /* Include final NULL char. */
+       if(buffer != NULL)
+               memcpy(buffer+*to_base+*to, obj, size);
+       *to += size;
+
+       /* Realign the *to_base on arch size, set *to to 0 */
+       *to += ltt_align(*to, sizeof(void *));
+       *to_base = *to_base+*to;
+       *to = 0;
+
+       /* Put source *from just after the C string */
+       *from += size;
+}
+
+
+/* Event string_pointer logging function */
+#ifndef LTT_TRACE_FAST
+static inline int trace_user_generic_string_pointer(
+               const char * lttng_param_string,
+               const void * lttng_param_pointer)
+#ifndef LTT_TRACE
+{
+}
+#else
+{
+       int ret = 0;
+       void *buffer = NULL;
+       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
+       size_t *to_base = &real_to_base;
+       size_t real_to = 0;
+       size_t *to = &real_to;
+       size_t real_len = 0;
+       size_t *len = &real_len;
+       size_t reserve_size;
+       size_t slot_size;
+       size_t align;
+       const void *real_from;
+       const void **from = &real_from;
+               /* For each field, calculate the field size. */
+       /* size = *to_base + *to + *len */
+       /* Assume that the padding for alignment starts at a
+        * sizeof(void *) address. */
+
+       *from = lttng_param_string;
+       lttng_write_string_user_generic_string_pointer_string(buffer, to_base, to, from, len, lttng_param_string);
+
+       *from = &lttng_param_pointer;
+       align = sizeof(const void *);
+
+       if(*len == 0) {
+               *to += ltt_align(*to, align); /* align output */
+       } else {
+               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+       }
+
+       *len += sizeof(const void *);
+
+       reserve_size = *to_base + *to + *len;
+       {
+               char stack_buffer[reserve_size];
+               buffer = stack_buffer;
+
+               *to_base = *to = *len = 0;
+
+               *from = lttng_param_string;
+               lttng_write_string_user_generic_string_pointer_string(buffer, to_base, to, from, len, lttng_param_string);
+
+               /* Flush pending memcpy */
+               if(*len != 0) {
+                       memcpy(buffer+*to_base+*to, *from, *len);
+                       *to += *len;
+                       *len = 0;
+               }
+
+               *from = &lttng_param_pointer;
+               align = sizeof(const void *);
+
+               if(*len == 0) {
+                       *to += ltt_align(*to, align); /* align output */
+               } else {
+                       *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+               }
+
+               *len += sizeof(const void *);
+
+               /* Flush pending memcpy */
+               if(*len != 0) {
+                       memcpy(buffer+*to_base+*to, *from, *len);
+                       *to += *len;
+                       *len = 0;
+               }
+
+               ret = ltt_trace_generic(ltt_facility_user_generic_F583779E, event_user_generic_string_pointer, buffer, reserve_size, LTT_BLOCKING);
+       }
+
+       return ret;
+
+}
+#endif //LTT_TRACE
+#endif //!LTT_TRACE_FAST
+
+#ifdef LTT_TRACE_FAST
+static inline int trace_user_generic_string_pointer(
+               const char * lttng_param_string,
+               const void * lttng_param_pointer)
+#ifndef LTT_TRACE
+{
+}
+#else
+{
+       unsigned int index;
+       struct ltt_trace_info *trace = thread_trace_info;
+       struct ltt_buf *ltt_buf;
+       void *buffer = NULL;
+       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
+       size_t *to_base = &real_to_base;
+       size_t real_to = 0;
+       size_t *to = &real_to;
+       size_t real_len = 0;
+       size_t *len = &real_len;
+       size_t reserve_size;
+       size_t slot_size;
+       size_t align;
+       const void *real_from;
+       const void **from = &real_from;
+       uint64_t tsc;
+       size_t before_hdr_pad, after_hdr_pad, header_size;
+
+       if(!trace) {
+               ltt_thread_init();
+               trace = thread_trace_info;
+       }
+
+
+       /* For each field, calculate the field size. */
+       /* size = *to_base + *to + *len */
+       /* Assume that the padding for alignment starts at a
+        * sizeof(void *) address. */
+
+       *from = lttng_param_string;
+       lttng_write_string_user_generic_string_pointer_string(buffer, to_base, to, from, len, lttng_param_string);
+
+       *from = &lttng_param_pointer;
+       align = sizeof(const void *);
+
+       if(*len == 0) {
+               *to += ltt_align(*to, align); /* align output */
+       } else {
+               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+       }
+
+       *len += sizeof(const void *);
+
+       reserve_size = *to_base + *to + *len;
+       trace->nesting++;
+       index = ltt_get_index_from_facility(ltt_facility_user_generic_F583779E,
+                                               event_user_generic_string_pointer);
+
+       {
+               ltt_buf = ltt_get_channel_from_index(trace, index);
+                               slot_size = 0;
+               buffer = ltt_reserve_slot(trace, ltt_buf,
+                       reserve_size, &slot_size, &tsc,
+                       &before_hdr_pad, &after_hdr_pad, &header_size);
+               if(!buffer) goto end; /* buffer full */
+
+               *to_base = *to = *len = 0;
+
+               ltt_write_event_header(trace, ltt_buf, buffer,
+                       ltt_facility_user_generic_F583779E, event_user_generic_string_pointer,
+                       reserve_size, before_hdr_pad, tsc);
+               *to_base += before_hdr_pad + after_hdr_pad + header_size;
+
+               *from = lttng_param_string;
+               lttng_write_string_user_generic_string_pointer_string(buffer, to_base, to, from, len, lttng_param_string);
+
+               /* Flush pending memcpy */
+               if(*len != 0) {
+                       memcpy(buffer+*to_base+*to, *from, *len);
+                       *to += *len;
+                       *len = 0;
+               }
+
+               *from = &lttng_param_pointer;
+               align = sizeof(const void *);
+
+               if(*len == 0) {
+                       *to += ltt_align(*to, align); /* align output */
+               } else {
+                       *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+               }
+
+               *len += sizeof(const void *);
+
+               /* Flush pending memcpy */
+               if(*len != 0) {
+                       memcpy(buffer+*to_base+*to, *from, *len);
+                       *to += *len;
+                       *len = 0;
+               }
+
+               ltt_commit_slot(ltt_buf, buffer, slot_size);
+
+}
+
+end:
+       trace->nesting--;
+}
+#endif //LTT_TRACE
+#endif //LTT_TRACE_FAST
+
+/* Event slow_printf structures */
+static inline void lttng_write_string_user_generic_slow_printf_string(
+               void *buffer,
+               size_t *to_base,
+               size_t *to,
+               const void **from,
+               size_t *len,
+               const char * obj)
+{
+       size_t size;
+       size_t align;
+
+       /* Flush pending memcpy */
+       if(*len != 0) {
+               if(buffer != NULL)
+                       memcpy(buffer+*to_base+*to, *from, *len);
+       }
+       *to += *len;
+       *len = 0;
+
+       align = sizeof(char);
+
+       if(*len == 0) {
+               *to += ltt_align(*to, align); /* align output */
+       } else {
+               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+       }
+
+       /* Contains variable sized fields : must explode the structure */
+
+       size = strlen(obj) + 1; /* Include final NULL char. */
+       if(buffer != NULL)
+               memcpy(buffer+*to_base+*to, obj, size);
+       *to += size;
+
+       /* Realign the *to_base on arch size, set *to to 0 */
+       *to += ltt_align(*to, sizeof(void *));
+       *to_base = *to_base+*to;
+       *to = 0;
+
+       /* Put source *from just after the C string */
+       *from += size;
+}
+
+
+/* Event slow_printf logging function */
+#ifndef LTT_TRACE_FAST
+static inline int trace_user_generic_slow_printf_param_buffer(
+               void *buffer,
+               size_t reserve_size)
+#ifndef LTT_TRACE
+{
+}
+#else
+{
+       int ret = 0;
+       reserve_size = ltt_align(reserve_size, sizeof(void *));
+       {
+               ret = ltt_trace_generic(ltt_facility_user_generic_F583779E, event_user_generic_slow_printf, buffer, reserve_size, LTT_BLOCKING);
+       }
+
+       return ret;
+
+}
+#endif //LTT_TRACE
+#endif //!LTT_TRACE_FAST
+
+#ifdef LTT_TRACE_FAST
+static inline int trace_user_generic_slow_printf(
+               const char * lttng_param_string)
+#ifndef LTT_TRACE
+{
+}
+#else
+{
+       unsigned int index;
+       struct ltt_trace_info *trace = thread_trace_info;
+       struct ltt_buf *ltt_buf;
+       void *buffer = NULL;
+       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
+       size_t *to_base = &real_to_base;
+       size_t real_to = 0;
+       size_t *to = &real_to;
+       size_t real_len = 0;
+       size_t *len = &real_len;
+       size_t reserve_size;
+       size_t slot_size;
+       const void *real_from;
+       const void **from = &real_from;
+       uint64_t tsc;
+       size_t before_hdr_pad, after_hdr_pad, header_size;
+
+       if(!trace) {
+               ltt_thread_init();
+               trace = thread_trace_info;
+       }
+
+
+       /* For each field, calculate the field size. */
+       /* size = *to_base + *to + *len */
+       /* Assume that the padding for alignment starts at a
+        * sizeof(void *) address. */
+
+       *from = lttng_param_string;
+       lttng_write_string_user_generic_slow_printf_string(buffer, to_base, to, from, len, lttng_param_string);
+
+       reserve_size = *to_base + *to + *len;
+       trace->nesting++;
+       index = ltt_get_index_from_facility(ltt_facility_user_generic_F583779E,
+                                               event_user_generic_slow_printf);
+
+       {
+               ltt_buf = ltt_get_channel_from_index(trace, index);
+                               slot_size = 0;
+               buffer = ltt_reserve_slot(trace, ltt_buf,
+                       reserve_size, &slot_size, &tsc,
+                       &before_hdr_pad, &after_hdr_pad, &header_size);
+               if(!buffer) goto end; /* buffer full */
+
+               *to_base = *to = *len = 0;
+
+               ltt_write_event_header(trace, ltt_buf, buffer,
+                       ltt_facility_user_generic_F583779E, event_user_generic_slow_printf,
+                       reserve_size, before_hdr_pad, tsc);
+               *to_base += before_hdr_pad + after_hdr_pad + header_size;
+
+               *from = lttng_param_string;
+               lttng_write_string_user_generic_slow_printf_string(buffer, to_base, to, from, len, lttng_param_string);
+
+               /* Flush pending memcpy */
+               if(*len != 0) {
+                       memcpy(buffer+*to_base+*to, *from, *len);
+                       *to += *len;
+                       *len = 0;
+               }
+
+               ltt_commit_slot(ltt_buf, buffer, slot_size);
+
+}
+
+end:
+       trace->nesting--;
+}
+#endif //LTT_TRACE
+#endif //LTT_TRACE_FAST
+
+/* Event function_entry structures */
+
+/* Event function_entry logging function */
+#ifndef LTT_TRACE_FAST
+static inline __attribute__((no_instrument_function)) int trace_user_generic_function_entry(
+               const void * lttng_param_this_fn,
+               const void * lttng_param_call_site)
+#ifndef LTT_TRACE
+{
+}
+#else
+{
+       int ret = 0;
+       void *buffer = NULL;
+       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
+       size_t *to_base = &real_to_base;
+       size_t real_to = 0;
+       size_t *to = &real_to;
+       size_t real_len = 0;
+       size_t *len = &real_len;
+       size_t reserve_size;
+       size_t slot_size;
+       size_t align;
+       const void *real_from;
+       const void **from = &real_from;
+               /* For each field, calculate the field size. */
+       /* size = *to_base + *to + *len */
+       /* Assume that the padding for alignment starts at a
+        * sizeof(void *) address. */
+
+       *from = &lttng_param_this_fn;
+       align = sizeof(const void *);
+
+       if(*len == 0) {
+               *to += ltt_align(*to, align); /* align output */
+       } else {
+               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+       }
+
+       *len += sizeof(const void *);
+
+       *from = &lttng_param_call_site;
+       align = sizeof(const void *);
+
+       if(*len == 0) {
+               *to += ltt_align(*to, align); /* align output */
+       } else {
+               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+       }
+
+       *len += sizeof(const void *);
+
+       reserve_size = *to_base + *to + *len;
+       {
+               char stack_buffer[reserve_size];
+               buffer = stack_buffer;
+
+               *to_base = *to = *len = 0;
+
+               *from = &lttng_param_this_fn;
+               align = sizeof(const void *);
+
+               if(*len == 0) {
+                       *to += ltt_align(*to, align); /* align output */
+               } else {
+                       *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+               }
+
+               *len += sizeof(const void *);
+
+               /* Flush pending memcpy */
+               if(*len != 0) {
+                       memcpy(buffer+*to_base+*to, *from, *len);
+                       *to += *len;
+                       *len = 0;
+               }
+
+               *from = &lttng_param_call_site;
+               align = sizeof(const void *);
+
+               if(*len == 0) {
+                       *to += ltt_align(*to, align); /* align output */
+               } else {
+                       *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+               }
+
+               *len += sizeof(const void *);
+
+               /* Flush pending memcpy */
+               if(*len != 0) {
+                       memcpy(buffer+*to_base+*to, *from, *len);
+                       *to += *len;
+                       *len = 0;
+               }
+
+               ret = ltt_trace_generic(ltt_facility_user_generic_F583779E, event_user_generic_function_entry, buffer, reserve_size, LTT_BLOCKING);
+       }
+
+       return ret;
+
+}
+#endif //LTT_TRACE
+#endif //!LTT_TRACE_FAST
+
+#ifdef LTT_TRACE_FAST
+static inline __attribute__((no_instrument_function)) int trace_user_generic_function_entry(
+               const void * lttng_param_this_fn,
+               const void * lttng_param_call_site)
+#ifndef LTT_TRACE
+{
+}
+#else
+{
+       unsigned int index;
+       struct ltt_trace_info *trace = thread_trace_info;
+       struct ltt_buf *ltt_buf;
+       void *buffer = NULL;
+       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
+       size_t *to_base = &real_to_base;
+       size_t real_to = 0;
+       size_t *to = &real_to;
+       size_t real_len = 0;
+       size_t *len = &real_len;
+       size_t reserve_size;
+       size_t slot_size;
+       size_t align;
+       const void *real_from;
+       const void **from = &real_from;
+       uint64_t tsc;
+       size_t before_hdr_pad, after_hdr_pad, header_size;
+
+       if(!trace) {
+               ltt_thread_init();
+               trace = thread_trace_info;
+       }
+
+
+       /* For each field, calculate the field size. */
+       /* size = *to_base + *to + *len */
+       /* Assume that the padding for alignment starts at a
+        * sizeof(void *) address. */
+
+       *from = &lttng_param_this_fn;
+       align = sizeof(const void *);
+
+       if(*len == 0) {
+               *to += ltt_align(*to, align); /* align output */
+       } else {
+               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+       }
+
+       *len += sizeof(const void *);
+
+       *from = &lttng_param_call_site;
+       align = sizeof(const void *);
+
+       if(*len == 0) {
+               *to += ltt_align(*to, align); /* align output */
+       } else {
+               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+       }
+
+       *len += sizeof(const void *);
+
+       reserve_size = *to_base + *to + *len;
+       trace->nesting++;
+       index = ltt_get_index_from_facility(ltt_facility_user_generic_F583779E,
+                                               event_user_generic_function_entry);
+
+       {
+               ltt_buf = ltt_get_channel_from_index(trace, index);
+                               slot_size = 0;
+               buffer = ltt_reserve_slot(trace, ltt_buf,
+                       reserve_size, &slot_size, &tsc,
+                       &before_hdr_pad, &after_hdr_pad, &header_size);
+               if(!buffer) goto end; /* buffer full */
+
+               *to_base = *to = *len = 0;
+
+               ltt_write_event_header(trace, ltt_buf, buffer,
+                       ltt_facility_user_generic_F583779E, event_user_generic_function_entry,
+                       reserve_size, before_hdr_pad, tsc);
+               *to_base += before_hdr_pad + after_hdr_pad + header_size;
+
+               *from = &lttng_param_this_fn;
+               align = sizeof(const void *);
+
+               if(*len == 0) {
+                       *to += ltt_align(*to, align); /* align output */
+               } else {
+                       *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+               }
+
+               *len += sizeof(const void *);
+
+               /* Flush pending memcpy */
+               if(*len != 0) {
+                       memcpy(buffer+*to_base+*to, *from, *len);
+                       *to += *len;
+                       *len = 0;
+               }
+
+               *from = &lttng_param_call_site;
+               align = sizeof(const void *);
+
+               if(*len == 0) {
+                       *to += ltt_align(*to, align); /* align output */
+               } else {
+                       *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+               }
+
+               *len += sizeof(const void *);
+
+               /* Flush pending memcpy */
+               if(*len != 0) {
+                       memcpy(buffer+*to_base+*to, *from, *len);
+                       *to += *len;
+                       *len = 0;
+               }
+
+               ltt_commit_slot(ltt_buf, buffer, slot_size);
+
+}
+
+end:
+       trace->nesting--;
+}
+#endif //LTT_TRACE
+#endif //LTT_TRACE_FAST
+
+/* Event function_exit structures */
+
+/* Event function_exit logging function */
+#ifndef LTT_TRACE_FAST
+static inline __attribute__((no_instrument_function)) int trace_user_generic_function_exit(
+               const void * lttng_param_this_fn,
+               const void * lttng_param_call_site)
+#ifndef LTT_TRACE
+{
+}
+#else
+{
+       int ret = 0;
+       void *buffer = NULL;
+       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
+       size_t *to_base = &real_to_base;
+       size_t real_to = 0;
+       size_t *to = &real_to;
+       size_t real_len = 0;
+       size_t *len = &real_len;
+       size_t reserve_size;
+       size_t slot_size;
+       size_t align;
+       const void *real_from;
+       const void **from = &real_from;
+               /* For each field, calculate the field size. */
+       /* size = *to_base + *to + *len */
+       /* Assume that the padding for alignment starts at a
+        * sizeof(void *) address. */
+
+       *from = &lttng_param_this_fn;
+       align = sizeof(const void *);
+
+       if(*len == 0) {
+               *to += ltt_align(*to, align); /* align output */
+       } else {
+               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+       }
+
+       *len += sizeof(const void *);
+
+       *from = &lttng_param_call_site;
+       align = sizeof(const void *);
+
+       if(*len == 0) {
+               *to += ltt_align(*to, align); /* align output */
+       } else {
+               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+       }
+
+       *len += sizeof(const void *);
+
+       reserve_size = *to_base + *to + *len;
+       {
+               char stack_buffer[reserve_size];
+               buffer = stack_buffer;
+
+               *to_base = *to = *len = 0;
+
+               *from = &lttng_param_this_fn;
+               align = sizeof(const void *);
+
+               if(*len == 0) {
+                       *to += ltt_align(*to, align); /* align output */
+               } else {
+                       *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+               }
+
+               *len += sizeof(const void *);
+
+               /* Flush pending memcpy */
+               if(*len != 0) {
+                       memcpy(buffer+*to_base+*to, *from, *len);
+                       *to += *len;
+                       *len = 0;
+               }
+
+               *from = &lttng_param_call_site;
+               align = sizeof(const void *);
+
+               if(*len == 0) {
+                       *to += ltt_align(*to, align); /* align output */
+               } else {
+                       *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+               }
+
+               *len += sizeof(const void *);
+
+               /* Flush pending memcpy */
+               if(*len != 0) {
+                       memcpy(buffer+*to_base+*to, *from, *len);
+                       *to += *len;
+                       *len = 0;
+               }
+
+               ret = ltt_trace_generic(ltt_facility_user_generic_F583779E, event_user_generic_function_exit, buffer, reserve_size, LTT_BLOCKING);
+       }
+
+       return ret;
+
+}
+#endif //LTT_TRACE
+#endif //!LTT_TRACE_FAST
+
+#ifdef LTT_TRACE_FAST
+static inline __attribute__((no_instrument_function)) int trace_user_generic_function_exit(
+               const void * lttng_param_this_fn,
+               const void * lttng_param_call_site)
+#ifndef LTT_TRACE
+{
+}
+#else
+{
+       unsigned int index;
+       struct ltt_trace_info *trace = thread_trace_info;
+       struct ltt_buf *ltt_buf;
+       void *buffer = NULL;
+       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
+       size_t *to_base = &real_to_base;
+       size_t real_to = 0;
+       size_t *to = &real_to;
+       size_t real_len = 0;
+       size_t *len = &real_len;
+       size_t reserve_size;
+       size_t slot_size;
+       size_t align;
+       const void *real_from;
+       const void **from = &real_from;
+       uint64_t tsc;
+       size_t before_hdr_pad, after_hdr_pad, header_size;
+
+       if(!trace) {
+               ltt_thread_init();
+               trace = thread_trace_info;
+       }
+
+
+       /* For each field, calculate the field size. */
+       /* size = *to_base + *to + *len */
+       /* Assume that the padding for alignment starts at a
+        * sizeof(void *) address. */
+
+       *from = &lttng_param_this_fn;
+       align = sizeof(const void *);
+
+       if(*len == 0) {
+               *to += ltt_align(*to, align); /* align output */
+       } else {
+               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+       }
+
+       *len += sizeof(const void *);
+
+       *from = &lttng_param_call_site;
+       align = sizeof(const void *);
+
+       if(*len == 0) {
+               *to += ltt_align(*to, align); /* align output */
+       } else {
+               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+       }
+
+       *len += sizeof(const void *);
+
+       reserve_size = *to_base + *to + *len;
+       trace->nesting++;
+       index = ltt_get_index_from_facility(ltt_facility_user_generic_F583779E,
+                                               event_user_generic_function_exit);
+
+       {
+               ltt_buf = ltt_get_channel_from_index(trace, index);
+                               slot_size = 0;
+               buffer = ltt_reserve_slot(trace, ltt_buf,
+                       reserve_size, &slot_size, &tsc,
+                       &before_hdr_pad, &after_hdr_pad, &header_size);
+               if(!buffer) goto end; /* buffer full */
+
+               *to_base = *to = *len = 0;
+
+               ltt_write_event_header(trace, ltt_buf, buffer,
+                       ltt_facility_user_generic_F583779E, event_user_generic_function_exit,
+                       reserve_size, before_hdr_pad, tsc);
+               *to_base += before_hdr_pad + after_hdr_pad + header_size;
+
+               *from = &lttng_param_this_fn;
+               align = sizeof(const void *);
+
+               if(*len == 0) {
+                       *to += ltt_align(*to, align); /* align output */
+               } else {
+                       *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+               }
+
+               *len += sizeof(const void *);
+
+               /* Flush pending memcpy */
+               if(*len != 0) {
+                       memcpy(buffer+*to_base+*to, *from, *len);
+                       *to += *len;
+                       *len = 0;
+               }
+
+               *from = &lttng_param_call_site;
+               align = sizeof(const void *);
+
+               if(*len == 0) {
+                       *to += ltt_align(*to, align); /* align output */
+               } else {
+                       *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
+               }
+
+               *len += sizeof(const void *);
+
+               /* Flush pending memcpy */
+               if(*len != 0) {
+                       memcpy(buffer+*to_base+*to, *from, *len);
+                       *to += *len;
+                       *len = 0;
+               }
+
+               ltt_commit_slot(ltt_buf, buffer, slot_size);
+
+}
+
+end:
+       trace->nesting--;
+}
+#endif //LTT_TRACE
+#endif //LTT_TRACE_FAST
+
+#endif //_LTT_FACILITY_USER_GENERIC_H_
diff --git a/lttng-usertrace/ltt/ltt-generic.h b/lttng-usertrace/ltt/ltt-generic.h
new file mode 100644 (file)
index 0000000..9d52ad7
--- /dev/null
@@ -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 <errno.h>
+#include <syscall.h>
+#include <linux/unistd.h>
+#include <asm/atomic.h>
+#include <string.h>
+#include <sys/types.h>
+#include <stdint.h>
+
+#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/lttng-usertrace/sample-highspeed.c b/lttng-usertrace/sample-highspeed.c
new file mode 100644 (file)
index 0000000..bd9ea37
--- /dev/null
@@ -0,0 +1,20 @@
+
+#include <stdio.h>
+#include <unistd.h>
+
+#define LTT_TRACE
+#define LTT_BLOCKING 1
+#include <ltt/ltt-facility-user_generic.h>
+
+
+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/lttng-usertrace/sample-instrument-fct.c b/lttng-usertrace/sample-instrument-fct.c
new file mode 100644 (file)
index 0000000..37140da
--- /dev/null
@@ -0,0 +1,26 @@
+
+
+#include <stdio.h>
+#include <unistd.h>
+
+#define LTT_TRACE
+#define LTT_BLOCKING 1
+#include <ltt/ltt-facility-user_generic.h>
+
+
+void test_function(void)
+{
+       printf("we are in a test function\n");
+}
+
+
+int main(int argc, char **argv)
+{
+       while(1) {
+               test_function();
+               sleep(1);
+       }
+       
+       return 0;
+}
+
diff --git a/lttng-usertrace/sample-printf.c b/lttng-usertrace/sample-printf.c
new file mode 100644 (file)
index 0000000..85fd650
--- /dev/null
@@ -0,0 +1,25 @@
+
+#include <stdio.h>
+#include <unistd.h>
+
+#define LTT_TRACE
+#define LTT_BLOCKING 1
+#include <ltt/ltt-facility-user_generic.h>
+#include <ltt/ltt-facility-custom-user_generic.h>
+
+
+int main(int argc, char **argv)
+{
+       printf("Will trace a printf of an incrementing counter.\n");
+       unsigned int count = 0;
+
+       while(1) {
+               trace_user_generic_slow_printf("in: %s at: %s:%d: Counter value is: %u.",
+                                                                                                                                       __FILE__, __func__, __LINE__, count);
+               count++;
+               sleep(1);
+       }
+       
+       return 0;
+}
+
diff --git a/lttng-usertrace/sample-thread.c b/lttng-usertrace/sample-thread.c
new file mode 100644 (file)
index 0000000..270f2c9
--- /dev/null
@@ -0,0 +1,58 @@
+
+#include <pthread.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+#define LTT_TRACE
+#include <ltt/ltt-facility-user_generic.h>
+
+
+void *thr1(void *arg)
+{
+  printf("thread 1, thread id : %lu, pid %lu\n", pthread_self(), getpid());
+
+  while(1) {
+               trace_user_generic_string("Hello world! Have a nice day.");
+               sleep(2);
+       }
+
+  return ((void*)1);
+
+}
+
+void *thr2(void *arg)
+{
+  printf("thread 2, thread id : %lu, pid %lu\n", pthread_self(), getpid());
+       sleep(1);
+  while(1) {
+               trace_user_generic_string("Hello world! Have a nice day.");
+    sleep(2);
+  }
+  return ((void*)2);
+}
+
+
+int main()
+{
+       int err;
+       pthread_t tid1, tid2;
+       void *tret;
+
+       printf("Will trace the following string : Hello world! Have a nice day.\n");
+       printf("Press CTRL-C to stop.\n");
+  printf("thread main, thread id : %lu, pid %lu\n", pthread_self(), getpid());
+  err = pthread_create(&tid1, NULL, thr1, NULL);
+  if(err!=0) exit(1);
+
+  err = pthread_create(&tid2, NULL, thr2, NULL);
+  if(err!=0) exit(1);
+
+  err = pthread_join(tid1, &tret);
+  if(err!= 0) exit(1);
+
+  err = pthread_join(tid2, &tret);
+  if(err!= 0) exit(1);
+  
+  return 0;
+}
diff --git a/lttng-usertrace/sample.c b/lttng-usertrace/sample.c
new file mode 100644 (file)
index 0000000..efe4110
--- /dev/null
@@ -0,0 +1,21 @@
+
+#include <stdio.h>
+#include <unistd.h>
+
+#define LTT_TRACE
+#define LTT_BLOCKING 1
+#include <ltt/ltt-facility-user_generic.h>
+
+
+int main(int argc, char **argv)
+{
+       printf("Will trace the following string : Hello world! Have a nice day.\n");
+
+       while(1) {
+               trace_user_generic_string("Hello world! Have a nice day.");
+               sleep(1);
+       }
+       
+       return 0;
+}
+
diff --git a/lttng-usertrace/user_generic.xml b/lttng-usertrace/user_generic.xml
new file mode 100644 (file)
index 0000000..6e555bb
--- /dev/null
@@ -0,0 +1,32 @@
+<facility name=user_generic>
+  <description>Generic user space facility</description>
+       
+  <event name=string>
+       <description>Takes a string from user space</description>
+               <field name="data"><string/></field>
+  </event>
+
+  <event name=string_pointer>
+       <description>Takes a string and pointer from user space</description>
+               <field name="string"><string/></field>
+               <field name="pointer"><pointer/></field>
+  </event>
+       
+       <event name=slow_printf param_buffer>
+       <description>Takes a buffer of variable size (written by printf) and log it.</description>
+               <field name="string"><string/></field>
+  </event>
+       
+       <event name=function_entry no_instrument_function>
+               <description>Entry in a function</description>
+               <field name="this_fn"><pointer/></field>
+               <field name="call_site"><pointer/></field>
+       </event>
+
+       <event name=function_exit no_instrument_function>
+               <description>Exit from a function</description>
+               <field name="this_fn"><pointer/></field>
+               <field name="call_site"><pointer/></field>
+       </event>
+
+</facility>
diff --git a/usertrace-generic/Makefile b/usertrace-generic/Makefile
deleted file mode 100644 (file)
index 292a5bc..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-
-CC=gcc
-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
-
-sample-thread: sample-thread.c ltt-facility-loader-user_generic.c
-       $(CC) $(CFLAGS) -lpthread -o $@ $^
-
-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 $@ $^
-
-sample-printf: sample-printf.c ltt-facility-loader-user_generic.c
-       $(CC) $(CFLAGS) -o $@ $^
-
-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
-       @rm -f libltt-instrument-functions.a
-       $(AR) rc $@ $^
-       $(RANLIB) $@
-
-libltt-instrument-functions.so.0: ltt-instrument-functions.o ltt-facility-loader-user_generic.o
-       @rm -f libltt-instrument-functions.so libltt-instrument-functions.so.0
-       $(CC) $(CFLAGS) -shared -Wl,-soname,libltt-instrument-functions.so -o $@ $^
-       ln -s libltt-instrument-functions.so.0 libltt-instrument-functions.so
-
-.PHONY : clean install
-
-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)
-
-clean:
-       rm -fr *.o *~ sample-thread sample sample-highspeed sample-printf sample-instrument-fct libltt-instrument-functions.so* libltt-instrument-functions.a
-
diff --git a/usertrace-generic/README b/usertrace-generic/README
deleted file mode 100644 (file)
index b9ac1fb..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-
-LTTng usertrace generic package
-
-Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
-March 2006
-
-This package contains all the user space headers and c files necessary to make
-your application and library trace through an active LTTng tracer. Here is a
-short quickstart guide of it.
-
-Here are the currently supported architectures :
-x86
-(please add the ltt_* system calls to other architectures as you need them : it
-will work magically)
-
-* Compile your kernel with the latest LTTng patch. Make sure the option 
-  "Allow tracing from userspace" is _active_!
-  See the QUICKSTART guide at http://ltt.polymtl.ca/ for details about how to
-  setup a working tracer and viewer. See the genevent installation step : it is
-  required for method #2 below.
-  
-* Extract the latest usertrace-generic archive :
-su
-cd /usr/src
-wget http://ltt.polymtl.ca/packages/usertrace-generic-x.x.tar.gz
-gzip -cd usertrace-generic-x.x.tar.gz | tar xvof -
-
-* Build the sample programs and install the headers into your system :
-su
-cd /usr/src/usertrace-generic
-make
-make install
-
-* There are two ways to trace information from your application :
-
-1) Easy way, but slow (printf style)
-  See sample-printf.c for code example.
-
-- Add the following statements to your program source (the define must come
-  _before_ the includes!) :
-
-#define LTT_TRACE
-#define LTT_BLOCKING 1
-#include <ltt/ltt-facility-user_generic.h>
-#include <ltt/ltt-facility-custom-user_generic.h>
-
-Note the define of LTT_BLOCKING to 1 : if a trace buffer is full, your
-application will block. The default of this parameter is 0 (non blocking) :
-events are lost when trace buffer is full. The choice is up to you.
-
-- Add something like the following sample line in your code. Note that this is a
-  very standard format string, this is only a suggested presentation.
-  
-trace_user_generic_slow_printf("in: %s at: %s:%d: Counter value is: %u.",
-                               __FILE__, __func__, __LINE__, count);
-
-- Compile your application with at least these parameters to gcc (it is splitted
-  on two lines, joined by a "\") :
-gcc -D LTT_SHOW_DEBUG -I /usr/src/usertrace-generic -o myapp myapp.c \
-  /usr/src/usertrace-generic/ltt-facility-loader-user_generic.c
-
-To see what the final result looks like :
-- Start tracing
-- Start your application
-  ** You should see the following message when your program starts and the
-  LTT_SHOW_DEBUG is defined : 
-    "LTT : ltt-facility-user_generic init in userspace"
-    If you don't then you forgot to compile the facility loader in your
-    application. If you find this output annoying, you can remove the
-    "-D LTT_SHOW_DEBUG" gcc parameter, which will make the facility loader
-    silent.
-- Stop tracing
-Then, to see only the user_generic events :
-lttv -m textDump -t /tmp/trace1 -e "event.facility=user_generic"
-
-It will show :
-user_generic.slow_printf: 35885.922829472 (/cpu_0), 15521, 7453,  SYSCALL { "in: sample-printf.c at: main:18: Counter value is: 0." }
-user_generic.slow_printf: 35886.925685289 (/cpu_0), 15521, 7453,  SYSCALL { "in: sample-printf.c at: main:18: Counter value is: 1." }
-...
-
-
-
-2) The second way to log events is still easy, yet faster. It requires creating
-   your own XML description of your data structures. It will make it easier to
-   identify your data in the trace. Please read the comments in method 1)
-   explained previously, as they are not repeated here.
-   See sample.c for code example.
-
-- Go to the usertrace-generic directory
-su
-cd /usr/src/usertrace-generic
-
-- Create your own facility (i.e. user_myfacility.xml).
-  See the ones available in /usr/share/LinuxTraceToolkitViewer/facilities for
-  examples.
-  You facility _must_ be named following this standard : "user_*", where * is
-  whatever you like. If it is not, it will be rejected by the kernel with a
-  Operation not permitted (can be seen with the -D LTT_SHOW_DEBUG compilation
-  parameter).
-
-user_myfacility.xml:
-
-<facility name="user_myfacility">
-  <description>Sample facility</description>
-  <event name="myevent">
-    <description>Sample event</description>
-    <field name="file"><string></field>
-    <field name="function"><string></field>
-    <field name="line"><int></field>
-    <field name="firstval"><long></field>
-    <field name="secondval"><pointer></field>
-  </event>
-</facility>
-
-- AN IMPORTANT STEP FOLLOWS :
-  *copy* the user_myfacility.xml file in your system :
-su
-cp user_myfacility.xml /usr/share/LinuxTraceToolkitViewer/facilities
-
-- Use genevent to create the c code and headers :
-su
-cd /tmp
-mkdir genevent
-cd genevent
-for a in /usr/share/LinuxTraceToolkitViewer/facilities/user_*.xml;
-  do /usr/local/bin/genevent $a;
-done
-cd /usr/src/usertrace-generic
-cp /tmp/genevent/*load* .
-cd ltt
-cp /tmp/genevent/ltt-facility-id-user_myfacility.h .
-cp /tmp/genevent/ltt-facility-user_myfacility.h .
-cd ..
-make install
-
-- Add the following statements to your program source (the define must come
-  _before_ the includes!) :
-
-#define LTT_TRACE
-#define LTT_BLOCKING 1
-#include <ltt/ltt-facility-user_myfacility.h>
-
-- Add a call following the trace_user_myfacility_myevent function found in 
-  /usr/include/ltt/ltt-facility-user_myfacility.h in your program.
-For instance :
-trace_user_myfacility_myevent(__FILE__, __func__, __LINE__, 1234, (void*)0xF0F0F0F0);
-
-- Compile your application with at least these parameters to gcc (it is splitted
-  on two lines, joined by a "\") :
-gcc -I /usr/src/usertrace-generic -o myapp myapp.c \
-  /usr/src/usertrace-generic/ltt-facility-loader-user_myfacility.c
-
-To see what the final result looks like :
-- Start tracing
-- Start your application
-- Stop tracing
-Then, to see only the user_myfacility events :
-lttv -m textDump -t /tmp/trace1 -e "event.facility=user_myfacility"
-
-It will show, for example :
-user_myfacility.myevent: 39507.805584526 (/cpu_1), 15829, 15736,  SYSCALL { "myapp.c", "main", 8, 1234, 0xf0f0f0f0 }
-
-
-* Fun feature : function instrumentation
-
-Here is how to generate a full trace of you program function calls.
-See the sample-instrument-fct.c example program.
-
-- Compile your application with at least these parameters to gcc (it is splitted
-  on two lines, joined by a "\") :
-gcc -g -finstrument-functions \
-  -lltt-instrument-functions -o myapp myapp.c
-
-To see what the final result looks like :
-- Start tracing
-- Start your application
-- Stop tracing
-Then, to see only the function_entry and function_exit events :
-lttv -m textDump -t /tmp/trace1 -e "event.facility=user_generic & (event.name=function_entry & event.name=function_exit)"
-
-It will show, for example :
-user_generic.function_entry: 59329.709939111 (/cpu_0), 19250, 18581,  SYSCALL { 0x8048454, 0x80484c2 }
-user_generic.function_exit: 59329.709944613 (/cpu_0), 19250, 18581,  SYSCALL { 0x8048454, 0x80484c2 }
-
-you can then use (from the binutils package)
-addr2line -e sample-instrument-fct -i -f 0x8048454
-Which shows :
-test_function
-/usr/src/usertrace-generic/sample-instrument-fct.c:12
-
-The lookup in LTTV through libbfd has not been implemented yet.
-
-
diff --git a/usertrace-generic/ltt-facility-loader-user_generic.c b/usertrace-generic/ltt-facility-loader-user_generic.c
deleted file mode 100644 (file)
index 8cdb076..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * ltt-facility-loader-user_generic.c
- *
- * (C) Copyright  2005 - 
- *          Mathieu Desnoyers (mathieu.desnoyers@polymtl.ca)
- *
- * Contains the LTT user space facility loader.
- *
- */
-
-
-#define LTT_TRACE
-#include <error.h>
-#include <stdio.h>
-#include <ltt/ltt-generic.h>
-#include "ltt-facility-loader-user_generic.h"
-
-static struct user_facility_info facility = {
-       .name = LTT_FACILITY_NAME,
-       .num_events = LTT_FACILITY_NUM_EVENTS,
-#ifndef LTT_PACK
-       .alignment = sizeof(void*),
-#else
-       .alignment = 0,
-#endif //LTT_PACK
-       .checksum = LTT_FACILITY_CHECKSUM,
-       .int_size = sizeof(int),
-       .long_size = sizeof(long),
-       .pointer_size = sizeof(void*),
-       .size_t_size = sizeof(size_t)
-};
-
-static void __attribute__((constructor)) __ltt_user_init(void)
-{
-       int err;
-#ifdef LTT_SHOW_DEBUG
-       printf("LTT : ltt-facility-user_generic init in userspace\n");
-#endif //LTT_SHOW_DEBUG
-
-       err = ltt_register_generic(&LTT_FACILITY_SYMBOL, &facility);
-       LTT_FACILITY_CHECKSUM_SYMBOL = LTT_FACILITY_SYMBOL;
-       
-       if(err) {
-#ifdef LTT_SHOW_DEBUG
-               perror("Error in ltt_register_generic");
-#endif //LTT_SHOW_DEBUG
-       }
-}
-
diff --git a/usertrace-generic/ltt-facility-loader-user_generic.h b/usertrace-generic/ltt-facility-loader-user_generic.h
deleted file mode 100644 (file)
index 1f93d1e..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef _LTT_FACILITY_LOADER_USER_GENERIC_H_
-#define _LTT_FACILITY_LOADER_USER_GENERIC_H_
-
-#include <ltt/ltt-generic.h>
-#include <ltt/ltt-facility-id-user_generic.h>
-
-ltt_facility_t ltt_facility_user_generic;
-ltt_facility_t ltt_facility_user_generic_F583779E;
-
-#define LTT_FACILITY_SYMBOL                                                    ltt_facility_user_generic
-#define LTT_FACILITY_CHECKSUM_SYMBOL           ltt_facility_user_generic_F583779E
-#define LTT_FACILITY_CHECKSUM                                          0xF583779E
-#define LTT_FACILITY_NAME                                                              "user_generic"
-#define LTT_FACILITY_NUM_EVENTS                                        facility_user_generic_num_events
-
-#endif //_LTT_FACILITY_LOADER_USER_GENERIC_H_
diff --git a/usertrace-generic/ltt-instrument-functions.c b/usertrace-generic/ltt-instrument-functions.c
deleted file mode 100644 (file)
index 5d1b276..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/****************************************************************************
- * ltt-instrument-functions.c
- *
- * Mathieu Desnoyers
- * March 2006
- */
-
-#define LTT_TRACE
-#define LTT_BLOCKING 1
-#include <ltt/ltt-facility-user_generic.h>
-
-
-void __attribute__((no_instrument_function)) __cyg_profile_func_enter (
-               void *this_fn,
-               void *call_site)
-{
-       /* don't care about the return value */
-       trace_user_generic_function_entry(this_fn, call_site);
-}
-
-void __attribute__((no_instrument_function)) __cyg_profile_func_exit (
-               void *this_fn,
-               void *call_site)
-{
-       /* don't care about the return value */
-       trace_user_generic_function_exit(this_fn, call_site);
-}
-
diff --git a/usertrace-generic/ltt/ltt-facility-custom-user_generic.h b/usertrace-generic/ltt/ltt-facility-custom-user_generic.h
deleted file mode 100644 (file)
index f3a77f7..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef _LTT_FACILITY_CUSTOM_USER_GENERIC_H_
-#define _LTT_FACILITY_CUSTOM_USER_GENERIC_H_
-
-#include <sys/types.h>
-#include <ltt/ltt-facility-id-user_generic.h>
-#include <ltt/ltt-generic.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-
-static inline int trace_user_generic_slow_printf(
-               const char *fmt, ...)
-#ifndef LTT_TRACE
-{
-}
-#else
-{
-       /* Guess we need no more than 100 bytes. */
-       int n, size = 100;
-       char *p, *np;
-       va_list ap;
-       int ret;
-
-       if ((p = malloc (size)) == NULL)
-               return -1;
-
-       while (1) {
-               /* Try to print in the allocated space. */
-               va_start(ap, fmt);
-               n = vsnprintf (p, size, fmt, ap);
-               va_end(ap);
-               /* If that worked, trace the string. */
-               if (n > -1 && n < size) {
-                       ret = trace_user_generic_slow_printf_param_buffer(p, n+1);
-                       free(p);
-                       return ret;
-               }
-               /* Else try again with more space. */
-               if (n > -1)    /* glibc 2.1 */
-                        size = n+1; /* precisely what is needed */
-               else           /* glibc 2.0 */
-                        size *= 2;  /* twice the old size */
-               if ((np = realloc (p, size)) == NULL) {
-                        free(p);
-                        return -1;
-               } else {
-                        p = np;
-               }
-       }
-}
-#endif //LTT_TRACE
-
-#endif //_LTT_FACILITY_CUSTOM_USER_GENERIC_H_
diff --git a/usertrace-generic/ltt/ltt-facility-id-user_generic.h b/usertrace-generic/ltt/ltt-facility-id-user_generic.h
deleted file mode 100644 (file)
index 87205eb..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef _LTT_FACILITY_ID_USER_GENERIC_H_
-#define _LTT_FACILITY_ID_USER_GENERIC_H_
-
-#ifdef LTT_TRACE
-#include <ltt/ltt-generic.h>
-
-/****  facility handle  ****/
-
-extern ltt_facility_t ltt_facility_user_generic_F583779E;
-extern ltt_facility_t ltt_facility_user_generic;
-
-
-/****  event index  ****/
-
-enum user_generic_event {
-       event_user_generic_string,
-       event_user_generic_string_pointer,
-       event_user_generic_slow_printf,
-       event_user_generic_function_entry,
-       event_user_generic_function_exit,
-       facility_user_generic_num_events
-};
-
-#endif //LTT_TRACE
-#endif //_LTT_FACILITY_ID_USER_GENERIC_H_
diff --git a/usertrace-generic/ltt/ltt-facility-user_generic.h b/usertrace-generic/ltt/ltt-facility-user_generic.h
deleted file mode 100644 (file)
index 94a636d..0000000
+++ /dev/null
@@ -1,1036 +0,0 @@
-#ifndef _LTT_FACILITY_USER_GENERIC_H_
-#define _LTT_FACILITY_USER_GENERIC_H_
-
-#include <sys/types.h>
-#include <ltt/ltt-facility-id-user_generic.h>
-#include <ltt/ltt-generic.h>
-
-/* Named types */
-
-/* Event string structures */
-static inline void lttng_write_string_user_generic_string_data(
-               void *buffer,
-               size_t *to_base,
-               size_t *to,
-               const void **from,
-               size_t *len,
-               const char * obj)
-{
-       size_t size;
-       size_t align;
-
-       /* Flush pending memcpy */
-       if(*len != 0) {
-               if(buffer != NULL)
-                       memcpy(buffer+*to_base+*to, *from, *len);
-       }
-       *to += *len;
-       *len = 0;
-
-       align = sizeof(char);
-
-       if(*len == 0) {
-               *to += ltt_align(*to, align); /* align output */
-       } else {
-               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-       }
-
-       /* Contains variable sized fields : must explode the structure */
-
-       size = strlen(obj) + 1; /* Include final NULL char. */
-       if(buffer != NULL)
-               memcpy(buffer+*to_base+*to, obj, size);
-       *to += size;
-
-       /* Realign the *to_base on arch size, set *to to 0 */
-       *to += ltt_align(*to, sizeof(void *));
-       *to_base = *to_base+*to;
-       *to = 0;
-
-       /* Put source *from just after the C string */
-       *from += size;
-}
-
-
-/* Event string logging function */
-#ifndef LTT_TRACE_FAST
-static inline int trace_user_generic_string(
-               const char * lttng_param_data)
-#ifndef LTT_TRACE
-{
-}
-#else
-{
-       int ret = 0;
-       void *buffer = NULL;
-       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
-       size_t *to_base = &real_to_base;
-       size_t real_to = 0;
-       size_t *to = &real_to;
-       size_t real_len = 0;
-       size_t *len = &real_len;
-       size_t reserve_size;
-       size_t slot_size;
-       const void *real_from;
-       const void **from = &real_from;
-               /* For each field, calculate the field size. */
-       /* size = *to_base + *to + *len */
-       /* Assume that the padding for alignment starts at a
-        * sizeof(void *) address. */
-
-       *from = lttng_param_data;
-       lttng_write_string_user_generic_string_data(buffer, to_base, to, from, len, lttng_param_data);
-
-       reserve_size = *to_base + *to + *len;
-       {
-               char stack_buffer[reserve_size];
-               buffer = stack_buffer;
-
-               *to_base = *to = *len = 0;
-
-               *from = lttng_param_data;
-               lttng_write_string_user_generic_string_data(buffer, to_base, to, from, len, lttng_param_data);
-
-               /* Flush pending memcpy */
-               if(*len != 0) {
-                       memcpy(buffer+*to_base+*to, *from, *len);
-                       *to += *len;
-                       *len = 0;
-               }
-
-               ret = ltt_trace_generic(ltt_facility_user_generic_F583779E, event_user_generic_string, buffer, reserve_size, LTT_BLOCKING);
-       }
-
-       return ret;
-
-}
-#endif //LTT_TRACE
-#endif //!LTT_TRACE_FAST
-
-#ifdef LTT_TRACE_FAST
-static inline int trace_user_generic_string(
-               const char * lttng_param_data)
-#ifndef LTT_TRACE
-{
-}
-#else
-{
-       unsigned int index;
-       struct ltt_trace_info *trace = thread_trace_info;
-       struct ltt_buf *ltt_buf;
-       void *buffer = NULL;
-       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
-       size_t *to_base = &real_to_base;
-       size_t real_to = 0;
-       size_t *to = &real_to;
-       size_t real_len = 0;
-       size_t *len = &real_len;
-       size_t reserve_size;
-       size_t slot_size;
-       const void *real_from;
-       const void **from = &real_from;
-       uint64_t tsc;
-       size_t before_hdr_pad, after_hdr_pad, header_size;
-
-       if(!trace) {
-               ltt_thread_init();
-               trace = thread_trace_info;
-       }
-
-
-       /* For each field, calculate the field size. */
-       /* size = *to_base + *to + *len */
-       /* Assume that the padding for alignment starts at a
-        * sizeof(void *) address. */
-
-       *from = lttng_param_data;
-       lttng_write_string_user_generic_string_data(buffer, to_base, to, from, len, lttng_param_data);
-
-       reserve_size = *to_base + *to + *len;
-       trace->nesting++;
-       index = ltt_get_index_from_facility(ltt_facility_user_generic_F583779E,
-                                               event_user_generic_string);
-
-       {
-               ltt_buf = ltt_get_channel_from_index(trace, index);
-                               slot_size = 0;
-               buffer = ltt_reserve_slot(trace, ltt_buf,
-                       reserve_size, &slot_size, &tsc,
-                       &before_hdr_pad, &after_hdr_pad, &header_size);
-               if(!buffer) goto end; /* buffer full */
-
-               *to_base = *to = *len = 0;
-
-               ltt_write_event_header(trace, ltt_buf, buffer,
-                       ltt_facility_user_generic_F583779E, event_user_generic_string,
-                       reserve_size, before_hdr_pad, tsc);
-               *to_base += before_hdr_pad + after_hdr_pad + header_size;
-
-               *from = lttng_param_data;
-               lttng_write_string_user_generic_string_data(buffer, to_base, to, from, len, lttng_param_data);
-
-               /* Flush pending memcpy */
-               if(*len != 0) {
-                       memcpy(buffer+*to_base+*to, *from, *len);
-                       *to += *len;
-                       *len = 0;
-               }
-
-               ltt_commit_slot(ltt_buf, buffer, slot_size);
-
-}
-
-end:
-       trace->nesting--;
-}
-#endif //LTT_TRACE
-#endif //LTT_TRACE_FAST
-
-/* Event string_pointer structures */
-static inline void lttng_write_string_user_generic_string_pointer_string(
-               void *buffer,
-               size_t *to_base,
-               size_t *to,
-               const void **from,
-               size_t *len,
-               const char * obj)
-{
-       size_t size;
-       size_t align;
-
-       /* Flush pending memcpy */
-       if(*len != 0) {
-               if(buffer != NULL)
-                       memcpy(buffer+*to_base+*to, *from, *len);
-       }
-       *to += *len;
-       *len = 0;
-
-       align = sizeof(char);
-
-       if(*len == 0) {
-               *to += ltt_align(*to, align); /* align output */
-       } else {
-               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-       }
-
-       /* Contains variable sized fields : must explode the structure */
-
-       size = strlen(obj) + 1; /* Include final NULL char. */
-       if(buffer != NULL)
-               memcpy(buffer+*to_base+*to, obj, size);
-       *to += size;
-
-       /* Realign the *to_base on arch size, set *to to 0 */
-       *to += ltt_align(*to, sizeof(void *));
-       *to_base = *to_base+*to;
-       *to = 0;
-
-       /* Put source *from just after the C string */
-       *from += size;
-}
-
-
-/* Event string_pointer logging function */
-#ifndef LTT_TRACE_FAST
-static inline int trace_user_generic_string_pointer(
-               const char * lttng_param_string,
-               const void * lttng_param_pointer)
-#ifndef LTT_TRACE
-{
-}
-#else
-{
-       int ret = 0;
-       void *buffer = NULL;
-       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
-       size_t *to_base = &real_to_base;
-       size_t real_to = 0;
-       size_t *to = &real_to;
-       size_t real_len = 0;
-       size_t *len = &real_len;
-       size_t reserve_size;
-       size_t slot_size;
-       size_t align;
-       const void *real_from;
-       const void **from = &real_from;
-               /* For each field, calculate the field size. */
-       /* size = *to_base + *to + *len */
-       /* Assume that the padding for alignment starts at a
-        * sizeof(void *) address. */
-
-       *from = lttng_param_string;
-       lttng_write_string_user_generic_string_pointer_string(buffer, to_base, to, from, len, lttng_param_string);
-
-       *from = &lttng_param_pointer;
-       align = sizeof(const void *);
-
-       if(*len == 0) {
-               *to += ltt_align(*to, align); /* align output */
-       } else {
-               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-       }
-
-       *len += sizeof(const void *);
-
-       reserve_size = *to_base + *to + *len;
-       {
-               char stack_buffer[reserve_size];
-               buffer = stack_buffer;
-
-               *to_base = *to = *len = 0;
-
-               *from = lttng_param_string;
-               lttng_write_string_user_generic_string_pointer_string(buffer, to_base, to, from, len, lttng_param_string);
-
-               /* Flush pending memcpy */
-               if(*len != 0) {
-                       memcpy(buffer+*to_base+*to, *from, *len);
-                       *to += *len;
-                       *len = 0;
-               }
-
-               *from = &lttng_param_pointer;
-               align = sizeof(const void *);
-
-               if(*len == 0) {
-                       *to += ltt_align(*to, align); /* align output */
-               } else {
-                       *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-               }
-
-               *len += sizeof(const void *);
-
-               /* Flush pending memcpy */
-               if(*len != 0) {
-                       memcpy(buffer+*to_base+*to, *from, *len);
-                       *to += *len;
-                       *len = 0;
-               }
-
-               ret = ltt_trace_generic(ltt_facility_user_generic_F583779E, event_user_generic_string_pointer, buffer, reserve_size, LTT_BLOCKING);
-       }
-
-       return ret;
-
-}
-#endif //LTT_TRACE
-#endif //!LTT_TRACE_FAST
-
-#ifdef LTT_TRACE_FAST
-static inline int trace_user_generic_string_pointer(
-               const char * lttng_param_string,
-               const void * lttng_param_pointer)
-#ifndef LTT_TRACE
-{
-}
-#else
-{
-       unsigned int index;
-       struct ltt_trace_info *trace = thread_trace_info;
-       struct ltt_buf *ltt_buf;
-       void *buffer = NULL;
-       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
-       size_t *to_base = &real_to_base;
-       size_t real_to = 0;
-       size_t *to = &real_to;
-       size_t real_len = 0;
-       size_t *len = &real_len;
-       size_t reserve_size;
-       size_t slot_size;
-       size_t align;
-       const void *real_from;
-       const void **from = &real_from;
-       uint64_t tsc;
-       size_t before_hdr_pad, after_hdr_pad, header_size;
-
-       if(!trace) {
-               ltt_thread_init();
-               trace = thread_trace_info;
-       }
-
-
-       /* For each field, calculate the field size. */
-       /* size = *to_base + *to + *len */
-       /* Assume that the padding for alignment starts at a
-        * sizeof(void *) address. */
-
-       *from = lttng_param_string;
-       lttng_write_string_user_generic_string_pointer_string(buffer, to_base, to, from, len, lttng_param_string);
-
-       *from = &lttng_param_pointer;
-       align = sizeof(const void *);
-
-       if(*len == 0) {
-               *to += ltt_align(*to, align); /* align output */
-       } else {
-               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-       }
-
-       *len += sizeof(const void *);
-
-       reserve_size = *to_base + *to + *len;
-       trace->nesting++;
-       index = ltt_get_index_from_facility(ltt_facility_user_generic_F583779E,
-                                               event_user_generic_string_pointer);
-
-       {
-               ltt_buf = ltt_get_channel_from_index(trace, index);
-                               slot_size = 0;
-               buffer = ltt_reserve_slot(trace, ltt_buf,
-                       reserve_size, &slot_size, &tsc,
-                       &before_hdr_pad, &after_hdr_pad, &header_size);
-               if(!buffer) goto end; /* buffer full */
-
-               *to_base = *to = *len = 0;
-
-               ltt_write_event_header(trace, ltt_buf, buffer,
-                       ltt_facility_user_generic_F583779E, event_user_generic_string_pointer,
-                       reserve_size, before_hdr_pad, tsc);
-               *to_base += before_hdr_pad + after_hdr_pad + header_size;
-
-               *from = lttng_param_string;
-               lttng_write_string_user_generic_string_pointer_string(buffer, to_base, to, from, len, lttng_param_string);
-
-               /* Flush pending memcpy */
-               if(*len != 0) {
-                       memcpy(buffer+*to_base+*to, *from, *len);
-                       *to += *len;
-                       *len = 0;
-               }
-
-               *from = &lttng_param_pointer;
-               align = sizeof(const void *);
-
-               if(*len == 0) {
-                       *to += ltt_align(*to, align); /* align output */
-               } else {
-                       *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-               }
-
-               *len += sizeof(const void *);
-
-               /* Flush pending memcpy */
-               if(*len != 0) {
-                       memcpy(buffer+*to_base+*to, *from, *len);
-                       *to += *len;
-                       *len = 0;
-               }
-
-               ltt_commit_slot(ltt_buf, buffer, slot_size);
-
-}
-
-end:
-       trace->nesting--;
-}
-#endif //LTT_TRACE
-#endif //LTT_TRACE_FAST
-
-/* Event slow_printf structures */
-static inline void lttng_write_string_user_generic_slow_printf_string(
-               void *buffer,
-               size_t *to_base,
-               size_t *to,
-               const void **from,
-               size_t *len,
-               const char * obj)
-{
-       size_t size;
-       size_t align;
-
-       /* Flush pending memcpy */
-       if(*len != 0) {
-               if(buffer != NULL)
-                       memcpy(buffer+*to_base+*to, *from, *len);
-       }
-       *to += *len;
-       *len = 0;
-
-       align = sizeof(char);
-
-       if(*len == 0) {
-               *to += ltt_align(*to, align); /* align output */
-       } else {
-               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-       }
-
-       /* Contains variable sized fields : must explode the structure */
-
-       size = strlen(obj) + 1; /* Include final NULL char. */
-       if(buffer != NULL)
-               memcpy(buffer+*to_base+*to, obj, size);
-       *to += size;
-
-       /* Realign the *to_base on arch size, set *to to 0 */
-       *to += ltt_align(*to, sizeof(void *));
-       *to_base = *to_base+*to;
-       *to = 0;
-
-       /* Put source *from just after the C string */
-       *from += size;
-}
-
-
-/* Event slow_printf logging function */
-#ifndef LTT_TRACE_FAST
-static inline int trace_user_generic_slow_printf_param_buffer(
-               void *buffer,
-               size_t reserve_size)
-#ifndef LTT_TRACE
-{
-}
-#else
-{
-       int ret = 0;
-       reserve_size = ltt_align(reserve_size, sizeof(void *));
-       {
-               ret = ltt_trace_generic(ltt_facility_user_generic_F583779E, event_user_generic_slow_printf, buffer, reserve_size, LTT_BLOCKING);
-       }
-
-       return ret;
-
-}
-#endif //LTT_TRACE
-#endif //!LTT_TRACE_FAST
-
-#ifdef LTT_TRACE_FAST
-static inline int trace_user_generic_slow_printf(
-               const char * lttng_param_string)
-#ifndef LTT_TRACE
-{
-}
-#else
-{
-       unsigned int index;
-       struct ltt_trace_info *trace = thread_trace_info;
-       struct ltt_buf *ltt_buf;
-       void *buffer = NULL;
-       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
-       size_t *to_base = &real_to_base;
-       size_t real_to = 0;
-       size_t *to = &real_to;
-       size_t real_len = 0;
-       size_t *len = &real_len;
-       size_t reserve_size;
-       size_t slot_size;
-       const void *real_from;
-       const void **from = &real_from;
-       uint64_t tsc;
-       size_t before_hdr_pad, after_hdr_pad, header_size;
-
-       if(!trace) {
-               ltt_thread_init();
-               trace = thread_trace_info;
-       }
-
-
-       /* For each field, calculate the field size. */
-       /* size = *to_base + *to + *len */
-       /* Assume that the padding for alignment starts at a
-        * sizeof(void *) address. */
-
-       *from = lttng_param_string;
-       lttng_write_string_user_generic_slow_printf_string(buffer, to_base, to, from, len, lttng_param_string);
-
-       reserve_size = *to_base + *to + *len;
-       trace->nesting++;
-       index = ltt_get_index_from_facility(ltt_facility_user_generic_F583779E,
-                                               event_user_generic_slow_printf);
-
-       {
-               ltt_buf = ltt_get_channel_from_index(trace, index);
-                               slot_size = 0;
-               buffer = ltt_reserve_slot(trace, ltt_buf,
-                       reserve_size, &slot_size, &tsc,
-                       &before_hdr_pad, &after_hdr_pad, &header_size);
-               if(!buffer) goto end; /* buffer full */
-
-               *to_base = *to = *len = 0;
-
-               ltt_write_event_header(trace, ltt_buf, buffer,
-                       ltt_facility_user_generic_F583779E, event_user_generic_slow_printf,
-                       reserve_size, before_hdr_pad, tsc);
-               *to_base += before_hdr_pad + after_hdr_pad + header_size;
-
-               *from = lttng_param_string;
-               lttng_write_string_user_generic_slow_printf_string(buffer, to_base, to, from, len, lttng_param_string);
-
-               /* Flush pending memcpy */
-               if(*len != 0) {
-                       memcpy(buffer+*to_base+*to, *from, *len);
-                       *to += *len;
-                       *len = 0;
-               }
-
-               ltt_commit_slot(ltt_buf, buffer, slot_size);
-
-}
-
-end:
-       trace->nesting--;
-}
-#endif //LTT_TRACE
-#endif //LTT_TRACE_FAST
-
-/* Event function_entry structures */
-
-/* Event function_entry logging function */
-#ifndef LTT_TRACE_FAST
-static inline __attribute__((no_instrument_function)) int trace_user_generic_function_entry(
-               const void * lttng_param_this_fn,
-               const void * lttng_param_call_site)
-#ifndef LTT_TRACE
-{
-}
-#else
-{
-       int ret = 0;
-       void *buffer = NULL;
-       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
-       size_t *to_base = &real_to_base;
-       size_t real_to = 0;
-       size_t *to = &real_to;
-       size_t real_len = 0;
-       size_t *len = &real_len;
-       size_t reserve_size;
-       size_t slot_size;
-       size_t align;
-       const void *real_from;
-       const void **from = &real_from;
-               /* For each field, calculate the field size. */
-       /* size = *to_base + *to + *len */
-       /* Assume that the padding for alignment starts at a
-        * sizeof(void *) address. */
-
-       *from = &lttng_param_this_fn;
-       align = sizeof(const void *);
-
-       if(*len == 0) {
-               *to += ltt_align(*to, align); /* align output */
-       } else {
-               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-       }
-
-       *len += sizeof(const void *);
-
-       *from = &lttng_param_call_site;
-       align = sizeof(const void *);
-
-       if(*len == 0) {
-               *to += ltt_align(*to, align); /* align output */
-       } else {
-               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-       }
-
-       *len += sizeof(const void *);
-
-       reserve_size = *to_base + *to + *len;
-       {
-               char stack_buffer[reserve_size];
-               buffer = stack_buffer;
-
-               *to_base = *to = *len = 0;
-
-               *from = &lttng_param_this_fn;
-               align = sizeof(const void *);
-
-               if(*len == 0) {
-                       *to += ltt_align(*to, align); /* align output */
-               } else {
-                       *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-               }
-
-               *len += sizeof(const void *);
-
-               /* Flush pending memcpy */
-               if(*len != 0) {
-                       memcpy(buffer+*to_base+*to, *from, *len);
-                       *to += *len;
-                       *len = 0;
-               }
-
-               *from = &lttng_param_call_site;
-               align = sizeof(const void *);
-
-               if(*len == 0) {
-                       *to += ltt_align(*to, align); /* align output */
-               } else {
-                       *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-               }
-
-               *len += sizeof(const void *);
-
-               /* Flush pending memcpy */
-               if(*len != 0) {
-                       memcpy(buffer+*to_base+*to, *from, *len);
-                       *to += *len;
-                       *len = 0;
-               }
-
-               ret = ltt_trace_generic(ltt_facility_user_generic_F583779E, event_user_generic_function_entry, buffer, reserve_size, LTT_BLOCKING);
-       }
-
-       return ret;
-
-}
-#endif //LTT_TRACE
-#endif //!LTT_TRACE_FAST
-
-#ifdef LTT_TRACE_FAST
-static inline __attribute__((no_instrument_function)) int trace_user_generic_function_entry(
-               const void * lttng_param_this_fn,
-               const void * lttng_param_call_site)
-#ifndef LTT_TRACE
-{
-}
-#else
-{
-       unsigned int index;
-       struct ltt_trace_info *trace = thread_trace_info;
-       struct ltt_buf *ltt_buf;
-       void *buffer = NULL;
-       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
-       size_t *to_base = &real_to_base;
-       size_t real_to = 0;
-       size_t *to = &real_to;
-       size_t real_len = 0;
-       size_t *len = &real_len;
-       size_t reserve_size;
-       size_t slot_size;
-       size_t align;
-       const void *real_from;
-       const void **from = &real_from;
-       uint64_t tsc;
-       size_t before_hdr_pad, after_hdr_pad, header_size;
-
-       if(!trace) {
-               ltt_thread_init();
-               trace = thread_trace_info;
-       }
-
-
-       /* For each field, calculate the field size. */
-       /* size = *to_base + *to + *len */
-       /* Assume that the padding for alignment starts at a
-        * sizeof(void *) address. */
-
-       *from = &lttng_param_this_fn;
-       align = sizeof(const void *);
-
-       if(*len == 0) {
-               *to += ltt_align(*to, align); /* align output */
-       } else {
-               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-       }
-
-       *len += sizeof(const void *);
-
-       *from = &lttng_param_call_site;
-       align = sizeof(const void *);
-
-       if(*len == 0) {
-               *to += ltt_align(*to, align); /* align output */
-       } else {
-               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-       }
-
-       *len += sizeof(const void *);
-
-       reserve_size = *to_base + *to + *len;
-       trace->nesting++;
-       index = ltt_get_index_from_facility(ltt_facility_user_generic_F583779E,
-                                               event_user_generic_function_entry);
-
-       {
-               ltt_buf = ltt_get_channel_from_index(trace, index);
-                               slot_size = 0;
-               buffer = ltt_reserve_slot(trace, ltt_buf,
-                       reserve_size, &slot_size, &tsc,
-                       &before_hdr_pad, &after_hdr_pad, &header_size);
-               if(!buffer) goto end; /* buffer full */
-
-               *to_base = *to = *len = 0;
-
-               ltt_write_event_header(trace, ltt_buf, buffer,
-                       ltt_facility_user_generic_F583779E, event_user_generic_function_entry,
-                       reserve_size, before_hdr_pad, tsc);
-               *to_base += before_hdr_pad + after_hdr_pad + header_size;
-
-               *from = &lttng_param_this_fn;
-               align = sizeof(const void *);
-
-               if(*len == 0) {
-                       *to += ltt_align(*to, align); /* align output */
-               } else {
-                       *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-               }
-
-               *len += sizeof(const void *);
-
-               /* Flush pending memcpy */
-               if(*len != 0) {
-                       memcpy(buffer+*to_base+*to, *from, *len);
-                       *to += *len;
-                       *len = 0;
-               }
-
-               *from = &lttng_param_call_site;
-               align = sizeof(const void *);
-
-               if(*len == 0) {
-                       *to += ltt_align(*to, align); /* align output */
-               } else {
-                       *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-               }
-
-               *len += sizeof(const void *);
-
-               /* Flush pending memcpy */
-               if(*len != 0) {
-                       memcpy(buffer+*to_base+*to, *from, *len);
-                       *to += *len;
-                       *len = 0;
-               }
-
-               ltt_commit_slot(ltt_buf, buffer, slot_size);
-
-}
-
-end:
-       trace->nesting--;
-}
-#endif //LTT_TRACE
-#endif //LTT_TRACE_FAST
-
-/* Event function_exit structures */
-
-/* Event function_exit logging function */
-#ifndef LTT_TRACE_FAST
-static inline __attribute__((no_instrument_function)) int trace_user_generic_function_exit(
-               const void * lttng_param_this_fn,
-               const void * lttng_param_call_site)
-#ifndef LTT_TRACE
-{
-}
-#else
-{
-       int ret = 0;
-       void *buffer = NULL;
-       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
-       size_t *to_base = &real_to_base;
-       size_t real_to = 0;
-       size_t *to = &real_to;
-       size_t real_len = 0;
-       size_t *len = &real_len;
-       size_t reserve_size;
-       size_t slot_size;
-       size_t align;
-       const void *real_from;
-       const void **from = &real_from;
-               /* For each field, calculate the field size. */
-       /* size = *to_base + *to + *len */
-       /* Assume that the padding for alignment starts at a
-        * sizeof(void *) address. */
-
-       *from = &lttng_param_this_fn;
-       align = sizeof(const void *);
-
-       if(*len == 0) {
-               *to += ltt_align(*to, align); /* align output */
-       } else {
-               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-       }
-
-       *len += sizeof(const void *);
-
-       *from = &lttng_param_call_site;
-       align = sizeof(const void *);
-
-       if(*len == 0) {
-               *to += ltt_align(*to, align); /* align output */
-       } else {
-               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-       }
-
-       *len += sizeof(const void *);
-
-       reserve_size = *to_base + *to + *len;
-       {
-               char stack_buffer[reserve_size];
-               buffer = stack_buffer;
-
-               *to_base = *to = *len = 0;
-
-               *from = &lttng_param_this_fn;
-               align = sizeof(const void *);
-
-               if(*len == 0) {
-                       *to += ltt_align(*to, align); /* align output */
-               } else {
-                       *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-               }
-
-               *len += sizeof(const void *);
-
-               /* Flush pending memcpy */
-               if(*len != 0) {
-                       memcpy(buffer+*to_base+*to, *from, *len);
-                       *to += *len;
-                       *len = 0;
-               }
-
-               *from = &lttng_param_call_site;
-               align = sizeof(const void *);
-
-               if(*len == 0) {
-                       *to += ltt_align(*to, align); /* align output */
-               } else {
-                       *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-               }
-
-               *len += sizeof(const void *);
-
-               /* Flush pending memcpy */
-               if(*len != 0) {
-                       memcpy(buffer+*to_base+*to, *from, *len);
-                       *to += *len;
-                       *len = 0;
-               }
-
-               ret = ltt_trace_generic(ltt_facility_user_generic_F583779E, event_user_generic_function_exit, buffer, reserve_size, LTT_BLOCKING);
-       }
-
-       return ret;
-
-}
-#endif //LTT_TRACE
-#endif //!LTT_TRACE_FAST
-
-#ifdef LTT_TRACE_FAST
-static inline __attribute__((no_instrument_function)) int trace_user_generic_function_exit(
-               const void * lttng_param_this_fn,
-               const void * lttng_param_call_site)
-#ifndef LTT_TRACE
-{
-}
-#else
-{
-       unsigned int index;
-       struct ltt_trace_info *trace = thread_trace_info;
-       struct ltt_buf *ltt_buf;
-       void *buffer = NULL;
-       size_t real_to_base = 0; /* The buffer is allocated on arch_size alignment */
-       size_t *to_base = &real_to_base;
-       size_t real_to = 0;
-       size_t *to = &real_to;
-       size_t real_len = 0;
-       size_t *len = &real_len;
-       size_t reserve_size;
-       size_t slot_size;
-       size_t align;
-       const void *real_from;
-       const void **from = &real_from;
-       uint64_t tsc;
-       size_t before_hdr_pad, after_hdr_pad, header_size;
-
-       if(!trace) {
-               ltt_thread_init();
-               trace = thread_trace_info;
-       }
-
-
-       /* For each field, calculate the field size. */
-       /* size = *to_base + *to + *len */
-       /* Assume that the padding for alignment starts at a
-        * sizeof(void *) address. */
-
-       *from = &lttng_param_this_fn;
-       align = sizeof(const void *);
-
-       if(*len == 0) {
-               *to += ltt_align(*to, align); /* align output */
-       } else {
-               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-       }
-
-       *len += sizeof(const void *);
-
-       *from = &lttng_param_call_site;
-       align = sizeof(const void *);
-
-       if(*len == 0) {
-               *to += ltt_align(*to, align); /* align output */
-       } else {
-               *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-       }
-
-       *len += sizeof(const void *);
-
-       reserve_size = *to_base + *to + *len;
-       trace->nesting++;
-       index = ltt_get_index_from_facility(ltt_facility_user_generic_F583779E,
-                                               event_user_generic_function_exit);
-
-       {
-               ltt_buf = ltt_get_channel_from_index(trace, index);
-                               slot_size = 0;
-               buffer = ltt_reserve_slot(trace, ltt_buf,
-                       reserve_size, &slot_size, &tsc,
-                       &before_hdr_pad, &after_hdr_pad, &header_size);
-               if(!buffer) goto end; /* buffer full */
-
-               *to_base = *to = *len = 0;
-
-               ltt_write_event_header(trace, ltt_buf, buffer,
-                       ltt_facility_user_generic_F583779E, event_user_generic_function_exit,
-                       reserve_size, before_hdr_pad, tsc);
-               *to_base += before_hdr_pad + after_hdr_pad + header_size;
-
-               *from = &lttng_param_this_fn;
-               align = sizeof(const void *);
-
-               if(*len == 0) {
-                       *to += ltt_align(*to, align); /* align output */
-               } else {
-                       *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-               }
-
-               *len += sizeof(const void *);
-
-               /* Flush pending memcpy */
-               if(*len != 0) {
-                       memcpy(buffer+*to_base+*to, *from, *len);
-                       *to += *len;
-                       *len = 0;
-               }
-
-               *from = &lttng_param_call_site;
-               align = sizeof(const void *);
-
-               if(*len == 0) {
-                       *to += ltt_align(*to, align); /* align output */
-               } else {
-                       *len += ltt_align(*to+*len, align); /* alignment, ok to do a memcpy of it */
-               }
-
-               *len += sizeof(const void *);
-
-               /* Flush pending memcpy */
-               if(*len != 0) {
-                       memcpy(buffer+*to_base+*to, *from, *len);
-                       *to += *len;
-                       *len = 0;
-               }
-
-               ltt_commit_slot(ltt_buf, buffer, slot_size);
-
-}
-
-end:
-       trace->nesting--;
-}
-#endif //LTT_TRACE
-#endif //LTT_TRACE_FAST
-
-#endif //_LTT_FACILITY_USER_GENERIC_H_
diff --git a/usertrace-generic/ltt/ltt-generic.h b/usertrace-generic/ltt/ltt-generic.h
deleted file mode 100644 (file)
index 9d52ad7..0000000
+++ /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 <errno.h>
-#include <syscall.h>
-#include <linux/unistd.h>
-#include <asm/atomic.h>
-#include <string.h>
-#include <sys/types.h>
-#include <stdint.h>
-
-#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/usertrace-generic/sample-highspeed.c b/usertrace-generic/sample-highspeed.c
deleted file mode 100644 (file)
index bd9ea37..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-
-#include <stdio.h>
-#include <unistd.h>
-
-#define LTT_TRACE
-#define LTT_BLOCKING 1
-#include <ltt/ltt-facility-user_generic.h>
-
-
-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-instrument-fct.c b/usertrace-generic/sample-instrument-fct.c
deleted file mode 100644 (file)
index 37140da..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-#include <stdio.h>
-#include <unistd.h>
-
-#define LTT_TRACE
-#define LTT_BLOCKING 1
-#include <ltt/ltt-facility-user_generic.h>
-
-
-void test_function(void)
-{
-       printf("we are in a test function\n");
-}
-
-
-int main(int argc, char **argv)
-{
-       while(1) {
-               test_function();
-               sleep(1);
-       }
-       
-       return 0;
-}
-
diff --git a/usertrace-generic/sample-printf.c b/usertrace-generic/sample-printf.c
deleted file mode 100644 (file)
index 85fd650..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-
-#include <stdio.h>
-#include <unistd.h>
-
-#define LTT_TRACE
-#define LTT_BLOCKING 1
-#include <ltt/ltt-facility-user_generic.h>
-#include <ltt/ltt-facility-custom-user_generic.h>
-
-
-int main(int argc, char **argv)
-{
-       printf("Will trace a printf of an incrementing counter.\n");
-       unsigned int count = 0;
-
-       while(1) {
-               trace_user_generic_slow_printf("in: %s at: %s:%d: Counter value is: %u.",
-                                                                                                                                       __FILE__, __func__, __LINE__, count);
-               count++;
-               sleep(1);
-       }
-       
-       return 0;
-}
-
diff --git a/usertrace-generic/sample-thread.c b/usertrace-generic/sample-thread.c
deleted file mode 100644 (file)
index 270f2c9..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-
-#include <pthread.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-
-#define LTT_TRACE
-#include <ltt/ltt-facility-user_generic.h>
-
-
-void *thr1(void *arg)
-{
-  printf("thread 1, thread id : %lu, pid %lu\n", pthread_self(), getpid());
-
-  while(1) {
-               trace_user_generic_string("Hello world! Have a nice day.");
-               sleep(2);
-       }
-
-  return ((void*)1);
-
-}
-
-void *thr2(void *arg)
-{
-  printf("thread 2, thread id : %lu, pid %lu\n", pthread_self(), getpid());
-       sleep(1);
-  while(1) {
-               trace_user_generic_string("Hello world! Have a nice day.");
-    sleep(2);
-  }
-  return ((void*)2);
-}
-
-
-int main()
-{
-       int err;
-       pthread_t tid1, tid2;
-       void *tret;
-
-       printf("Will trace the following string : Hello world! Have a nice day.\n");
-       printf("Press CTRL-C to stop.\n");
-  printf("thread main, thread id : %lu, pid %lu\n", pthread_self(), getpid());
-  err = pthread_create(&tid1, NULL, thr1, NULL);
-  if(err!=0) exit(1);
-
-  err = pthread_create(&tid2, NULL, thr2, NULL);
-  if(err!=0) exit(1);
-
-  err = pthread_join(tid1, &tret);
-  if(err!= 0) exit(1);
-
-  err = pthread_join(tid2, &tret);
-  if(err!= 0) exit(1);
-  
-  return 0;
-}
diff --git a/usertrace-generic/sample.c b/usertrace-generic/sample.c
deleted file mode 100644 (file)
index efe4110..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-
-#include <stdio.h>
-#include <unistd.h>
-
-#define LTT_TRACE
-#define LTT_BLOCKING 1
-#include <ltt/ltt-facility-user_generic.h>
-
-
-int main(int argc, char **argv)
-{
-       printf("Will trace the following string : Hello world! Have a nice day.\n");
-
-       while(1) {
-               trace_user_generic_string("Hello world! Have a nice day.");
-               sleep(1);
-       }
-       
-       return 0;
-}
-
diff --git a/usertrace-generic/user_generic.xml b/usertrace-generic/user_generic.xml
deleted file mode 100644 (file)
index 6e555bb..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-<facility name=user_generic>
-  <description>Generic user space facility</description>
-       
-  <event name=string>
-       <description>Takes a string from user space</description>
-               <field name="data"><string/></field>
-  </event>
-
-  <event name=string_pointer>
-       <description>Takes a string and pointer from user space</description>
-               <field name="string"><string/></field>
-               <field name="pointer"><pointer/></field>
-  </event>
-       
-       <event name=slow_printf param_buffer>
-       <description>Takes a buffer of variable size (written by printf) and log it.</description>
-               <field name="string"><string/></field>
-  </event>
-       
-       <event name=function_entry no_instrument_function>
-               <description>Entry in a function</description>
-               <field name="this_fn"><pointer/></field>
-               <field name="call_site"><pointer/></field>
-       </event>
-
-       <event name=function_exit no_instrument_function>
-               <description>Exit from a function</description>
-               <field name="this_fn"><pointer/></field>
-               <field name="call_site"><pointer/></field>
-       </event>
-
-</facility>
This page took 0.062766 seconds and 4 git commands to generate.