From: compudj Date: Tue, 7 Mar 2006 15:40:53 +0000 (+0000) Subject: add usertrace-fast X-Git-Tag: v0.12.20~1884 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=04180f7feb011f6757a7c257b0f2bb8ac756ad5a;p=lttv.git add usertrace-fast git-svn-id: http://ltt.polymtl.ca/svn@1605 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/usertrace-fast/ltt-usertrace-fast.c b/usertrace-fast/ltt-usertrace-fast.c new file mode 100644 index 00000000..f910e069 --- /dev/null +++ b/usertrace-fast/ltt-usertrace-fast.c @@ -0,0 +1,77 @@ + +/* LTTng user-space "fast" tracing code + * + * Copyright 2006 Mathieu Desnoyers + * + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ltt_usertrace.h" + +/* TLS for the trace buffer + * http://www.dis.com/gnu/gcc/C--98-Thread-Local-Edits.html + * + * Add after paragraph 4 + * + * The storage for an object of thread storage duration shall be statically + * initialized before the first statement of the thread startup function. An + * object of thread storage duration shall not require dynamic + * initialization. + */ + +__thread struct lttng_trace_info lttng_trace_info = +{ + .init = 0, + .filter = 0, + .nesting = ATOMIC_INIT(0), + .channel.facilities = + { ATOMIC_INIT(0), + ATOMIC_INIT(0), + ATOMIC_INIT(0), + ATOMIC_INIT(0) + }, + .channel.cpu = + { ATOMIC_INIT(0), + ATOMIC_INIT(0), + ATOMIC_INIT(0), + ATOMIC_INIT(0) + }, +}; + + +static void ltt_cleanup_thread(void *arg) +{ + /* Flush the data in the lttng_trace_info */ + +} + + +void ltt_thread_init(void) +{ + _pthread_cleanup_push(<tng_trace_info.cleanup, + ltt_cleanup_thread, NULL); +} + + +void __attribute__((constructor)) __ltt_usertrace_fast_init(void) +{ + int err; + + printf("LTTng usertrace-fast init\n"); + + + +} + diff --git a/usertrace-fast/ltt-usertrace-fast.h b/usertrace-fast/ltt-usertrace-fast.h new file mode 100644 index 00000000..a740a832 --- /dev/null +++ b/usertrace-fast/ltt-usertrace-fast.h @@ -0,0 +1,46 @@ + +/* LTTng user-space "fast" tracing header + * + * Copyright 2006 Mathieu Desnoyers + * + */ + +#ifndef _LTT_USERTRACE_FAST_H +#define _LTT_USERTRACE_FAST_H + +#include +#include + +#ifndef LTT_BUF_SIZE_CPU +#define LTT_BUF_SIZE_CPU 1048576 +#endif //LTT_BUF_SIZE_CPU + +#ifndef LTT_BUF_SIZE_FACILITIES +#define LTT_BUF_SIZE_FACILITIES 4096 +#endif //LTT_BUF_SIZE_FACILITIES + +struct ltt_buf { + atomic_t offset; + atomic_t reserve_count; + atomic_t commit_count; + + atomic_t events_lost; +}; + +struct lttng_trace_info { + struct _pthread_cleanup_buffer cleanup; + int filter; + atomic_t nesting; + struct { + struct ltt_buf facilities; + char facilities_buf[LTT_BUF_SIZE_FACILITIES] __attribute__ ((aligned (8))); + struct ltt_buf cpu; + char cpu_buf[LTT_BUF_SIZE_CPU] __attribute__ ((aligned (8))); + } channel; +}; + +extern __thread struct lttng_trace_info lttng_trace_info; + +void ltt_thread_init(void); + +#endif //_LTT_USERTRACE_FAST_H diff --git a/usertrace-fast/lttng_usertrace.c b/usertrace-fast/lttng_usertrace.c deleted file mode 100644 index 9b4b3036..00000000 --- a/usertrace-fast/lttng_usertrace.c +++ /dev/null @@ -1,77 +0,0 @@ - -/* LTTng user-space tracing code - * - * Copyright 2006 Mathieu Desnoyers - * - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "lttng_usertrace.h" - -/* TLS for the trace buffer - * http://www.dis.com/gnu/gcc/C--98-Thread-Local-Edits.html - * - * Add after paragraph 4 - * - * The storage for an object of thread storage duration shall be statically - * initialized before the first statement of the thread startup function. An - * object of thread storage duration shall not require dynamic - * initialization. - */ - -__thread struct lttng_trace_info lttng_trace_info = -{ - .init = 0, - .filter = 0, - .nesting = ATOMIC_INIT(0), - .channel.facilities = - { ATOMIC_INIT(0), - ATOMIC_INIT(0), - ATOMIC_INIT(0), - ATOMIC_INIT(0) - }, - .channel.cpu = - { ATOMIC_INIT(0), - ATOMIC_INIT(0), - ATOMIC_INIT(0), - ATOMIC_INIT(0) - }, -}; - - -static void ltt_cleanup_thread(void *arg) -{ - /* Flush the data in the lttng_trace_info */ - -} - - -void ltt_thread_init(void) -{ - _pthread_cleanup_push(<tng_trace_info.cleanup, - ltt_cleanup_thread, NULL); -} - - -void __attribute__((constructor)) __lttng_user_init(void) -{ - int err; - - printf("LTTng usertrace-fast init\n"); - - - -} - diff --git a/usertrace-fast/lttng_usertrace.h b/usertrace-fast/lttng_usertrace.h deleted file mode 100644 index 51d0767b..00000000 --- a/usertrace-fast/lttng_usertrace.h +++ /dev/null @@ -1,46 +0,0 @@ - -/* LTTng user-space tracing header - * - * Copyright 2006 Mathieu Desnoyers - * - */ - -#ifndef _LTTNG_USERTRACE_H -#define _LTTNG_USERTRACE_H - -#include -#include - -#ifndef LTT_BUF_SIZE_CPU -#define LTT_BUF_SIZE_CPU 1048576 -#endif //LTT_BUF_SIZE_CPU - -#ifndef LTT_BUF_SIZE_FACILITIES -#define LTT_BUF_SIZE_FACILITIES 4096 -#endif //LTT_BUF_SIZE_FACILITIES - -struct ltt_buf { - atomic_t offset; - atomic_t reserve_count; - atomic_t commit_count; - - atomic_t events_lost; -}; - -struct lttng_trace_info { - struct _pthread_cleanup_buffer cleanup; - int filter; - atomic_t nesting; - struct { - struct ltt_buf facilities; - char facilities_buf[LTT_BUF_SIZE_FACILITIES] __attribute__ ((aligned (8))); - struct ltt_buf cpu; - char cpu_buf[LTT_BUF_SIZE_CPU] __attribute__ ((aligned (8))); - } channel; -}; - -extern __thread struct lttng_trace_info lttng_trace_info; - -void ltt_thread_init(void); - -#endif //_LTTNG_USERTRACE_H