Commit | Line | Data |
---|---|---|
5d10d135 ASL |
1 | /******************************************************************************* |
2 | * Copyright (c) 2009 Ericsson | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation | |
0821f854 | 11 | * Daniel U. Thibault (daniel.thibault@drdc-rddc.gc.ca) - 2011-06-21 Fixes |
5d10d135 | 12 | *******************************************************************************/ |
6c13869b | 13 | package org.eclipse.linuxtools.lttng.core.state; |
5d10d135 ASL |
14 | |
15 | import java.util.HashMap; | |
16 | import java.util.HashSet; | |
17 | ||
18 | /** | |
19 | * Singleton | |
0821f854 | 20 | * Establishes relationships of state-related strings. Since the strings and |
5d10d135 ASL |
21 | * relations are fixed, the elements are final i.e. just for reading. |
22 | * | |
23 | * @author alvaro | |
5d10d135 | 24 | */ |
9c4eb5f7 FC |
25 | |
26 | @SuppressWarnings("nls") | |
5d10d135 ASL |
27 | public class StateStrings { |
28 | ||
29 | // ======================================================================== | |
30 | // Table data | |
31 | // ======================================================================= | |
9c4eb5f7 | 32 | public static final String LTTV_STATE_UNBRANDED = ""; |
0821f854 | 33 | private static StateStrings instance = null; |
5d10d135 ASL |
34 | private final HashMap<String, Events> eventStrMap = new HashMap<String, Events>(); |
35 | private final HashMap<String, Events> stateTransEventMap = new HashMap<String, Events>(); | |
0821f854 | 36 | private final String[] syscall_names = new String[256]; |
5d10d135 ASL |
37 | private final String[] trap_names = new String[256]; |
38 | private final String[] irq_names = new String[256]; | |
39 | private final String[] soft_irq_names = new String[32]; | |
40 | ||
41 | private StateStrings() { | |
42 | // Build a Hash map from string name to actual event structure | |
43 | for (Events event : Events.values()) { | |
44 | eventStrMap.put(event.inName, event); | |
45 | if (event.isStateTransition()) { | |
46 | stateTransEventMap.put(event.inName, event); | |
47 | } | |
48 | } | |
49 | ||
50 | // Build system call names | |
51 | for (int i = 0; i < 256; i++) { | |
52 | syscall_names[i] = "syscall " + i; | |
53 | } | |
54 | ||
55 | // Build trap names | |
56 | for (int i = 0; i < 256; i++) { | |
57 | trap_names[i] = "trap " + i; | |
58 | } | |
59 | ||
60 | // Build irq names | |
61 | for (int i = 0; i < 256; i++) { | |
62 | irq_names[i] = "irq " + i; | |
63 | } | |
64 | ||
65 | // Build softirq names | |
66 | for (int i = 0; i < 32; i++) { | |
67 | soft_irq_names[i] = "softirq " + i; | |
68 | } | |
5d10d135 ASL |
69 | } |
70 | ||
71 | public static StateStrings getInstance() { | |
0821f854 | 72 | // Create singleton instance if not already done |
5d10d135 ASL |
73 | if (instance == null) { |
74 | instance = new StateStrings(); | |
75 | } | |
76 | return instance; | |
77 | } | |
78 | ||
79 | public enum Channels { | |
0821f854 FC |
80 | LTT_CHANNEL_FD_STATE("fd_state"), /* file descriptor state events */ |
81 | LTT_CHANNEL_GLOBAL_STATE("global_state"), /* system state dump events */ | |
82 | LTT_CHANNEL_IRQ_STATE("irq_state"), /* interrupt request (IRQ) events */ | |
83 | LTT_CHANNEL_MODULE_STATE("module_state"), /* modules state events (list of modules) */ | |
84 | LTT_CHANNEL_NETIF_STATE("netif_state"), /* network interface events */ | |
85 | LTT_CHANNEL_SOFTIRQ_STATE("softirq_state"), /* soft IRQs state events (soft IRQ vector table) */ | |
86 | LTT_CHANNEL_SWAP_STATE("swap_state"), /* swap state events */ | |
87 | LTT_CHANNEL_SYSCALL_STATE("syscall_state"), /* system calls state events (system call table) */ | |
88 | LTT_CHANNEL_TASK_STATE("task_state"), /* process state events */ | |
89 | LTT_CHANNEL_VM_STATE("vm_state"), /* virtual memory events (virtual memory table) */ | |
90 | LTT_CHANNEL_KPROBE_STATE("kprobe_state"), /* kprobe events (kprobe table) */ | |
91 | LTT_CHANNEL_FS("fs"), /* file system events */ | |
92 | LTT_CHANNEL_KERNEL("kernel"), /* kernel events */ | |
93 | LTT_CHANNEL_MM("mm"), /* memory management events */ | |
94 | LTT_CHANNEL_USERSPACE("userspace"), /* user space tracing events */ | |
95 | LTT_CHANNEL_BLOCK("block"); /* block devices events */ | |
96 | /* remaining channels: */ | |
97 | /* LTT_CHANNEL_DEFAULT("default"), /* null (i.e. no default) */ | |
98 | /* LTT_CHANNEL_INPUT("input"), /* LTT control command inputs */ | |
99 | /* LTT_CHANNEL_IPC("ipc"), /* Inter Process Communication (IPC) events */ | |
100 | /* LTT_CHANNEL_JBD2("jbd2"), /* Journaling Block Device (JBD) events (JBD2 fork for ext4 file system) */ | |
101 | /* LTT_CHANNEL_METADATA("metadata"), /* trace meta data */ | |
102 | /* LTT_CHANNEL_NET("net"), /* networking events */ | |
103 | /* LTT_CHANNEL_PM("pm"), /* power management events */ | |
104 | /* LTT_CHANNEL_RCU("rcu"), /* Read-Copy-Update (RCU) events */ | |
5d10d135 ASL |
105 | |
106 | private final String inName; | |
107 | ||
108 | private Channels(String name) { | |
109 | this.inName = name; | |
110 | } | |
111 | ||
112 | public String getInName() { | |
0821f854 FC |
113 | return this.inName; |
114 | } | |
115 | ||
5d10d135 | 116 | } |
5d10d135 | 117 | |
5d10d135 ASL |
118 | public enum Events { |
119 | LTT_EVENT_SYSCALL_ENTRY("syscall_entry"), /* */ | |
120 | LTT_EVENT_SYSCALL_EXIT("syscall_exit"), /* */ | |
121 | LTT_EVENT_TRAP_ENTRY("trap_entry"), /* */ | |
122 | LTT_EVENT_TRAP_EXIT("trap_exit"), /* */ | |
123 | LTT_EVENT_PAGE_FAULT_ENTRY("page_fault_entry"), /* */ | |
124 | LTT_EVENT_PAGE_FAULT_EXIT("page_fault_exit"), /* */ | |
125 | LTT_EVENT_PAGE_FAULT_NOSEM_ENTRY("page_fault_nosem_entry"), /* */ | |
126 | LTT_EVENT_PAGE_FAULT_NOSEM_EXIT("page_fault_nosem_exit"), /* */ | |
127 | LTT_EVENT_IRQ_ENTRY("irq_entry"), /* */ | |
128 | LTT_EVENT_IRQ_EXIT("irq_exit"), /* */ | |
129 | LTT_EVENT_SOFT_IRQ_RAISE("softirq_raise"), /* */ | |
130 | LTT_EVENT_SOFT_IRQ_ENTRY("softirq_entry"), /* */ | |
131 | LTT_EVENT_SOFT_IRQ_EXIT("softirq_exit"), /* */ | |
132 | LTT_EVENT_SCHED_SCHEDULE("sched_schedule"), /* */ | |
133 | LTT_EVENT_PROCESS_FORK("process_fork"), /* */ | |
134 | LTT_EVENT_KTHREAD_CREATE("kthread_create"), /* */ | |
135 | LTT_EVENT_PROCESS_EXIT("process_exit"), /* */ | |
136 | LTT_EVENT_PROCESS_FREE("process_free"), /* */ | |
137 | LTT_EVENT_EXEC("exec"), /* */ | |
138 | LTT_EVENT_PROCESS_STATE("process_state"), /* */ | |
139 | LTT_EVENT_STATEDUMP_END("statedump_end"), /* */ | |
140 | LTT_EVENT_FUNCTION_ENTRY("function_entry"), /* */ | |
141 | LTT_EVENT_FUNCTION_EXIT("function_exit"), /* */ | |
142 | LTT_EVENT_THREAD_BRAND("thread_brand"), /* */ | |
143 | LTT_EVENT_REQUEST_ISSUE("_blk_request_issue"), /* */ | |
144 | LTT_EVENT_REQUEST_COMPLETE("_blk_request_complete"), /* */ | |
145 | LTT_EVENT_LIST_INTERRUPT("interrupt"), /* */ | |
146 | LTT_EVENT_SYS_CALL_TABLE("sys_call_table"), /* */ | |
147 | LTT_EVENT_SOFTIRQ_VEC("softirq_vec"), /* */ | |
148 | LTT_EVENT_KPROBE_TABLE("kprobe_table"), /* */ | |
149 | LTT_EVENT_KPROBE("kprobe"); /* */ | |
150 | ||
151 | private final String inName; | |
152 | private final HashSet<Fields> children = new HashSet<Fields>(); | |
153 | private Channels parent = null; | |
0821f854 FC |
154 | // Default value for the "expected to cause a state transition?" flag |
155 | // Although most events do cause a state transition, the default is kept | |
156 | // false to make this important property explicit in the static initializer | |
5d10d135 ASL |
157 | private boolean stateTransition = false; |
158 | ||
159 | static { | |
160 | associate(); | |
161 | } | |
162 | ||
163 | private Events(String name) { | |
164 | this.inName = name; | |
165 | } | |
166 | ||
167 | public String getInName() { | |
168 | return this.inName; | |
169 | } | |
170 | ||
171 | public Channels getParent() { | |
172 | return this.parent; | |
173 | } | |
174 | ||
175 | public void setParent(Channels parent) { | |
176 | this.parent = parent; | |
177 | } | |
178 | ||
179 | public HashSet<Fields> getChildren() { | |
180 | return children; | |
181 | } | |
182 | ||
183 | public boolean isStateTransition() { | |
184 | return stateTransition; | |
185 | } | |
186 | ||
187 | private static void associate() { | |
0821f854 | 188 | // SYSCALL_ENTRY can receive ip (?), syscall_id |
5d10d135 | 189 | LTT_EVENT_SYSCALL_ENTRY.setParent(Channels.LTT_CHANNEL_KERNEL); |
5d10d135 | 190 | LTT_EVENT_SYSCALL_ENTRY.stateTransition = true; |
0821f854 | 191 | LTT_EVENT_SYSCALL_ENTRY.getChildren().add(Fields.LTT_FIELD_SYSCALL_ID); |
5d10d135 | 192 | |
0821f854 | 193 | //SYSCALL_EXIT |
5d10d135 ASL |
194 | LTT_EVENT_SYSCALL_EXIT.setParent(Channels.LTT_CHANNEL_KERNEL); |
195 | LTT_EVENT_SYSCALL_EXIT.stateTransition = true; | |
196 | ||
0821f854 | 197 | // TRAP_ENTRY |
5d10d135 ASL |
198 | LTT_EVENT_TRAP_ENTRY.setParent(Channels.LTT_CHANNEL_KERNEL); |
199 | LTT_EVENT_TRAP_ENTRY.getChildren().add(Fields.LTT_FIELD_TRAP_ID); | |
200 | LTT_EVENT_TRAP_ENTRY.stateTransition = true; | |
201 | ||
0821f854 | 202 | // TRAP_EXIT |
5d10d135 ASL |
203 | LTT_EVENT_TRAP_EXIT.setParent(Channels.LTT_CHANNEL_KERNEL); |
204 | LTT_EVENT_TRAP_EXIT.stateTransition = true; | |
205 | ||
0821f854 | 206 | // PAGE_FAULT_ENTRY |
5d10d135 | 207 | LTT_EVENT_PAGE_FAULT_ENTRY.setParent(Channels.LTT_CHANNEL_KERNEL); |
0821f854 | 208 | LTT_EVENT_PAGE_FAULT_ENTRY.getChildren().add(Fields.LTT_FIELD_TRAP_ID); |
5d10d135 ASL |
209 | LTT_EVENT_PAGE_FAULT_ENTRY.stateTransition = true; |
210 | ||
0821f854 | 211 | // PAGE_FAULT_EXIT |
5d10d135 ASL |
212 | LTT_EVENT_PAGE_FAULT_EXIT.setParent(Channels.LTT_CHANNEL_KERNEL); |
213 | LTT_EVENT_PAGE_FAULT_EXIT.stateTransition = true; | |
214 | ||
0821f854 FC |
215 | // PAGE_FAULT_NOSEM_ENTRY |
216 | LTT_EVENT_PAGE_FAULT_NOSEM_ENTRY.setParent(Channels.LTT_CHANNEL_KERNEL); | |
217 | LTT_EVENT_PAGE_FAULT_NOSEM_ENTRY.getChildren().add(Fields.LTT_FIELD_TRAP_ID); | |
5d10d135 ASL |
218 | LTT_EVENT_PAGE_FAULT_NOSEM_ENTRY.stateTransition = true; |
219 | ||
0821f854 FC |
220 | // PAGE_FAULT_NOSEM_EXIT |
221 | LTT_EVENT_PAGE_FAULT_NOSEM_EXIT.setParent(Channels.LTT_CHANNEL_KERNEL); | |
222 | LTT_EVENT_PAGE_FAULT_NOSEM_EXIT.getChildren().add(Fields.LTT_FIELD_TRAP_ID); | |
5d10d135 ASL |
223 | LTT_EVENT_PAGE_FAULT_NOSEM_EXIT.stateTransition = true; |
224 | ||
0821f854 | 225 | // IRQ_ENTRY also receives fields kernel_mode, ip and handler (??) |
5d10d135 ASL |
226 | LTT_EVENT_IRQ_ENTRY.setParent(Channels.LTT_CHANNEL_KERNEL); |
227 | LTT_EVENT_IRQ_ENTRY.getChildren().add(Fields.LTT_FIELD_IRQ_ID); | |
228 | LTT_EVENT_IRQ_ENTRY.stateTransition = true; | |
229 | ||
0821f854 | 230 | // IRQ_EXIT |
5d10d135 ASL |
231 | LTT_EVENT_IRQ_EXIT.setParent(Channels.LTT_CHANNEL_KERNEL); |
232 | LTT_EVENT_IRQ_EXIT.stateTransition = true; | |
233 | ||
0821f854 | 234 | // SOFT_IRQ_RAISE |
5d10d135 | 235 | LTT_EVENT_SOFT_IRQ_RAISE.setParent(Channels.LTT_CHANNEL_KERNEL); |
0821f854 | 236 | LTT_EVENT_SOFT_IRQ_RAISE.getChildren().add(Fields.LTT_FIELD_SOFT_IRQ_ID); |
5d10d135 ASL |
237 | LTT_EVENT_SOFT_IRQ_RAISE.stateTransition = true; |
238 | ||
0821f854 | 239 | // SOFT_IRQ_ENTRY |
5d10d135 | 240 | LTT_EVENT_SOFT_IRQ_ENTRY.setParent(Channels.LTT_CHANNEL_KERNEL); |
0821f854 | 241 | LTT_EVENT_SOFT_IRQ_ENTRY.getChildren().add(Fields.LTT_FIELD_SOFT_IRQ_ID); |
5d10d135 ASL |
242 | LTT_EVENT_SOFT_IRQ_ENTRY.stateTransition = true; |
243 | ||
0821f854 | 244 | // SOFT_IRQ_EXIT |
5d10d135 ASL |
245 | LTT_EVENT_SOFT_IRQ_EXIT.setParent(Channels.LTT_CHANNEL_KERNEL); |
246 | LTT_EVENT_SOFT_IRQ_EXIT.stateTransition = true; | |
247 | ||
0821f854 | 248 | // SCHED_SCHEDULE |
5d10d135 | 249 | LTT_EVENT_SCHED_SCHEDULE.setParent(Channels.LTT_CHANNEL_KERNEL); |
0821f854 FC |
250 | LTT_EVENT_SCHED_SCHEDULE.getChildren().add(Fields.LTT_FIELD_PREV_PID); |
251 | LTT_EVENT_SCHED_SCHEDULE.getChildren().add(Fields.LTT_FIELD_NEXT_PID); | |
252 | LTT_EVENT_SCHED_SCHEDULE.getChildren().add(Fields.LTT_FIELD_PREV_STATE); | |
5d10d135 ASL |
253 | LTT_EVENT_SCHED_SCHEDULE.stateTransition = true; |
254 | ||
0821f854 | 255 | // PROCESS_FORK |
5d10d135 | 256 | LTT_EVENT_PROCESS_FORK.setParent(Channels.LTT_CHANNEL_KERNEL); |
0821f854 FC |
257 | LTT_EVENT_PROCESS_FORK.getChildren().add(Fields.LTT_FIELD_PARENT_PID); |
258 | LTT_EVENT_PROCESS_FORK.getChildren().add(Fields.LTT_FIELD_CHILD_PID); | |
259 | LTT_EVENT_PROCESS_FORK.getChildren().add(Fields.LTT_FIELD_CHILD_TGID); | |
5d10d135 ASL |
260 | LTT_EVENT_PROCESS_FORK.stateTransition = true; |
261 | ||
0821f854 | 262 | // KTHREAD_CREATE |
5d10d135 ASL |
263 | LTT_EVENT_KTHREAD_CREATE.setParent(Channels.LTT_CHANNEL_KERNEL); |
264 | LTT_EVENT_KTHREAD_CREATE.getChildren().add(Fields.LTT_FIELD_PID); | |
265 | LTT_EVENT_KTHREAD_CREATE.stateTransition = true; | |
266 | ||
0821f854 | 267 | // PROCESS_EXIT |
5d10d135 ASL |
268 | LTT_EVENT_PROCESS_EXIT.setParent(Channels.LTT_CHANNEL_KERNEL); |
269 | LTT_EVENT_PROCESS_EXIT.getChildren().add(Fields.LTT_FIELD_PID); | |
270 | LTT_EVENT_PROCESS_EXIT.stateTransition = true; | |
271 | ||
0821f854 | 272 | // PROCESS_FREE |
5d10d135 ASL |
273 | LTT_EVENT_PROCESS_FREE.setParent(Channels.LTT_CHANNEL_KERNEL); |
274 | LTT_EVENT_PROCESS_FREE.getChildren().add(Fields.LTT_FIELD_PID); | |
275 | LTT_EVENT_PROCESS_FREE.stateTransition = true; | |
276 | ||
0821f854 | 277 | // EVENT_EXEC |
5d10d135 ASL |
278 | LTT_EVENT_EXEC.setParent(Channels.LTT_CHANNEL_FS); |
279 | LTT_EVENT_EXEC.getChildren().add(Fields.LTT_FIELD_FILENAME); | |
280 | LTT_EVENT_EXEC.stateTransition = true; | |
281 | ||
0821f854 | 282 | // EVENT_PROCESS_STATE |
5d10d135 ASL |
283 | LTT_EVENT_PROCESS_STATE.setParent(Channels.LTT_CHANNEL_TASK_STATE); |
284 | LTT_EVENT_PROCESS_STATE.getChildren().add(Fields.LTT_FIELD_PID); | |
0821f854 | 285 | LTT_EVENT_PROCESS_STATE.getChildren().add(Fields.LTT_FIELD_PARENT_PID); |
5d10d135 ASL |
286 | LTT_EVENT_PROCESS_STATE.getChildren().add(Fields.LTT_FIELD_NAME); |
287 | LTT_EVENT_PROCESS_STATE.getChildren().add(Fields.LTT_FIELD_TYPE); | |
288 | LTT_EVENT_PROCESS_STATE.getChildren().add(Fields.LTT_FIELD_MODE); | |
289 | LTT_EVENT_PROCESS_STATE.getChildren().add(Fields.LTT_FIELD_SUBMODE); | |
290 | LTT_EVENT_PROCESS_STATE.getChildren().add(Fields.LTT_FIELD_STATUS); | |
291 | LTT_EVENT_PROCESS_STATE.getChildren().add(Fields.LTT_FIELD_TGID); | |
292 | LTT_EVENT_PROCESS_STATE.stateTransition = true; | |
293 | ||
0821f854 FC |
294 | // STATEDUMP_END |
295 | LTT_EVENT_STATEDUMP_END.setParent(Channels.LTT_CHANNEL_GLOBAL_STATE); | |
5d10d135 ASL |
296 | LTT_EVENT_STATEDUMP_END.stateTransition = true; |
297 | ||
0821f854 FC |
298 | // FUNCTION_ENTRY |
299 | LTT_EVENT_FUNCTION_ENTRY.setParent(Channels.LTT_CHANNEL_USERSPACE); | |
300 | LTT_EVENT_FUNCTION_ENTRY.getChildren().add(Fields.LTT_FIELD_THIS_FN); | |
301 | LTT_EVENT_FUNCTION_ENTRY.getChildren().add(Fields.LTT_FIELD_CALL_SITE); | |
302 | LTT_EVENT_FUNCTION_ENTRY.stateTransition = true; | |
5d10d135 | 303 | |
0821f854 FC |
304 | // FUNCTION_EXIT |
305 | LTT_EVENT_FUNCTION_EXIT.setParent(Channels.LTT_CHANNEL_USERSPACE); | |
306 | LTT_EVENT_FUNCTION_EXIT.getChildren().add(Fields.LTT_FIELD_THIS_FN); | |
307 | LTT_EVENT_FUNCTION_EXIT.getChildren().add(Fields.LTT_FIELD_CALL_SITE); | |
308 | LTT_EVENT_FUNCTION_EXIT.stateTransition = true; | |
309 | ||
310 | // THREAD_BRAND | |
311 | LTT_EVENT_THREAD_BRAND.setParent(Channels.LTT_CHANNEL_USERSPACE); | |
312 | LTT_EVENT_THREAD_BRAND.getChildren().add(Fields.LTT_FIELD_NAME); | |
313 | LTT_EVENT_THREAD_BRAND.stateTransition = true; | |
314 | ||
315 | // REQUEST_ISSUE | |
5d10d135 ASL |
316 | LTT_EVENT_REQUEST_ISSUE.setParent(Channels.LTT_CHANNEL_BLOCK); |
317 | LTT_EVENT_REQUEST_ISSUE.getChildren().add(Fields.LTT_FIELD_MAJOR); | |
318 | LTT_EVENT_REQUEST_ISSUE.getChildren().add(Fields.LTT_FIELD_MINOR); | |
319 | LTT_EVENT_REQUEST_ISSUE.getChildren().add(Fields.LTT_FIELD_OPERATION); | |
5d10d135 ASL |
320 | LTT_EVENT_REQUEST_ISSUE.stateTransition = true; |
321 | ||
0821f854 | 322 | // REQUEST_COMPLETE |
5d10d135 | 323 | LTT_EVENT_REQUEST_COMPLETE.setParent(Channels.LTT_CHANNEL_BLOCK); |
0821f854 FC |
324 | LTT_EVENT_REQUEST_COMPLETE.getChildren().add(Fields.LTT_FIELD_MAJOR); |
325 | LTT_EVENT_REQUEST_COMPLETE.getChildren().add(Fields.LTT_FIELD_MINOR); | |
326 | LTT_EVENT_REQUEST_COMPLETE.getChildren().add(Fields.LTT_FIELD_OPERATION); | |
5d10d135 ASL |
327 | LTT_EVENT_REQUEST_COMPLETE.stateTransition = true; |
328 | ||
0821f854 FC |
329 | // LIST_INTERRUPT |
330 | LTT_EVENT_LIST_INTERRUPT.setParent(Channels.LTT_CHANNEL_IRQ_STATE); | |
331 | LTT_EVENT_LIST_INTERRUPT.getChildren().add(Fields.LTT_FIELD_ACTION); | |
332 | LTT_EVENT_LIST_INTERRUPT.getChildren().add(Fields.LTT_FIELD_IRQ_ID); | |
333 | LTT_EVENT_LIST_INTERRUPT.stateTransition = true; | |
5d10d135 | 334 | |
0821f854 FC |
335 | // SYS_CALL_TABLE |
336 | LTT_EVENT_SYS_CALL_TABLE.setParent(Channels.LTT_CHANNEL_SYSCALL_STATE); | |
5d10d135 | 337 | LTT_EVENT_SYS_CALL_TABLE.getChildren().add(Fields.LTT_FIELD_ID); |
0821f854 | 338 | LTT_EVENT_SYS_CALL_TABLE.getChildren().add(Fields.LTT_FIELD_ADDRESS); |
5d10d135 ASL |
339 | LTT_EVENT_SYS_CALL_TABLE.getChildren().add(Fields.LTT_FIELD_SYMBOL); |
340 | LTT_EVENT_SYS_CALL_TABLE.stateTransition = true; | |
341 | ||
0821f854 | 342 | // SOFTIRQ_VEC |
5d10d135 ASL |
343 | LTT_EVENT_SOFTIRQ_VEC.setParent(Channels.LTT_CHANNEL_SOFTIRQ_STATE); |
344 | LTT_EVENT_SOFTIRQ_VEC.getChildren().add(Fields.LTT_FIELD_ID); | |
345 | LTT_EVENT_SOFTIRQ_VEC.getChildren().add(Fields.LTT_FIELD_ADDRESS); | |
346 | LTT_EVENT_SOFTIRQ_VEC.getChildren().add(Fields.LTT_FIELD_SYMBOL); | |
347 | LTT_EVENT_SOFTIRQ_VEC.stateTransition = true; | |
0821f854 FC |
348 | |
349 | // KPROBE_TABLE | |
350 | LTT_EVENT_KPROBE_TABLE.setParent(Channels.LTT_CHANNEL_KPROBE_STATE); | |
351 | LTT_EVENT_KPROBE_TABLE.getChildren().add(Fields.LTT_FIELD_IP); | |
352 | LTT_EVENT_KPROBE_TABLE.getChildren().add(Fields.LTT_FIELD_SYMBOL); | |
353 | LTT_EVENT_KPROBE_TABLE.stateTransition = true; | |
354 | ||
355 | // KPROBE | |
356 | LTT_EVENT_KPROBE.setParent(Channels.LTT_CHANNEL_KERNEL); | |
357 | LTT_EVENT_KPROBE.getChildren().add(Fields.LTT_FIELD_IP); | |
358 | // LTT_EVENT_KPROBE.getChildren().add(Fields.LTT_FIELD_SYMBOL); | |
359 | LTT_EVENT_KPROBE.stateTransition = true; | |
5d10d135 ASL |
360 | } |
361 | ||
0821f854 | 362 | } |
5d10d135 ASL |
363 | |
364 | public enum Fields { | |
365 | LTT_FIELD_SYSCALL_ID("syscall_id"), /* */ | |
366 | LTT_FIELD_TRAP_ID("trap_id"), /* */ | |
367 | LTT_FIELD_IRQ_ID("irq_id"), /* */ | |
368 | LTT_FIELD_SOFT_IRQ_ID("softirq_id"), /* */ | |
369 | LTT_FIELD_PREV_PID("prev_pid"), /* */ | |
370 | LTT_FIELD_NEXT_PID("next_pid"), /* */ | |
371 | LTT_FIELD_PREV_STATE("prev_state"), /* */ | |
372 | LTT_FIELD_PARENT_PID("parent_pid"), /* */ | |
373 | LTT_FIELD_CHILD_PID("child_pid"), /* */ | |
374 | LTT_FIELD_PID("pid"), /* */ | |
375 | LTT_FIELD_TGID("tgid"), /* */ | |
376 | LTT_FIELD_CHILD_TGID("child_tgid"), /* */ | |
377 | LTT_FIELD_FILENAME("filename"), /* */ | |
378 | LTT_FIELD_NAME("name"), /* */ | |
379 | LTT_FIELD_TYPE("type"), /* */ | |
380 | LTT_FIELD_MODE("mode"), /* */ | |
381 | LTT_FIELD_SUBMODE("submode"), /* */ | |
382 | LTT_FIELD_STATUS("status"), /* */ | |
383 | LTT_FIELD_THIS_FN("this_fn"), /* */ | |
384 | LTT_FIELD_CALL_SITE("call_site"), /* */ | |
385 | LTT_FIELD_MAJOR("major"), /* */ | |
386 | LTT_FIELD_MINOR("minor"), /* */ | |
387 | LTT_FIELD_OPERATION("direction"), /* */ | |
388 | LTT_FIELD_ACTION("action"), /* */ | |
389 | LTT_FIELD_ID("id"), /* */ | |
390 | LTT_FIELD_ADDRESS("address"), /* */ | |
391 | LTT_FIELD_SYMBOL("symbol"), /* */ | |
392 | LTT_FIELD_IP("ip"); /* */ | |
393 | ||
394 | private final String inName; | |
395 | ||
396 | private Fields(String name) { | |
397 | this.inName = name; | |
398 | } | |
399 | ||
400 | public String getInName() { | |
401 | return this.inName; | |
402 | } | |
0821f854 FC |
403 | |
404 | } | |
5d10d135 ASL |
405 | |
406 | public enum CpuMode { | |
407 | LTTV_CPU_UNKNOWN("unknown"), /* */ | |
408 | LTTV_CPU_IDLE("idle"), /* */ | |
409 | LTTV_CPU_BUSY("busy"), /* */ | |
410 | LTTV_CPU_IRQ("irq"), /* */ | |
411 | LTTV_CPU_SOFT_IRQ("softirq"), /* */ | |
412 | LTTV_CPU_TRAP("trap"); /* */ | |
413 | ||
0821f854 | 414 | private final String inName; |
5d10d135 ASL |
415 | |
416 | private CpuMode(String name) { | |
417 | this.inName = name; | |
418 | } | |
419 | ||
420 | public String getInName() { | |
421 | return this.inName; | |
422 | } | |
423 | ||
424 | } | |
425 | ||
426 | public enum IRQMode { | |
427 | LTTV_IRQ_UNKNOWN("unknown"), /* */ | |
428 | LTTV_IRQ_IDLE("idle"), /* */ | |
429 | LTTV_IRQ_BUSY("busy"); /* */ | |
430 | ||
0821f854 | 431 | private final String inName; |
5d10d135 ASL |
432 | |
433 | private IRQMode(String name) { | |
434 | this.inName = name; | |
435 | } | |
436 | ||
437 | public String getInName() { | |
438 | return this.inName; | |
439 | } | |
440 | ||
441 | } | |
442 | ||
443 | public enum SoftIRQMode { | |
444 | LTTV_SOFT_IRQ_UNKNOWN("unknown"), /* */ | |
445 | LTTV_SOFT_IRQ_IDLE("idle"), /* */ | |
446 | LTTV_SOFT_IRQ_PENDING("pending"), /* */ | |
447 | LTTV_SOFT_IRQ_BUSY("busy"); /* */ | |
448 | ||
0821f854 | 449 | private final String inName; |
5d10d135 ASL |
450 | |
451 | private SoftIRQMode(String name) { | |
452 | this.inName = name; | |
453 | } | |
454 | ||
455 | public String getInName() { | |
456 | return this.inName; | |
457 | } | |
458 | ||
459 | } | |
460 | ||
461 | public enum BdevMode { | |
462 | LTTV_BDEV_UNKNOWN("unknown"), /* */ | |
463 | LTTV_BDEV_IDLE("idle"), /* */ | |
464 | LTTV_BDEV_BUSY_READING("busy_reading"), /* */ | |
465 | LTTV_BDEV_BUSY_WRITING("busy_writing"); /* */ | |
466 | ||
0821f854 | 467 | private final String inName; |
5d10d135 ASL |
468 | |
469 | private BdevMode(String name) { | |
470 | this.inName = name; | |
471 | } | |
472 | ||
473 | public String getInName() { | |
474 | return this.inName; | |
475 | } | |
476 | ||
477 | } | |
478 | ||
479 | public enum TrapMode { | |
480 | LTTV_TRAP_UNKNOWN("unknown"), /* */ | |
481 | LTTV_TRAP_IDLE("idle"), /* */ | |
482 | LTTV_TRAP_BUSY("busy"); /* */ | |
483 | ||
0821f854 | 484 | private final String inName; |
5d10d135 ASL |
485 | |
486 | private TrapMode(String name) { | |
487 | this.inName = name; | |
488 | } | |
489 | ||
490 | public String getInName() { | |
491 | return this.inName; | |
492 | } | |
493 | ||
494 | } | |
0821f854 | 495 | |
5d10d135 ASL |
496 | public enum ProcessType { |
497 | LTTV_STATE_USER_THREAD("USER_THREAD"), /* */ | |
498 | LTTV_STATE_KERNEL_THREAD("KERNEL_THREAD"); /* */ | |
499 | ||
0821f854 | 500 | private final String inName; |
5d10d135 ASL |
501 | |
502 | private ProcessType(String name) { | |
503 | this.inName = name; | |
504 | } | |
505 | ||
506 | public String getInName() { | |
507 | return this.inName; | |
508 | } | |
509 | ||
510 | } | |
511 | ||
512 | public enum ProcessStatus { | |
0821f854 FC |
513 | LTTV_STATE_UNNAMED("UNNAMED"), /* */ |
514 | LTTV_STATE_WAIT_FORK("WAIT_FORK"), /* */ | |
5d10d135 ASL |
515 | LTTV_STATE_WAIT_CPU("WAIT_CPU"), /* */ |
516 | LTTV_STATE_EXIT("EXIT"), /* */ | |
517 | LTTV_STATE_ZOMBIE("ZOMBIE"), /* */ | |
518 | LTTV_STATE_WAIT("WAIT"), /* */ | |
519 | LTTV_STATE_RUN("RUN"), /* */ | |
520 | LTTV_STATE_DEAD("DEAD"); /* */ | |
521 | ||
0821f854 | 522 | private final String inName; |
5d10d135 ASL |
523 | |
524 | private ProcessStatus(String name) { | |
525 | this.inName = name; | |
526 | } | |
527 | ||
528 | public String getInName() { | |
529 | return this.inName; | |
530 | } | |
531 | ||
532 | } | |
533 | ||
534 | public enum ExecutionSubMode { | |
535 | LTTV_STATE_SUBMODE_UNKNOWN("UNKNOWN"), /* */ | |
536 | LTTV_STATE_SUBMODE_NONE("NONE"); /* */ | |
537 | ||
0821f854 | 538 | private final String inName; |
5d10d135 ASL |
539 | |
540 | private ExecutionSubMode(String name) { | |
541 | this.inName = name; | |
542 | } | |
543 | ||
544 | public String getInName() { | |
545 | return this.inName; | |
546 | } | |
547 | ||
548 | } | |
549 | ||
550 | public enum ExecutionMode { | |
551 | LTTV_STATE_MODE_UNKNOWN("MODE_UNKNOWN"), /* */ | |
552 | LTTV_STATE_USER_MODE("USER_MODE"), /* */ | |
553 | LTTV_STATE_SYSCALL("SYSCALL"), /* */ | |
554 | LTTV_STATE_TRAP("TRAP"), /* */ | |
555 | LTTV_STATE_IRQ("IRQ"), /* */ | |
556 | LTTV_STATE_SOFT_IRQ("SOFTIRQ"); /* */ | |
557 | ||
0821f854 | 558 | private final String inName; |
5d10d135 ASL |
559 | |
560 | private ExecutionMode(String name) { | |
561 | this.inName = name; | |
562 | } | |
563 | ||
564 | public String getInName() { | |
565 | return this.inName; | |
566 | } | |
567 | ||
568 | } | |
569 | ||
570 | public enum GenStates { | |
571 | LTTV_STATE_TRACEFILES("tracefiles"), /* */ | |
572 | LTTV_STATE_PROCESSES("processes"), /* */ | |
573 | LTTV_STATE_PROCESS("process"), /* */ | |
574 | LTTV_STATE_RUNNING_PROCESS("running_process"), /* */ | |
575 | LTTV_STATE_EVENT("event"), /* */ | |
576 | LTTV_STATE_SAVED_STATES("saved states"), /* */ | |
577 | LTTV_STATE_SAVED_STATES_TIME("saved states time"), /* */ | |
578 | LTTV_STATE_TIME("time"), /* */ | |
579 | LTTV_STATE_HOOKS("saved state hooks"), /* */ | |
580 | LTTV_STATE_NAME_TABLES("name tables"), /* */ | |
581 | LTTV_STATE_TRACE_STATE_USE_COUNT("trace_state_use_count"), /* */ | |
582 | LTTV_STATE_RESOURCE_CPUS("cpu count"), /* */ | |
583 | LTTV_STATE_RESOURCE_IRQS("irq resource states"), /* */ | |
584 | LTTV_STATE_RESOURCE_SOFT_IRQS("soft irq resource states"), /* */ | |
585 | LTTV_STATE_RESOURCE_TRAPS("trap resource states"), /* */ | |
586 | LTTV_STATE_RESOURCE_BLKDEVS("blkdevs resource states"); /* */ | |
587 | ||
0821f854 | 588 | private final String inName; |
5d10d135 ASL |
589 | |
590 | private GenStates(String name) { | |
591 | this.inName = name; | |
592 | } | |
593 | ||
594 | public String getInName() { | |
595 | return this.inName; | |
596 | } | |
597 | ||
598 | } | |
599 | ||
600 | // ======================================================================== | |
601 | // Methods | |
602 | // ======================================================================= | |
0821f854 | 603 | |
5d10d135 | 604 | /** |
0821f854 | 605 | * Return the map from event name strings to Events instances |
5d10d135 ASL |
606 | * |
607 | * @return the eventstrmap | |
608 | */ | |
609 | public HashMap<String, Events> getEventStrmap() { | |
610 | return eventStrMap; | |
611 | } | |
612 | ||
613 | /** | |
0821f854 FC |
614 | * Return the map from state transition event name strings to Events instances |
615 | * State transition events are the subset of events that have the attribute stateTransition == True. | |
5d10d135 ASL |
616 | * |
617 | * @return the stateTransEventMap | |
618 | */ | |
619 | public HashMap<String, Events> getStateTransEventMap() { | |
620 | return stateTransEventMap; | |
621 | } | |
622 | ||
623 | /** | |
0821f854 | 624 | * @return the mapping from int (0..255) to system call names |
5d10d135 ASL |
625 | */ |
626 | public String[] getSyscallNames() { | |
627 | return syscall_names; | |
628 | } | |
629 | ||
630 | /** | |
0821f854 | 631 | * @return the mapping from int (0..255) to trap names |
5d10d135 ASL |
632 | */ |
633 | public String[] getTrapNames() { | |
634 | return trap_names; | |
635 | } | |
636 | ||
637 | /** | |
0821f854 | 638 | * @return the mapping from int (0..255) to IRQ names |
5d10d135 ASL |
639 | */ |
640 | public String[] getIrqNames() { | |
641 | return irq_names; | |
642 | } | |
643 | ||
644 | /** | |
0821f854 | 645 | * @return the mapping from int (0..31) to soft IRQ names |
5d10d135 ASL |
646 | */ |
647 | public String[] getSoftIrqNames() { | |
648 | return soft_irq_names; | |
649 | } | |
650 | ||
651 | } |