Commit | Line | Data |
---|---|---|
17baffe2 MD |
1 | #ifndef _LTT_TRACER_H |
2 | #define _LTT_TRACER_H | |
3 | ||
1c8284eb | 4 | /* |
17baffe2 MD |
5 | * ltt-tracer.h |
6 | * | |
7 | * Copyright (C) 2005-2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
1c8284eb MD |
8 | * |
9 | * This contains the definitions for the Linux Trace Toolkit tracer. | |
10 | * | |
11 | * Dual LGPL v2.1/GPL v2 license. | |
12 | */ | |
13 | ||
1c8284eb MD |
14 | #include <stdarg.h> |
15 | #include <linux/types.h> | |
16 | #include <linux/limits.h> | |
17 | #include <linux/list.h> | |
18 | #include <linux/cache.h> | |
1c8284eb MD |
19 | #include <linux/timex.h> |
20 | #include <linux/wait.h> | |
1c8284eb MD |
21 | #include <asm/atomic.h> |
22 | #include <asm/local.h> | |
23 | ||
f3bc08c5 | 24 | #include "wrapper/trace-clock.h" |
1c8284eb | 25 | #include "ltt-tracer-core.h" |
1c25284c | 26 | #include "ltt-events.h" |
1c8284eb | 27 | |
80c16bcf MD |
28 | #define LTTNG_VERSION 0 |
29 | #define LTTNG_PATCHLEVEL 9 | |
30 | #define LTTNG_SUBLEVEL 1 | |
31 | ||
c099397a MD |
32 | #ifndef CHAR_BIT |
33 | #define CHAR_BIT 8 | |
34 | #endif | |
35 | ||
1c8284eb MD |
36 | /* Number of bytes to log with a read/write event */ |
37 | #define LTT_LOG_RW_SIZE 32L | |
38 | ||
7514523f MD |
39 | /* |
40 | * Hardcoded event headers | |
1c8284eb MD |
41 | * |
42 | * event header for a trace with active heartbeat : 27 bits timestamps | |
43 | * | |
44 | * headers are 32-bits aligned. In order to insure such alignment, a dynamic per | |
45 | * trace alignment value must be done. | |
46 | * | |
47 | * Remember that the C compiler does align each member on the boundary | |
48 | * equivalent to their own size. | |
49 | * | |
50 | * As relay subbuffers are aligned on pages, we are sure that they are 4 and 8 | |
51 | * bytes aligned, so the buffer header and trace header are aligned. | |
52 | * | |
53 | * Event headers are aligned depending on the trace alignment option. | |
54 | * | |
55 | * Note using C structure bitfields for cross-endianness and portability | |
56 | * concerns. | |
57 | */ | |
58 | ||
1c8284eb MD |
59 | #define LTT_MAX_SMALL_SIZE 0xFFFFU |
60 | ||
d793d5e1 | 61 | #ifdef RING_BUFFER_ALIGN |
d793d5e1 | 62 | #define ltt_alignof(type) __alignof__(type) |
c099397a | 63 | #else |
d793d5e1 MD |
64 | #define ltt_alignof(type) 1 |
65 | #endif | |
1c8284eb | 66 | |
1c8284eb | 67 | /* Tracer properties */ |
1c25284c | 68 | #define CTF_MAGIC_NUMBER 0xC1FC1FC1 |
881833e3 | 69 | #define TSDL_MAGIC_NUMBER 0x75D11D57 |
d793d5e1 MD |
70 | #define CTF_VERSION_MAJOR 0 |
71 | #define CTF_VERSION_MINOR 1 | |
1c8284eb | 72 | |
c099397a MD |
73 | /* |
74 | * Number of milliseconds to retry before failing metadata writes on buffer full | |
75 | * condition. (10 seconds) | |
76 | */ | |
77 | #define LTTNG_METADATA_TIMEOUT_MSEC 10000 | |
78 | ||
1c8284eb MD |
79 | /* |
80 | * Size reserved for high priority events (interrupts, NMI, BH) at the end of a | |
81 | * nearly full buffer. User space won't use this last amount of space when in | |
82 | * blocking mode. This space also includes the event header that would be | |
83 | * written by this user space event. | |
84 | */ | |
85 | #define LTT_RESERVE_CRITICAL 4096 | |
86 | ||
64c796d8 MD |
87 | #define LTT_RFLAG_EXTENDED RING_BUFFER_RFLAG_END |
88 | #define LTT_RFLAG_END (LTT_RFLAG_EXTENDED << 1) | |
89 | ||
1c8284eb MD |
90 | /* Register and unregister function pointers */ |
91 | ||
92 | enum ltt_module_function { | |
93 | LTT_FUNCTION_RUN_FILTER, | |
94 | LTT_FUNCTION_FILTER_CONTROL, | |
95 | LTT_FUNCTION_STATEDUMP | |
96 | }; | |
97 | ||
98 | extern int ltt_module_register(enum ltt_module_function name, void *function, | |
99 | struct module *owner); | |
100 | extern void ltt_module_unregister(enum ltt_module_function name); | |
101 | ||
1c8284eb MD |
102 | /* Exported control function */ |
103 | ||
1c8284eb MD |
104 | void ltt_core_register(int (*function)(u8, void *)); |
105 | ||
106 | void ltt_core_unregister(void); | |
107 | ||
1c8284eb MD |
108 | extern |
109 | void ltt_statedump_register_kprobes_dump(void (*callback)(void *call_data)); | |
110 | extern | |
111 | void ltt_statedump_unregister_kprobes_dump(void (*callback)(void *call_data)); | |
112 | ||
113 | extern void ltt_dump_softirq_vec(void *call_data); | |
114 | ||
f277b4c1 | 115 | #ifdef CONFIG_HAVE_LTT_DUMP_TABLES |
1c8284eb MD |
116 | extern void ltt_dump_sys_call_table(void *call_data); |
117 | extern void ltt_dump_idt_table(void *call_data); | |
f277b4c1 MD |
118 | #else |
119 | static inline void ltt_dump_sys_call_table(void *call_data) | |
120 | { | |
121 | } | |
122 | ||
123 | static inline void ltt_dump_idt_table(void *call_data) | |
124 | { | |
125 | } | |
126 | #endif | |
1c8284eb | 127 | |
1c8284eb | 128 | #endif /* _LTT_TRACER_H */ |