add usertrace-fast
[lttv.git] / usertrace-fast / ltt-usertrace-fast.c
1
2 /* LTTng user-space "fast" 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 "ltt-usertrace-fast.h"
22
23 /* TLS for the trace buffer
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.
32 */
33
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),
41 ATOMIC_INIT(0),
42 ATOMIC_INIT(0),
43 ATOMIC_INIT(0)
44 },
45 .channel.cpu =
46 { ATOMIC_INIT(0),
47 ATOMIC_INIT(0),
48 ATOMIC_INIT(0),
49 ATOMIC_INIT(0)
50 },
51 };
52
53
54 static void ltt_cleanup_thread(void *arg)
55 {
56 /* Flush the data in the lttng_trace_info */
57
58 }
59
60
61 void ltt_thread_init(void)
62 {
63 _pthread_cleanup_push(&lttng_trace_info.cleanup,
64 ltt_cleanup_thread, NULL);
65 }
66
67
68 void __attribute__((constructor)) __ltt_usertrace_fast_init(void)
69 {
70 int err;
71
72 printf("LTTng usertrace-fast init\n");
73
74 ltt_thread_init();
75
76 }
77
This page took 0.030063 seconds and 4 git commands to generate.