add usertrace-fast
[lttv.git] / usertrace-fast / lttng_usertrace.c
CommitLineData
b09f3215 1
2/* LTTng user-space tracing code
3 *
4 * Copyright 2006 Mathieu Desnoyers
5 *
6 */
7
8
9#include <sys/types.h>
10#include <sys/wait.h>
11#include <unistd.h>
12#include <stdlib.h>
13#include <stdio.h>
14#include <signal.h>
15#include <syscall.h>
16#include <features.h>
17#include <pthread.h>
18#include <malloc.h>
19#include <string.h>
20
21#include "lttng_usertrace.h"
22
51bf1553 23/* TLS for the trace buffer
b09f3215 24 * http://www.dis.com/gnu/gcc/C--98-Thread-Local-Edits.html
25 *
26 * Add after paragraph 4
27 *
28 * The storage for an object of thread storage duration shall be statically
29 * initialized before the first statement of the thread startup function. An
30 * object of thread storage duration shall not require dynamic
31 * initialization.
b09f3215 32 */
33
51bf1553 34__thread struct lttng_trace_info lttng_trace_info =
35{
36 .init = 0,
37 .filter = 0,
38 .nesting = ATOMIC_INIT(0),
39 .channel.facilities =
40 { ATOMIC_INIT(0),
b09f3215 41 ATOMIC_INIT(0),
42 ATOMIC_INIT(0),
51bf1553 43 ATOMIC_INIT(0)
44 },
45 .channel.cpu =
46 { ATOMIC_INIT(0),
b09f3215 47 ATOMIC_INIT(0),
48 ATOMIC_INIT(0),
49 ATOMIC_INIT(0)
51bf1553 50 },
b09f3215 51};
52
53
51bf1553 54static void ltt_cleanup_thread(void *arg)
b09f3215 55{
51bf1553 56 /* Flush the data in the lttng_trace_info */
b09f3215 57
b09f3215 58}
59
60
51bf1553 61void ltt_thread_init(void)
b09f3215 62{
51bf1553 63 _pthread_cleanup_push(&lttng_trace_info.cleanup,
64 ltt_cleanup_thread, NULL);
b09f3215 65}
66
67
b09f3215 68void __attribute__((constructor)) __lttng_user_init(void)
69{
b09f3215 70 int err;
71
51bf1553 72 printf("LTTng usertrace-fast init\n");
b09f3215 73
b09f3215 74
75
b09f3215 76}
77
This page took 0.025459 seconds and 4 git commands to generate.