remove smp_example
[lttv.git] / ltt / branches / poly / ltt / convert / LinuxEvents.h
CommitLineData
160d4bdb 1/*
2 * LinuxEvents.h
3 *
4 * Copyright (C) 2000, 2001, 2002 Karim Yaghmour (karym@opersys.com).
5 *
6 * This header is distributed under GPL.
7 *
8 * Linux events being traced.
9 *
10 * History :
11 * K.Y., 31/05/1999, Initial typing.
a1e6cce6 12 * Mathieu Desnoyers 13-01-2005 : adaptation for multiple version input
160d4bdb 13 */
14
15#ifndef __TRACE_TOOLKIT_LINUX_HEADER__
16#define __TRACE_TOOLKIT_LINUX_HEADER__
17
15062788 18#include "LTTTypes.h"
160d4bdb 19
20/* Traced events */
21#define TRACE_START 0 /* This is to mark the trace's start */
22#define TRACE_SYSCALL_ENTRY 1 /* Entry in a given system call */
23#define TRACE_SYSCALL_EXIT 2 /* Exit from a given system call */
24#define TRACE_TRAP_ENTRY 3 /* Entry in a trap */
25#define TRACE_TRAP_EXIT 4 /* Exit from a trap */
26#define TRACE_IRQ_ENTRY 5 /* Entry in an irq */
27#define TRACE_IRQ_EXIT 6 /* Exit from an irq */
28#define TRACE_SCHEDCHANGE 7 /* Scheduling change */
29#define TRACE_KERNEL_TIMER 8 /* The kernel timer routine has been called */
30#define TRACE_SOFT_IRQ 9 /* Hit key part of soft-irq management */
31#define TRACE_PROCESS 10 /* Hit key part of process management */
32#define TRACE_FILE_SYSTEM 11 /* Hit key part of file system */
33#define TRACE_TIMER 12 /* Hit key part of timer management */
34#define TRACE_MEMORY 13 /* Hit key part of memory management */
35#define TRACE_SOCKET 14 /* Hit key part of socket communication */
36#define TRACE_IPC 15 /* Hit key part of inter-process communication */
37#define TRACE_NETWORK 16 /* Hit key part of network communication */
38
39#define TRACE_BUFFER_START 17 /* Mark the begining of a trace buffer */
40#define TRACE_BUFFER_END 18 /* Mark the ending of a trace buffer */
41#define TRACE_NEW_EVENT 19 /* New event type */
42#define TRACE_CUSTOM 20 /* Custom event */
43
44#define TRACE_CHANGE_MASK 21 /* Change in event mask */
45#define TRACE_HEARTBEAT 22 /* Heartbeat event */
46
47/* Number of traced events */
48#define TRACE_MAX TRACE_HEARTBEAT
49
50/* Architecture types */
51#define TRACE_ARCH_TYPE_I386 1 /* i386 system */
52#define TRACE_ARCH_TYPE_PPC 2 /* PPC system */
53#define TRACE_ARCH_TYPE_SH 3 /* SH system */
54#define TRACE_ARCH_TYPE_S390 4 /* S/390 system */
55#define TRACE_ARCH_TYPE_MIPS 5 /* MIPS system */
56#define TRACE_ARCH_TYPE_ARM 6 /* ARM system */
57
58/* Standard definitions for variants */
59#define TRACE_ARCH_VARIANT_NONE 0 /* Main architecture implementation */
60
61/* PowerPC variants */
62#define TRACE_ARCH_VARIANT_PPC_4xx 1 /* 4xx systems (IBM embedded series) */
63#define TRACE_ARCH_VARIANT_PPC_6xx 2 /* 6xx/7xx/74xx/8260/POWER3 systems (desktop flavor) */
64#define TRACE_ARCH_VARIANT_PPC_8xx 3 /* 8xx system (Motoral embedded series) */
65#define TRACE_ARCH_VARIANT_PPC_ISERIES 4 /* 8xx system (iSeries) */
66
67/* System types */
68#define TRACE_SYS_TYPE_VANILLA_LINUX 1 /* Vanilla linux kernel */
69#define TRACE_SYS_TYPE_RTAI_LINUX 2 /* RTAI patched linux kernel */
70
71/* The information logged when the tracing is started */
72#define TRACER_MAGIC_NUMBER 0x00D6B7ED /* That day marks an important historical event ... */
3fc51411 73
74/* Minimum information contained in any trace start event */
75typedef struct _trace_start_any
76{
77 uint32_t MagicNumber; /* Magic number to identify a trace */
78 uint32_t ArchType; /* Type of architecture */
79 uint32_t ArchVariant; /* Variant of the given type of architecture */
80 uint32_t SystemType; /* Operating system type */
81 uint8_t MajorVersion; /* Major version of trace */
82 uint8_t MinorVersion; /* Minor version of trace */
83
84} LTT_PACKED_STRUCT trace_start_any;
85
a1e6cce6 86typedef struct _trace_start_1_14
87{
88 uint32_t MagicNumber; /* Magic number to identify a trace */
89 uint32_t ArchType; /* Type of architecture */
90 uint32_t ArchVariant; /* Variant of the given type of architecture */
91 uint32_t SystemType; /* Operating system type */
92 uint8_t MajorVersion; /* Major version of trace */
93 uint8_t MinorVersion; /* Minor version of trace */
94
95 uint32_t BufferSize; /* Size of buffers */
96 trace_event_mask EventMask; /* The event mask */
97 trace_event_mask DetailsMask; /* Are the event details logged */
98 uint8_t LogCPUID; /* Is the CPUID logged */
99} LTT_PACKED_STRUCT trace_start_1_14;
100
3fc51411 101typedef struct _trace_start_2_2
160d4bdb 102{
103 uint32_t MagicNumber; /* Magic number to identify a trace */
104 uint32_t ArchType; /* Type of architecture */
105 uint32_t ArchVariant; /* Variant of the given type of architecture */
106 uint32_t SystemType; /* Operating system type */
107 uint8_t MajorVersion; /* Major version of trace */
108 uint8_t MinorVersion; /* Minor version of trace */
109
110 uint32_t BufferSize; /* Size of buffers */
111 trace_event_mask EventMask; /* The event mask */
112 trace_event_mask DetailsMask; /* Are the event details logged */
113 uint8_t LogCPUID; /* Is the CPUID logged */
3fc51411 114 uint8_t UseTSC; /* Are we using TSCs or time deltas */
115
116} LTT_PACKED_STRUCT trace_start_2_2;
160d4bdb 117
3fc51411 118typedef struct _trace_start_2_3
119{
120 uint32_t MagicNumber; /* Magic number to identify a trace */
121 uint32_t ArchType; /* Type of architecture */
122 uint32_t ArchVariant; /* Variant of the given type of architecture */
123 uint32_t SystemType; /* Operating system type */
124 uint8_t MajorVersion; /* Major version of trace */
125 uint8_t MinorVersion; /* Minor version of trace */
126
127 uint32_t BufferSize; /* Size of buffers */
128 trace_event_mask EventMask; /* The event mask */
129 trace_event_mask DetailsMask; /* Are the event details logged */
130 uint8_t LogCPUID; /* Is the CPUID logged */
131 uint8_t UseTSC; /* Are we using TSCs or time deltas */
132
133 uint8_t FlightRecorder; /* Is this a flight recorder trace ? */
134} LTT_PACKED_STRUCT trace_start_2_3;
160d4bdb 135
136/* TRACE_SYSCALL_ENTRY */
137typedef struct _trace_syscall_entry
138{
139 uint8_t syscall_id; /* Syscall entry number in entry.S */
140 uint32_t address; /* Address from which call was made */
141} LTT_PACKED_STRUCT trace_syscall_entry;
142#define SYSCALL_EVENT(X) ((trace_syscall_entry*)X)
143
144/* TRACE_TRAP_ENTRY */
145typedef struct _trace_trap_entry
146{
147 uint16_t trap_id; /* Trap number */
148 uint32_t address; /* Address where trap occured */
149} LTT_PACKED_STRUCT trace_trap_entry;
150typedef struct _trace_trap_entry_s390
151{
152 uint64_t trap_id; /* Trap number */
153 uint32_t address; /* Address where trap occured */
154} LTT_PACKED_STRUCT trace_trap_entry_s390;
155#define TRAP_EVENT(X) ((trace_trap_entry*)X)
156#define TRAP_EVENT_S390(X) ((trace_trap_entry_s390*)X)
157
158/* TRACE_IRQ_ENTRY */
159typedef struct _trace_irq_entry
160{
161 uint8_t irq_id; /* IRQ number */
162 uint8_t kernel; /* Are we executing kernel code */
163} LTT_PACKED_STRUCT trace_irq_entry;
164#define IRQ_EVENT(X) ((trace_irq_entry*)X)
165
166/* TRACE_SCHEDCHANGE */
167typedef struct _trace_schedchange
168{
169 uint32_t out; /* Outgoing process */
170 uint32_t in; /* Incoming process */
171 uint32_t out_state; /* Outgoing process' state */
172} LTT_PACKED_STRUCT trace_schedchange;
173#define SCHED_EVENT(X) ((trace_schedchange*)X)
174
175/* TRACE_SOFT_IRQ */
176#define TRACE_SOFT_IRQ_BOTTOM_HALF 1 /* Conventional bottom-half */
177#define TRACE_SOFT_IRQ_SOFT_IRQ 2 /* Real soft-irq */
178#define TRACE_SOFT_IRQ_TASKLET_ACTION 3 /* Tasklet action */
179#define TRACE_SOFT_IRQ_TASKLET_HI_ACTION 4 /* Tasklet hi-action */
180typedef struct _trace_soft_irq
181{
182 uint8_t event_sub_id; /* Soft-irq event Id */
183 uint32_t event_data; /* Data associated with event */
184} LTT_PACKED_STRUCT trace_soft_irq;
185#define SOFT_IRQ_EVENT(X) ((trace_soft_irq*)X)
186
187/* TRACE_PROCESS */
188#define TRACE_PROCESS_KTHREAD 1 /* Creation of a kernel thread */
189#define TRACE_PROCESS_FORK 2 /* A fork or clone occured */
190#define TRACE_PROCESS_EXIT 3 /* An exit occured */
191#define TRACE_PROCESS_WAIT 4 /* A wait occured */
192#define TRACE_PROCESS_SIGNAL 5 /* A signal has been sent */
193#define TRACE_PROCESS_WAKEUP 6 /* Wake up a process */
2da61677 194#define TRACE_PROCESS_RELEASE 7 /* A task struct has been released */
195
160d4bdb 196typedef struct _trace_process
197{
198 uint8_t event_sub_id; /* Process event ID */
199 uint32_t event_data1; /* Data associated with event */
200 uint32_t event_data2;
201} LTT_PACKED_STRUCT trace_process;
202#define PROC_EVENT(X) ((trace_process*)X)
203
204/* TRACE_FILE_SYSTEM */
205#define TRACE_FILE_SYSTEM_BUF_WAIT_START 1 /* Starting to wait for a data buffer */
206#define TRACE_FILE_SYSTEM_BUF_WAIT_END 2 /* End to wait for a data buffer */
207#define TRACE_FILE_SYSTEM_EXEC 3 /* An exec occured */
208#define TRACE_FILE_SYSTEM_OPEN 4 /* An open occured */
209#define TRACE_FILE_SYSTEM_CLOSE 5 /* A close occured */
210#define TRACE_FILE_SYSTEM_READ 6 /* A read occured */
211#define TRACE_FILE_SYSTEM_WRITE 7 /* A write occured */
212#define TRACE_FILE_SYSTEM_SEEK 8 /* A seek occured */
213#define TRACE_FILE_SYSTEM_IOCTL 9 /* An ioctl occured */
214#define TRACE_FILE_SYSTEM_SELECT 10 /* A select occured */
215#define TRACE_FILE_SYSTEM_POLL 11 /* A poll occured */
216typedef struct _trace_file_system
217{
218 uint8_t event_sub_id; /* File system event ID */
219 uint32_t event_data1; /* Event data */
220 uint32_t event_data2; /* Event data 2 */
221 char* file_name; /* Name of file operated on */
222} LTT_PACKED_STRUCT trace_file_system;
223#define FS_EVENT(X) ((trace_file_system*)X)
224#define FS_EVENT_FILENAME(X) ((char*) ((X) + sizeof(trace_file_system)))
225
226/* TRACE_TIMER */
227#define TRACE_TIMER_EXPIRED 1 /* Timer expired */
228#define TRACE_TIMER_SETITIMER 2 /* Setting itimer occurred */
229#define TRACE_TIMER_SETTIMEOUT 3 /* Setting sched timeout occurred */
230typedef struct _trace_timer
231{
232 uint8_t event_sub_id; /* Timer event ID */
233 uint8_t event_sdata; /* Short data */
234 uint32_t event_data1; /* Data associated with event */
235 uint32_t event_data2;
236} LTT_PACKED_STRUCT trace_timer;
237#define TIMER_EVENT(X) ((trace_timer*)X)
238
239/* TRACE_MEMORY */
240#define TRACE_MEMORY_PAGE_ALLOC 1 /* Allocating pages */
241#define TRACE_MEMORY_PAGE_FREE 2 /* Freing pages */
242#define TRACE_MEMORY_SWAP_IN 3 /* Swaping pages in */
243#define TRACE_MEMORY_SWAP_OUT 4 /* Swaping pages out */
244#define TRACE_MEMORY_PAGE_WAIT_START 5 /* Start to wait for page */
245#define TRACE_MEMORY_PAGE_WAIT_END 6 /* End to wait for page */
246typedef struct _trace_memory
247{
248 uint8_t event_sub_id; /* Memory event ID */
249 unsigned long event_data; /* Data associated with event */
250} LTT_PACKED_STRUCT trace_memory;
251#define MEM_EVENT(X) ((trace_memory*)X)
252
253/* TRACE_SOCKET */
254#define TRACE_SOCKET_CALL 1 /* A socket call occured */
255#define TRACE_SOCKET_CREATE 2 /* A socket has been created */
256#define TRACE_SOCKET_SEND 3 /* Data was sent to a socket */
257#define TRACE_SOCKET_RECEIVE 4 /* Data was read from a socket */
258typedef struct _trace_socket
259{
260 uint8_t event_sub_id; /* Socket event ID */
261 uint32_t event_data1; /* Data associated with event */
262 uint32_t event_data2; /* Data associated with event */
263} LTT_PACKED_STRUCT trace_socket;
264#define SOCKET_EVENT(X) ((trace_socket*)X)
265
266/* TRACE_IPC */
267#define TRACE_IPC_CALL 1 /* A System V IPC call occured */
268#define TRACE_IPC_MSG_CREATE 2 /* A message queue has been created */
269#define TRACE_IPC_SEM_CREATE 3 /* A semaphore was created */
270#define TRACE_IPC_SHM_CREATE 4 /* A shared memory segment has been created */
271typedef struct _trace_ipc
272{
273 uint8_t event_sub_id; /* IPC event ID */
274 uint32_t event_data1; /* Data associated with event */
275 uint32_t event_data2; /* Data associated with event */
276} LTT_PACKED_STRUCT trace_ipc;
277#define IPC_EVENT(X) ((trace_ipc*)X)
278
279/* TRACE_NETWORK */
280#define TRACE_NETWORK_PACKET_IN 1 /* A packet came in */
281#define TRACE_NETWORK_PACKET_OUT 2 /* A packet was sent */
282typedef struct _trace_network
283{
284 uint8_t event_sub_id; /* Network event ID */
285 uint32_t event_data; /* Event data */
286} LTT_PACKED_STRUCT trace_network;
287#define NET_EVENT(X) ((trace_network*)X)
288
289/* Start of trace buffer information */
a1e6cce6 290typedef struct _trace_buffer_start_1
291{
292 struct timeval Time; /* Time stamp of this buffer */
293 uint32_t ID; /* Unique buffer ID */
294} LTT_PACKED_STRUCT trace_buffer_start_1;
295
296/* Start of trace buffer information */
297typedef struct _trace_buffer_start_2
160d4bdb 298{
299 struct timeval Time; /* Time stamp of this buffer */
300 uint32_t TSC; /* TSC of this buffer, if applicable */
301 uint32_t ID; /* Unique buffer ID */
a1e6cce6 302} LTT_PACKED_STRUCT trace_buffer_start_2;
160d4bdb 303
304/* End of trace buffer information */
a1e6cce6 305typedef struct _trace_buffer_end_2
160d4bdb 306{
307 struct timeval Time; /* Time stamp of this buffer */
308 uint32_t TSC; /* TSC of this buffer, if applicable */
a1e6cce6 309} LTT_PACKED_STRUCT trace_buffer_end_2;
160d4bdb 310
311/* Maximal size a custom event can have */
312#define CUSTOM_EVENT_MAX_SIZE 8192
313
314/* String length limits for custom events creation */
315#define CUSTOM_EVENT_TYPE_STR_LEN 20
316#define CUSTOM_EVENT_DESC_STR_LEN 100
317#define CUSTOM_EVENT_FORM_STR_LEN 256
318
319/* Type of custom event formats */
320#define CUSTOM_EVENT_FORMAT_TYPE_NONE 0
321#define CUSTOM_EVENT_FORMAT_TYPE_STR 1
322#define CUSTOM_EVENT_FORMAT_TYPE_HEX 2
323#define CUSTOM_EVENT_FORMAT_TYPE_XML 3
324#define CUSTOM_EVENT_FORMAT_TYPE_IBM 4
325
326typedef struct _trace_new_event
327{
328 /* Basics */
329 uint32_t id; /* Custom event ID */
330 char type[CUSTOM_EVENT_TYPE_STR_LEN]; /* Event type description */
331 char desc[CUSTOM_EVENT_DESC_STR_LEN]; /* Detailed event description */
332
333 /* Custom formatting */
334 uint32_t format_type; /* Type of formatting */
335 char form[CUSTOM_EVENT_FORM_STR_LEN]; /* Data specific to format */
336} LTT_PACKED_STRUCT trace_new_event;
337#define NEW_EVENT(X) ((trace_new_event*) X)
338
339typedef struct _trace_custom
340{
341 uint32_t id; /* Event ID */
342 uint32_t data_size; /* Size of data recorded by event */
343 void* data; /* Data recorded by event */
344} LTT_PACKED_STRUCT trace_custom;
345#define CUSTOM_EVENT(X) ((trace_custom*) X)
346
347/* TRACE_CHANGE_MASK */
348typedef struct _trace_change_mask
349{
350 trace_event_mask mask; /* Event mask */
351} LTT_PACKED_STRUCT trace_change_mask;
352#define CHMASK_EVENT(X) ((trace_change_mask*) X)
353
354#endif /* __TRACE_TOOLKIT_LINUX_HEADER__ */
This page took 0.041303 seconds and 4 git commands to generate.