Commit | Line | Data |
---|---|---|
03c71d1e 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 | |
11 | *******************************************************************************/ | |
12 | package org.eclipse.linuxtools.lttng.tests.state.handlers.before; | |
13 | ||
14 | import org.eclipse.linuxtools.lttng.TraceDebug; | |
15 | import org.eclipse.linuxtools.lttng.event.LttngEvent; | |
86de1b08 | 16 | import org.eclipse.linuxtools.lttng.state.StateStrings.Events; |
03c71d1e ASL |
17 | import org.eclipse.linuxtools.lttng.state.StateStrings.ExecutionMode; |
18 | import org.eclipse.linuxtools.lttng.state.StateStrings.ExecutionSubMode; | |
19 | import org.eclipse.linuxtools.lttng.state.StateStrings.Fields; | |
86de1b08 | 20 | import org.eclipse.linuxtools.lttng.state.evProcessor.IEventProcessing; |
03c71d1e ASL |
21 | import org.eclipse.linuxtools.lttng.state.model.LttngExecutionState; |
22 | import org.eclipse.linuxtools.lttng.state.model.LttngProcessState; | |
23 | import org.eclipse.linuxtools.lttng.state.model.LttngTraceState; | |
24 | import org.eclipse.linuxtools.lttng.tests.state.handlers.AbsStateUpdate; | |
25 | ||
26 | /** | |
27 | * Process the system call entry event | |
28 | * | |
29 | * @author alvaro | |
30 | * | |
31 | */ | |
32 | class StateBeforeUpdateHandlers { | |
33 | ||
86de1b08 | 34 | final IEventProcessing getSyscallEntryHandler() { |
03c71d1e ASL |
35 | AbsStateUpdate handler = new AbsStateUpdate() { |
36 | ||
86de1b08 ASL |
37 | private Events eventType = Events.LTT_EVENT_SYSCALL_ENTRY; |
38 | ||
03c71d1e ASL |
39 | // @Override |
40 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
41 | // TraceDebug.debug("Before event called"); | |
42 | // | |
43 | Long cpu = trcEvent.getCpuId(); | |
44 | ||
45 | // No syscall_entry update for initialization process | |
46 | LttngProcessState process = traceSt.getRunning_process().get( | |
47 | cpu); | |
48 | ||
49 | pid = process.getPid(); | |
50 | if (pid == 0L) { | |
51 | return true; | |
52 | } | |
53 | ||
54 | // Get the expected event field | |
55 | Long syscall = getAFieldLong(trcEvent, traceSt, | |
56 | Fields.LTT_FIELD_SYSCALL_ID); | |
57 | if (syscall == null) { | |
58 | TraceDebug.debug("Syscall Field not found in Event: " | |
59 | + trcEvent.getMarkerName()); | |
60 | return true; | |
61 | } | |
62 | ||
63 | String submode = traceSt.getSyscall_names().get(syscall); | |
64 | ||
65 | if (submode == null) { | |
66 | TraceDebug.debug("Submode not found in Event"); | |
67 | submode = ExecutionSubMode.LTTV_STATE_SUBMODE_UNKNOWN | |
68 | .getInName(); | |
69 | } | |
70 | ||
71 | exState = new LttngExecutionState(); | |
72 | exState.setExec_mode(ExecutionMode.LTTV_STATE_SYSCALL); | |
73 | exState.setExec_submode(submode); | |
74 | exState.setEntry_Time(trcEvent.getTimestamp().getValue()); | |
75 | exState.setChange_Time(trcEvent.getTimestamp().getValue()); | |
76 | exState.setCum_cpu_time(0L); | |
77 | ||
78 | return false; | |
79 | } | |
86de1b08 ASL |
80 | |
81 | // @Override | |
82 | public Events getEventHandleType() { | |
83 | return eventType; | |
84 | } | |
03c71d1e ASL |
85 | }; |
86 | return handler; | |
87 | } | |
88 | ||
86de1b08 | 89 | final IEventProcessing getsySyscallExitHandler() { |
03c71d1e ASL |
90 | AbsStateUpdate handler = new AbsStateUpdate() { |
91 | ||
86de1b08 ASL |
92 | private Events eventType = Events.LTT_EVENT_SYSCALL_EXIT; |
93 | ||
03c71d1e ASL |
94 | // @Override |
95 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
96 | ||
97 | Long cpu = trcEvent.getCpuId(); | |
98 | LttngProcessState process = traceSt.getRunning_process().get( | |
99 | cpu); | |
100 | ||
101 | /* There can be no system call from PID 0 : unknown state */ | |
102 | pid = process.getPid(); | |
103 | if (pid == 0L) { | |
104 | return true; | |
105 | } | |
106 | ||
107 | // pop_state(cpu, StateStrings.ExecutionMode.LTTV_STATE_SYSCALL, | |
108 | // traceSt, trcEvent.getTimestamp()); | |
109 | return false; | |
110 | ||
111 | } | |
86de1b08 ASL |
112 | |
113 | // @Override | |
114 | public Events getEventHandleType() { | |
115 | return eventType; | |
116 | } | |
03c71d1e ASL |
117 | }; |
118 | return handler; | |
119 | } | |
120 | ||
121 | /** | |
122 | * Update stacks related to the parsing of an LttngEvent | |
123 | * | |
124 | * @return | |
125 | */ | |
86de1b08 | 126 | final IEventProcessing getTrapEntryHandler() { |
03c71d1e ASL |
127 | AbsStateUpdate handler = new AbsStateUpdate() { |
128 | ||
86de1b08 ASL |
129 | private Events eventType = Events.LTT_EVENT_TRAP_ENTRY; |
130 | ||
03c71d1e ASL |
131 | // @Override |
132 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
133 | // Long cpu = trcEvent.getCpuId(); | |
134 | // | |
135 | // Long trap = getAFieldLong(trcEvent, traceSt, | |
136 | // Fields.LTT_FIELD_TRAP_ID); | |
137 | // if (trap == null) { | |
138 | // return true; | |
139 | // } | |
140 | // | |
141 | // String submode = traceSt.getSyscall_names() | |
142 | // .get(trap); | |
143 | // | |
144 | // if (submode == null) { | |
145 | // submode = ExecutionSubMode.LTTV_STATE_SUBMODE_UNKNOWN | |
146 | // .getInName(); | |
147 | // } | |
148 | // | |
149 | // /* update process state */ | |
150 | // push_state(cpu, StateStrings.ExecutionMode.LTTV_STATE_TRAP, | |
151 | // submode, trcEvent.getTimestamp(), traceSt); | |
152 | // | |
153 | // /* update cpu status */ | |
154 | // LTTngCPUState cpust = traceSt.getCpu_states().get(cpu); | |
155 | // cpu_push_mode(cpust, StateStrings.CpuMode.LTTV_CPU_TRAP); | |
156 | // cpust.setLast_trap(trap); /* update trap status */ | |
157 | // | |
158 | // // update Trap State | |
159 | // LttngTrapState trap_state = traceSt.getTrap_states().get( | |
160 | // trap); | |
161 | // trap_state.incrementRunning(); | |
162 | ||
163 | return false; | |
164 | ||
165 | } | |
86de1b08 ASL |
166 | |
167 | // @Override | |
168 | public Events getEventHandleType() { | |
169 | return eventType; | |
170 | } | |
03c71d1e ASL |
171 | }; |
172 | return handler; | |
173 | } | |
174 | ||
175 | /** | |
176 | * | |
177 | * @return | |
178 | */ | |
86de1b08 | 179 | final IEventProcessing getTrapExitHandler() { |
03c71d1e ASL |
180 | AbsStateUpdate handler = new AbsStateUpdate() { |
181 | ||
86de1b08 ASL |
182 | private Events eventType = Events.LTT_EVENT_TRAP_EXIT; |
183 | ||
03c71d1e ASL |
184 | // @Override |
185 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
186 | // | |
187 | // Long cpu = trcEvent.getCpuId(); | |
188 | // LTTngCPUState cpust = traceSt.getCpu_states().get(cpu); | |
189 | // Long trap = cpust.getLast_trap(); | |
190 | // | |
191 | // pop_state(cpu, ExecutionMode.LTTV_STATE_TRAP, traceSt, | |
192 | // trcEvent | |
193 | // .getTimestamp()); | |
194 | // | |
195 | // /* update cpu status */ | |
196 | // cpu_pop_mode(cpust); | |
197 | // | |
198 | // /* update trap status */ | |
199 | // if (trap != -1L) { | |
200 | // traceSt.getTrap_states().get(trap).decrementRunning(); | |
201 | // } | |
202 | return false; | |
203 | ||
204 | } | |
86de1b08 ASL |
205 | |
206 | // @Override | |
207 | public Events getEventHandleType() { | |
208 | return eventType; | |
209 | } | |
03c71d1e ASL |
210 | }; |
211 | return handler; | |
212 | } | |
213 | ||
214 | /** | |
215 | * | |
216 | * @return | |
217 | */ | |
86de1b08 | 218 | final IEventProcessing getIrqEntryHandler() { |
03c71d1e ASL |
219 | AbsStateUpdate handler = new AbsStateUpdate() { |
220 | ||
86de1b08 ASL |
221 | private Events eventType = Events.LTT_EVENT_IRQ_ENTRY; |
222 | ||
03c71d1e ASL |
223 | // @Override |
224 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
225 | // | |
226 | // Long cpu = trcEvent.getCpuId(); | |
227 | // | |
228 | // Long irq = getAFieldLong(trcEvent, traceSt, | |
229 | // Fields.LTT_FIELD_IRQ_ID); | |
230 | // if (irq == null) { | |
231 | // return true; | |
232 | // } | |
233 | // | |
234 | // String submode; | |
235 | // submode = traceSt.getIrq_names().get(irq); | |
236 | // | |
237 | // if (submode == null) { | |
238 | // submode = | |
239 | // ExecutionSubMode.LTTV_STATE_SUBMODE_UNKNOWN.getInName(); | |
240 | // } | |
241 | // | |
242 | // /* | |
243 | // * Do something with the info about being in user or system | |
244 | // mode | |
245 | // * when int? | |
246 | // */ | |
247 | // push_state(cpu, ExecutionMode.LTTV_STATE_IRQ, submode, | |
248 | // trcEvent | |
249 | // .getTimestamp(), traceSt); | |
250 | // | |
251 | // /* update cpu state */ | |
252 | // LTTngCPUState cpust = traceSt.getCpu_states().get(cpu); | |
253 | // cpu_push_mode(cpust, CpuMode.LTTV_CPU_IRQ); /* mode stack */ | |
254 | // cpust.setLast_irq(irq); /* last irq */ | |
255 | // | |
256 | // /* udpate irq state */ | |
257 | // irq_push_mode(traceSt.getIrq_states().get(irq), | |
258 | // IRQMode.LTTV_IRQ_BUSY); | |
259 | return false; | |
260 | ||
261 | } | |
86de1b08 ASL |
262 | |
263 | public Events getEventHandleType() { | |
264 | return eventType; | |
265 | } | |
03c71d1e ASL |
266 | }; |
267 | return handler; | |
268 | } | |
269 | ||
270 | /** | |
271 | * | |
272 | * @return | |
273 | */ | |
86de1b08 | 274 | final IEventProcessing getSoftIrqExitHandler() { |
03c71d1e ASL |
275 | AbsStateUpdate handler = new AbsStateUpdate() { |
276 | ||
86de1b08 ASL |
277 | private Events eventType = Events.LTT_EVENT_SOFT_IRQ_EXIT; |
278 | ||
03c71d1e ASL |
279 | // @Override |
280 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
281 | // | |
282 | // Long cpu = trcEvent.getCpuId(); | |
283 | // LTTngCPUState cpust = traceSt.getCpu_states().get(cpu); | |
284 | // Long softirq = cpust.getLast_soft_irq(); | |
285 | // pop_state(cpu, ExecutionMode.LTTV_STATE_SOFT_IRQ, traceSt, | |
286 | // trcEvent.getTimestamp()); | |
287 | // | |
288 | // /* update softirq status */ | |
289 | // if (softirq != -1) { | |
290 | // LttngSoftIRQState softIrqstate = traceSt | |
291 | // .getSoft_irq_states().get(softirq); | |
292 | // softIrqstate.decrementRunning(); | |
293 | // } | |
294 | // | |
295 | // /* update cpu status */ | |
296 | // cpu_pop_mode(cpust); | |
297 | ||
298 | return false; | |
299 | } | |
86de1b08 ASL |
300 | |
301 | // @Override | |
302 | public Events getEventHandleType() { | |
303 | return eventType; | |
304 | } | |
03c71d1e ASL |
305 | }; |
306 | return handler; | |
307 | } | |
308 | ||
309 | /** | |
310 | * | |
311 | * @return | |
312 | */ | |
86de1b08 | 313 | final IEventProcessing getIrqExitHandler() { |
03c71d1e ASL |
314 | AbsStateUpdate handler = new AbsStateUpdate() { |
315 | ||
86de1b08 ASL |
316 | private Events eventType = Events.LTT_EVENT_IRQ_EXIT; |
317 | ||
03c71d1e ASL |
318 | // @Override |
319 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
320 | // | |
321 | // Long cpu = trcEvent.getCpuId(); | |
322 | // | |
323 | // /* update process state */ | |
324 | // pop_state(cpu, ExecutionMode.LTTV_STATE_IRQ, traceSt, | |
325 | // trcEvent | |
326 | // .getTimestamp()); | |
327 | // | |
328 | // /* update cpu status */ | |
329 | // LTTngCPUState cpust = traceSt.getCpu_states().get(cpu); | |
330 | // cpu_pop_mode(cpust); | |
331 | // | |
332 | // /* update irq status */ | |
333 | // Long last_irq = cpust.getLast_irq(); | |
334 | // if (last_irq != -1L) { | |
335 | // LttngIRQState irq_state = traceSt.getIrq_states().get( | |
336 | // last_irq); | |
337 | // irq_pop_mode(irq_state); | |
338 | // } | |
339 | ||
340 | return false; | |
341 | ||
342 | } | |
86de1b08 ASL |
343 | |
344 | // @Override | |
345 | public Events getEventHandleType() { | |
346 | return eventType; | |
347 | } | |
03c71d1e ASL |
348 | }; |
349 | return handler; | |
350 | } | |
351 | ||
352 | /** | |
353 | * | |
354 | * @return | |
355 | */ | |
86de1b08 | 356 | final IEventProcessing getSoftIrqRaiseHandler() { |
03c71d1e ASL |
357 | AbsStateUpdate handler = new AbsStateUpdate() { |
358 | ||
86de1b08 ASL |
359 | private Events eventType = Events.LTT_EVENT_SOFT_IRQ_RAISE; |
360 | ||
03c71d1e ASL |
361 | // @Override |
362 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
363 | // | |
364 | // // Long cpu = trcEvent.getCpuId(); | |
365 | // | |
366 | // // get event field | |
367 | // Long softirq = getAFieldLong(trcEvent, traceSt, | |
368 | // Fields.LTT_FIELD_SOFT_IRQ_ID); | |
369 | // | |
370 | // if (softirq == null) { | |
371 | // return true; | |
372 | // } | |
373 | // | |
374 | // // String submode; | |
375 | // // String[] softIrqNames = traceSt.getSoft_irq_names(); | |
376 | // // if (softirq < softIrqNames.length) { | |
377 | // // submode = softIrqNames[softirq]; | |
378 | // // } else { | |
379 | // // submode = "softirq " + softirq; | |
380 | // // } | |
381 | // | |
382 | // /* update softirq status */ | |
383 | // /* a soft irq raises are not cumulative */ | |
384 | // LttngSoftIRQState irqState = | |
385 | // traceSt.getSoft_irq_states().get( | |
386 | // softirq); | |
387 | // if (irqState != null) { | |
388 | // irqState.setPending(1L); | |
389 | // } else { | |
390 | // TraceDebug | |
391 | // .debug("unexpected soft irq id value: " + softirq); | |
392 | // } | |
393 | ||
394 | return false; | |
395 | ||
396 | } | |
86de1b08 ASL |
397 | |
398 | // @Override | |
399 | public Events getEventHandleType() { | |
400 | return eventType; | |
401 | } | |
03c71d1e ASL |
402 | }; |
403 | return handler; | |
404 | } | |
405 | ||
406 | /** | |
407 | * | |
408 | * @return | |
409 | */ | |
86de1b08 | 410 | final IEventProcessing getSoftIrqEntryHandler() { |
03c71d1e ASL |
411 | AbsStateUpdate handler = new AbsStateUpdate() { |
412 | ||
86de1b08 ASL |
413 | private Events eventType = Events.LTT_EVENT_SOFT_IRQ_ENTRY; |
414 | ||
03c71d1e ASL |
415 | // @Override |
416 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
417 | // | |
418 | // // obtrain cpu | |
419 | // Long cpu = trcEvent.getCpuId(); | |
420 | // | |
421 | // // get event field | |
422 | // Long softirq = getAFieldLong(trcEvent, traceSt, | |
423 | // Fields.LTT_FIELD_SOFT_IRQ_ID); | |
424 | // | |
425 | // if (softirq == null) { | |
426 | // return true; | |
427 | // } | |
428 | // | |
429 | // // obtain submode | |
430 | // Map<Long, String> softIrqNames = traceSt.getSoft_irq_names(); | |
431 | // String submode = softIrqNames.get(softirq); | |
432 | // if (submode == null) { | |
433 | // submode = "softirq " + softirq; | |
434 | // softIrqNames.put(softirq, submode); | |
435 | // } | |
436 | // | |
437 | // /* update softirq status */ | |
438 | // LttngSoftIRQState irqState = | |
439 | // traceSt.getSoft_irq_states().get( | |
440 | // softirq); | |
441 | // if (irqState != null) { | |
442 | // irqState.decrementPending(); | |
443 | // irqState.incrementRunning(); | |
444 | // } else { | |
445 | // TraceDebug | |
446 | // .debug("unexpected soft irq id value: " + softirq); | |
447 | // } | |
448 | // | |
449 | // /* update cpu state */ | |
450 | // LTTngCPUState cpu_state = traceSt.getCpu_states().get(cpu); | |
451 | // cpu_state.setLast_soft_irq(softirq); | |
452 | // cpu_push_mode(cpu_state, CpuMode.LTTV_CPU_SOFT_IRQ); | |
453 | // | |
454 | // /* update process execution mode state stack */ | |
455 | // push_state(cpu, ExecutionMode.LTTV_STATE_SOFT_IRQ, submode, | |
456 | // trcEvent.getTimestamp(), traceSt); | |
457 | ||
458 | return false; | |
459 | ||
460 | } | |
86de1b08 ASL |
461 | |
462 | // @Override | |
463 | public Events getEventHandleType() { | |
464 | return eventType; | |
465 | } | |
03c71d1e ASL |
466 | }; |
467 | return handler; | |
468 | } | |
469 | ||
470 | /** | |
471 | * Method to handle the event: LTT_EVENT_LIST_INTERRRUPT | |
472 | * | |
473 | * @return | |
474 | */ | |
86de1b08 | 475 | final IEventProcessing getEnumInterruptHandler() { |
03c71d1e ASL |
476 | AbsStateUpdate handler = new AbsStateUpdate() { |
477 | ||
86de1b08 ASL |
478 | private Events eventType = Events.LTT_EVENT_LIST_INTERRUPT; |
479 | ||
03c71d1e ASL |
480 | // @Override |
481 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
482 | // String action = getAFieldString(trcEvent, traceSt, | |
483 | // Fields.LTT_FIELD_ACTION); | |
484 | // Long irq = getAFieldLong(trcEvent, traceSt, | |
485 | // Fields.LTT_FIELD_IRQ_ID); | |
486 | // | |
487 | // Map<Long, String> irq_names = traceSt.getIrq_names(); | |
488 | // | |
489 | // irq_names.put(irq, action); | |
490 | return false; | |
491 | ||
492 | } | |
86de1b08 ASL |
493 | |
494 | // @Override | |
495 | public Events getEventHandleType() { | |
496 | return eventType; | |
497 | } | |
03c71d1e ASL |
498 | }; |
499 | return handler; | |
500 | } | |
501 | ||
502 | /** | |
503 | * Handle the event LTT_EVENT_REQUEST_ISSUE | |
504 | * | |
505 | * @return | |
506 | */ | |
86de1b08 | 507 | final IEventProcessing getBdevRequestIssueHandler() { |
03c71d1e ASL |
508 | AbsStateUpdate handler = new AbsStateUpdate() { |
509 | ||
86de1b08 ASL |
510 | private Events eventType = Events.LTT_EVENT_REQUEST_ISSUE; |
511 | ||
03c71d1e ASL |
512 | // @Override |
513 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
514 | // | |
515 | // // Get Fields | |
516 | // Long major = getAFieldLong(trcEvent, traceSt, | |
517 | // Fields.LTT_FIELD_MAJOR); | |
518 | // Long minor = getAFieldLong(trcEvent, traceSt, | |
519 | // Fields.LTT_FIELD_MINOR); | |
520 | // Long operation = getAFieldLong(trcEvent, traceSt, | |
521 | // Fields.LTT_FIELD_OPERATION); | |
522 | // | |
523 | // // calculate bdevcode | |
524 | // Long devcode = mkdev(major, minor); | |
525 | // | |
526 | // if (devcode == null) { | |
527 | // TraceDebug | |
528 | // .debug("incorrect calcualtion of bdevcode input( major: " | |
529 | // + major | |
530 | // + " minor: " | |
531 | // + minor | |
532 | // + " operation: " + operation); | |
533 | // return true; | |
534 | // } | |
535 | // | |
536 | // Map<Long, LttngBdevState> bdev_states = traceSt | |
537 | // .getBdev_states(); | |
538 | // // Get the instance | |
539 | // LttngBdevState bdevState = bdev_states.get(devcode); | |
540 | // if (bdevState == null) { | |
541 | // bdevState = new LttngBdevState(); | |
542 | // } | |
543 | // | |
544 | // // update the mode in the stack | |
545 | // if (operation == 0L) { | |
546 | // bdevState.getMode_stack().push( | |
547 | // BdevMode.LTTV_BDEV_BUSY_READING); | |
548 | // } else { | |
549 | // bdevState.getMode_stack().push( | |
550 | // BdevMode.LTTV_BDEV_BUSY_WRITING); | |
551 | // } | |
552 | // | |
553 | // // make sure it is included in the set | |
554 | // bdev_states.put(devcode, bdevState); | |
555 | return false; | |
556 | ||
557 | } | |
86de1b08 ASL |
558 | |
559 | // @Override | |
560 | public Events getEventHandleType() { | |
561 | return eventType; | |
562 | } | |
03c71d1e ASL |
563 | }; |
564 | return handler; | |
565 | } | |
566 | ||
567 | /** | |
568 | * <p> | |
569 | * Handling event: LTT_EVENT_REQUEST_COMPLETE | |
570 | * </p> | |
571 | * <p> | |
572 | * FIELDS(LTT_FIELD_MAJOR, LTT_FIELD_MINOR, LTT_FIELD_OPERATION | |
573 | * </p> | |
574 | * | |
575 | * @return | |
576 | */ | |
86de1b08 | 577 | final IEventProcessing getBdevRequestCompleteHandler() { |
03c71d1e ASL |
578 | AbsStateUpdate handler = new AbsStateUpdate() { |
579 | ||
86de1b08 ASL |
580 | private Events eventType = Events.LTT_EVENT_REQUEST_COMPLETE; |
581 | ||
03c71d1e ASL |
582 | // @Override |
583 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
584 | // | |
585 | // // Get Fields | |
586 | // Long major = getAFieldLong(trcEvent, traceSt, | |
587 | // Fields.LTT_FIELD_MAJOR); | |
588 | // Long minor = getAFieldLong(trcEvent, traceSt, | |
589 | // Fields.LTT_FIELD_MINOR); | |
590 | // Long operation = getAFieldLong(trcEvent, traceSt, | |
591 | // Fields.LTT_FIELD_OPERATION); | |
592 | // | |
593 | // // calculate bdevcode | |
594 | // Long devcode = mkdev(major, minor); | |
595 | // | |
596 | // if (devcode == null) { | |
597 | // TraceDebug | |
598 | // .debug("incorrect calcualtion of bdevcode input( major: " | |
599 | // + major | |
600 | // + " minor: " | |
601 | // + minor | |
602 | // + " operation: " + operation); | |
603 | // return true; | |
604 | // } | |
605 | // | |
606 | // Map<Long, LttngBdevState> bdev_states = traceSt | |
607 | // .getBdev_states(); | |
608 | // // Get the instance | |
609 | // LttngBdevState bdevState = bdev_states.get(devcode); | |
610 | // if (bdevState == null) { | |
611 | // bdevState = new LttngBdevState(); | |
612 | // } | |
613 | // | |
614 | // /* update block device */ | |
615 | // bdev_pop_mode(bdevState); | |
616 | ||
617 | return false; | |
618 | ||
619 | } | |
86de1b08 ASL |
620 | |
621 | // @Override | |
622 | public Events getEventHandleType() { | |
623 | return eventType; | |
624 | } | |
03c71d1e ASL |
625 | }; |
626 | return handler; | |
627 | } | |
628 | ||
629 | /** | |
630 | * <p> | |
631 | * Handles event: LTT_EVENT_FUNCTION_ENTRY | |
632 | * </p> | |
633 | * <p> | |
634 | * FIELDS: LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE | |
635 | * </p> | |
636 | * | |
637 | * @return | |
638 | */ | |
86de1b08 | 639 | final IEventProcessing getFunctionEntryHandler() { |
03c71d1e ASL |
640 | AbsStateUpdate handler = new AbsStateUpdate() { |
641 | ||
86de1b08 ASL |
642 | private Events eventType = Events.LTT_EVENT_FUNCTION_ENTRY; |
643 | ||
03c71d1e ASL |
644 | // @Override |
645 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
646 | // Long cpu = trcEvent.getCpuId(); | |
647 | // Long funcptr = getAFieldLong(trcEvent, traceSt, | |
648 | // Fields.LTT_FIELD_THIS_FN); | |
649 | // | |
650 | // push_function(traceSt, funcptr, cpu); | |
651 | return false; | |
652 | ||
653 | } | |
86de1b08 ASL |
654 | |
655 | // @Override | |
656 | public Events getEventHandleType() { | |
657 | return eventType; | |
658 | } | |
03c71d1e ASL |
659 | }; |
660 | return handler; | |
661 | } | |
662 | ||
663 | /** | |
664 | * | |
665 | * @return | |
666 | */ | |
86de1b08 | 667 | final IEventProcessing getFunctionExitHandler() { |
03c71d1e ASL |
668 | AbsStateUpdate handler = new AbsStateUpdate() { |
669 | ||
86de1b08 ASL |
670 | private Events eventType = Events.LTT_EVENT_FUNCTION_EXIT; |
671 | ||
03c71d1e ASL |
672 | // @Override |
673 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
674 | // | |
675 | // Long funcptr = getAFieldLong(trcEvent, traceSt, | |
676 | // Fields.LTT_FIELD_THIS_FN); | |
677 | // | |
678 | // pop_function(traceSt, trcEvent, funcptr); | |
679 | return false; | |
680 | ||
681 | } | |
86de1b08 ASL |
682 | |
683 | // @Override | |
684 | public Events getEventHandleType() { | |
685 | return eventType; | |
686 | } | |
03c71d1e ASL |
687 | }; |
688 | return handler; | |
689 | } | |
690 | ||
691 | /** | |
692 | * <p> | |
693 | * process event: LTT_EVENT_SYS_CALL_TABLE | |
694 | * </p> | |
695 | * <p> | |
696 | * fields: LTT_FIELD_ID, LTT_FIELD_ADDRESS, LTT_FIELD_SYMBOL | |
697 | * </p> | |
698 | * | |
699 | * @return | |
700 | */ | |
86de1b08 | 701 | final IEventProcessing getDumpSyscallHandler() { |
03c71d1e ASL |
702 | AbsStateUpdate handler = new AbsStateUpdate() { |
703 | ||
86de1b08 ASL |
704 | private Events eventType = Events.LTT_EVENT_SYS_CALL_TABLE; |
705 | ||
03c71d1e ASL |
706 | // @Override |
707 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
708 | // // obtain the syscall id | |
709 | // Long id = getAFieldLong(trcEvent, traceSt, | |
710 | // Fields.LTT_FIELD_ID); | |
711 | // | |
712 | // // Long address = getAFieldLong(trcEvent, traceSt, | |
713 | // // Fields.LTT_FIELD_ADDRESS); | |
714 | // | |
715 | // // Obtain the symbol | |
716 | // String symbol = getAFieldString(trcEvent, traceSt, | |
717 | // Fields.LTT_FIELD_SYMBOL); | |
718 | // | |
719 | // // fill the symbol to the sycall_names collection | |
720 | // traceSt.getSyscall_names().put(id, symbol); | |
721 | ||
722 | return false; | |
723 | } | |
86de1b08 ASL |
724 | |
725 | // @Override | |
726 | public Events getEventHandleType() { | |
727 | return eventType; | |
728 | } | |
03c71d1e ASL |
729 | }; |
730 | return handler; | |
731 | } | |
732 | ||
733 | /** | |
734 | * <p> | |
735 | * Handles event: LTT_EVENT_KPROBE_TABLE | |
736 | * </p> | |
737 | * <p> | |
738 | * Fields: LTT_FIELD_IP, LTT_FIELD_SYMBOL | |
739 | * </p> | |
740 | * | |
741 | * @return | |
742 | */ | |
86de1b08 | 743 | final IEventProcessing getDumpKprobeHandler() { |
03c71d1e ASL |
744 | AbsStateUpdate handler = new AbsStateUpdate() { |
745 | ||
86de1b08 ASL |
746 | private Events eventType = Events.LTT_EVENT_KPROBE_TABLE; |
747 | ||
03c71d1e ASL |
748 | // @Override |
749 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
750 | // | |
751 | // Long ip = getAFieldLong(trcEvent, traceSt, | |
752 | // Fields.LTT_FIELD_IP); | |
753 | // String symbol = getAFieldString(trcEvent, traceSt, | |
754 | // Fields.LTT_FIELD_SYMBOL); | |
755 | // | |
756 | // traceSt.getKprobe_table().put(ip, symbol); | |
757 | ||
758 | return false; | |
759 | ||
760 | } | |
86de1b08 ASL |
761 | |
762 | // @Override | |
763 | public Events getEventHandleType() { | |
764 | return eventType; | |
765 | } | |
03c71d1e ASL |
766 | }; |
767 | return handler; | |
768 | } | |
769 | ||
770 | /** | |
771 | * <p> | |
772 | * Handles: LTT_EVENT_SOFTIRQ_VEC | |
773 | * </p> | |
774 | * <p> | |
775 | * Fields: LTT_FIELD_ID, LTT_FIELD_ADDRESS, LTT_FIELD_SYMBOL | |
776 | * </p> | |
777 | * | |
778 | * @return | |
779 | */ | |
86de1b08 | 780 | final IEventProcessing getDumpSoftIrqHandler() { |
03c71d1e ASL |
781 | AbsStateUpdate handler = new AbsStateUpdate() { |
782 | ||
86de1b08 ASL |
783 | private Events eventType = Events.LTT_EVENT_SOFTIRQ_VEC; |
784 | ||
03c71d1e ASL |
785 | // @Override |
786 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
787 | // | |
788 | // // Get id | |
789 | // Long id = getAFieldLong(trcEvent, traceSt, | |
790 | // Fields.LTT_FIELD_ID); | |
791 | // | |
792 | // // Address not needed | |
793 | // // Long address = ltt_event_get_long_unsigned(e, | |
794 | // // lttv_trace_get_hook_field(th, | |
795 | // // 1)); | |
796 | // | |
797 | // // Get symbol | |
798 | // String symbol = getAFieldString(trcEvent, traceSt, | |
799 | // Fields.LTT_FIELD_SYMBOL); | |
800 | // | |
801 | // // Register the soft irq name | |
802 | // traceSt.getSoft_irq_names().put(id, symbol); | |
803 | return false; | |
804 | ||
805 | } | |
86de1b08 ASL |
806 | |
807 | // @Override | |
808 | public Events getEventHandleType() { | |
809 | return eventType; | |
810 | } | |
03c71d1e ASL |
811 | }; |
812 | return handler; | |
813 | } | |
814 | ||
815 | /** | |
816 | * <p> | |
817 | * Handles: LTT_EVENT_SCHED_SCHEDULE | |
818 | * </p> | |
819 | * <p> | |
820 | * Fields: LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE | |
821 | * </p> | |
822 | * | |
823 | * @return | |
824 | */ | |
86de1b08 | 825 | final IEventProcessing getSchedChangeHandler() { |
03c71d1e ASL |
826 | AbsStateUpdate handler = new AbsStateUpdate() { |
827 | ||
86de1b08 ASL |
828 | private Events eventType = Events.LTT_EVENT_SCHED_SCHEDULE; |
829 | ||
03c71d1e ASL |
830 | // @Override |
831 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
832 | // | |
833 | // Long cpu = trcEvent.getCpuId(); | |
834 | // TmfTimestamp eventTime = trcEvent.getTimestamp(); | |
835 | // | |
836 | // LttngProcessState process = traceSt.getRunning_process().get( | |
837 | // cpu); | |
838 | // | |
839 | // Long pid_out = getAFieldLong(trcEvent, traceSt, | |
840 | // Fields.LTT_FIELD_PREV_PID); | |
841 | // Long pid_in = getAFieldLong(trcEvent, traceSt, | |
842 | // Fields.LTT_FIELD_NEXT_PID); | |
843 | // Long state_out = getAFieldLong(trcEvent, traceSt, | |
844 | // Fields.LTT_FIELD_PREV_STATE); | |
845 | // | |
846 | // if (process != null) { | |
847 | // | |
848 | // /* | |
849 | // * We could not know but it was not the idle process | |
850 | // * executing. This should only happen at the beginning, | |
851 | // * before the first schedule event, and when the initial | |
852 | // * information (current process for each CPU) is missing. It | |
853 | // * is not obvious how we could, after the fact, compensate | |
854 | // * the wrongly attributed statistics. | |
855 | // */ | |
856 | // | |
857 | // // This test only makes sense once the state is known and if | |
858 | // // there | |
859 | // // is no | |
860 | // // missing events. We need to silently ignore schedchange | |
861 | // // coming | |
862 | // // after a | |
863 | // // process_free, or it causes glitches. (FIXME) | |
864 | // // if(unlikely(process->pid != pid_out)) { | |
865 | // // g_assert(process->pid == 0); | |
866 | // // } | |
867 | // if (process.getPid() == 0 | |
868 | // && process.getState().getExec_mode() == | |
869 | // ExecutionMode.LTTV_STATE_MODE_UNKNOWN) { | |
870 | // if (pid_out == 0) { | |
871 | // /* | |
872 | // * Scheduling out of pid 0 at beginning of the trace | |
873 | // * : we know for sure it is in syscall mode at this | |
874 | // * point. | |
875 | // */ | |
876 | // int stackSize = process.getExecution_stack().size(); | |
877 | // if (stackSize != 1) { | |
878 | // TraceDebug | |
879 | // .debug("unpexpected process execution stack size, expected 1, received: "); | |
880 | // } | |
881 | // | |
882 | // process.getState().setExec_mode( | |
883 | // ExecutionMode.LTTV_STATE_SYSCALL); | |
884 | // process.getState().setProc_status( | |
885 | // ProcessStatus.LTTV_STATE_WAIT); | |
886 | // process.getState().setChage_Time( | |
887 | // trcEvent.getTimestamp()); | |
888 | // process.getState().setEntry_Time( | |
889 | // trcEvent.getTimestamp()); | |
890 | // } | |
891 | // } else { | |
892 | // if (process.getState().getProc_status() == | |
893 | // ProcessStatus.LTTV_STATE_EXIT) { | |
894 | // process.getState().setProc_status( | |
895 | // ProcessStatus.LTTV_STATE_ZOMBIE); | |
896 | // process.getState().setChage_Time( | |
897 | // trcEvent.getTimestamp()); | |
898 | // } else { | |
899 | // if (state_out == 0L) { | |
900 | // process.getState().setProc_status( | |
901 | // ProcessStatus.LTTV_STATE_WAIT_CPU); | |
902 | // } else { | |
903 | // process.getState().setProc_status( | |
904 | // ProcessStatus.LTTV_STATE_WAIT); | |
905 | // } | |
906 | // | |
907 | // process.getState().setChage_Time( | |
908 | // trcEvent.getTimestamp()); | |
909 | // } | |
910 | // | |
911 | // if (state_out == 32L || state_out == 64L) { /* | |
912 | // * EXIT_DEAD | |
913 | // * || | |
914 | // * TASK_DEAD | |
915 | // */ | |
916 | // /* see sched.h for states */ | |
917 | // if (!exit_process(traceSt, process)) { | |
918 | // process.getState().setProc_status( | |
919 | // ProcessStatus.LTTV_STATE_DEAD); | |
920 | // process.getState().setChage_Time( | |
921 | // trcEvent.getTimestamp()); | |
922 | // } | |
923 | // } | |
924 | // } | |
925 | // } | |
926 | // process = lttv_state_find_process_or_create(traceSt, cpu, | |
927 | // pid_in, eventTime); | |
928 | // | |
929 | // traceSt.getRunning_process().put(cpu, process); | |
930 | // | |
931 | // process.getState().setProc_status(ProcessStatus.LTTV_STATE_RUN); | |
932 | // process.getState().setChage_Time(eventTime); | |
933 | // process.setCpu(cpu); | |
934 | // // process->state->s = LTTV_STATE_RUN; | |
935 | // // if(process->usertrace) | |
936 | // // process->usertrace->cpu = cpu; | |
937 | // // process->last_cpu_index = | |
938 | // // ltt_tracefile_num(((LttvTracefileContext*)s)->tf); | |
939 | // | |
940 | // // process->state->change = s->parent.timestamp; | |
941 | // | |
942 | // LTTngCPUState cpu_state = traceSt.getCpu_states().get(cpu); | |
943 | // /* update cpu status */ | |
944 | // if (pid_in == 0) { | |
945 | // | |
946 | // /* going to idle task */ | |
947 | // cpu_set_base_mode(cpu_state, CpuMode.LTTV_CPU_IDLE); | |
948 | // } else { | |
949 | // /* | |
950 | // * scheduling a real task. we must be careful here: if we | |
951 | // * just schedule()'ed to a process that is in a trap, we | |
952 | // * must put the cpu in trap mode | |
953 | // */ | |
954 | // cpu_set_base_mode(cpu_state, CpuMode.LTTV_CPU_BUSY); | |
955 | // if (process.getState().getExec_mode() == | |
956 | // ExecutionMode.LTTV_STATE_TRAP) { | |
957 | // cpu_push_mode(cpu_state, CpuMode.LTTV_CPU_TRAP); | |
958 | // } | |
959 | // } | |
960 | return false; | |
961 | ||
962 | } | |
86de1b08 ASL |
963 | |
964 | // @Override | |
965 | public Events getEventHandleType() { | |
966 | return eventType; | |
967 | } | |
03c71d1e ASL |
968 | }; |
969 | return handler; | |
970 | } | |
971 | ||
972 | /** | |
973 | * <p> | |
974 | * Handles: LTT_EVENT_PROCESS_FORK | |
975 | * </p> | |
976 | * <p> | |
977 | * Fields: FIELD_ARRAY(LTT_FIELD_PARENT_PID, LTT_FIELD_CHILD_PID, | |
978 | * LTT_FIELD_CHILD_TGID) | |
979 | * </p> | |
980 | * | |
981 | * @return | |
982 | */ | |
86de1b08 | 983 | final IEventProcessing getProcessForkHandler() { |
03c71d1e ASL |
984 | AbsStateUpdate handler = new AbsStateUpdate() { |
985 | ||
86de1b08 ASL |
986 | private Events eventType = Events.LTT_EVENT_PROCESS_FORK; |
987 | ||
03c71d1e ASL |
988 | // @Override |
989 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
990 | // | |
991 | // Long cpu = trcEvent.getCpuId(); | |
992 | // LttngProcessState process = traceSt.getRunning_process().get( | |
993 | // cpu); | |
994 | // TmfTimestamp timeStamp = trcEvent.getTimestamp(); | |
995 | // | |
996 | // // /* Parent PID */ | |
997 | // // Long parent_pid = getAFieldLong(trcEvent, traceSt, | |
998 | // // Fields.LTT_FIELD_PARENT_PID); | |
999 | // | |
1000 | // /* Child PID */ | |
1001 | // /* In the Linux Kernel, there is one PID per thread. */ | |
1002 | // Long child_pid = getAFieldLong(trcEvent, traceSt, | |
1003 | // Fields.LTT_FIELD_CHILD_PID); | |
1004 | // | |
1005 | // /* Child TGID */ | |
1006 | // /* tgid in the Linux kernel is the "real" POSIX PID. */ | |
1007 | // Long child_tgid = getAFieldLong(trcEvent, traceSt, | |
1008 | // Fields.LTT_FIELD_CHILD_TGID); | |
1009 | // if (child_tgid == null) { | |
1010 | // child_tgid = 0L; | |
1011 | // } | |
1012 | // | |
1013 | // /* | |
1014 | // * Mathieu : it seems like the process might have been | |
1015 | // scheduled | |
1016 | // * in before the fork, and, in a rare case, might be the | |
1017 | // current | |
1018 | // * process. This might happen in a SMP case where we don't | |
1019 | // have | |
1020 | // * enough precision on the clocks. | |
1021 | // * | |
1022 | // * Test reenabled after precision fixes on time. (Mathieu) | |
1023 | // */ | |
1024 | // // #if 0 | |
1025 | // // zombie_process = lttv_state_find_process(ts, ANY_CPU, | |
1026 | // // child_pid); | |
1027 | // // | |
1028 | // // if(unlikely(zombie_process != NULL)) { | |
1029 | // // /* Reutilisation of PID. Only now we are sure that the old | |
1030 | // // PID | |
1031 | // // * has been released. FIXME : should know when release_task | |
1032 | // // happens | |
1033 | // // instead. | |
1034 | // // */ | |
1035 | // // guint num_cpus = ltt_trace_get_num_cpu(ts->parent.t); | |
1036 | // // guint i; | |
1037 | // // for(i=0; i< num_cpus; i++) { | |
1038 | // // g_assert(zombie_process != ts->running_process[i]); | |
1039 | // // } | |
1040 | // // | |
1041 | // // exit_process(s, zombie_process); | |
1042 | // // } | |
1043 | // // #endif //0 | |
1044 | // | |
1045 | // if (process.getPid() == child_pid) { | |
1046 | // TraceDebug | |
1047 | // .debug("Unexpected, process pid equal to child pid: " | |
1048 | // + child_pid | |
1049 | // + " Event Time: " | |
1050 | // + trcEvent.getTimestamp()); | |
1051 | // } | |
1052 | // | |
1053 | // // g_assert(process->pid != child_pid); | |
1054 | // // FIXME : Add this test in the "known state" section | |
1055 | // // g_assert(process->pid == parent_pid); | |
1056 | // LttngProcessState child_process = lttv_state_find_process( | |
1057 | // traceSt, ANY_CPU, child_pid); | |
1058 | // if (child_process == null) { | |
1059 | // child_process = create_process(traceSt, cpu, child_pid, | |
1060 | // child_tgid, timeStamp); | |
1061 | // } else { | |
1062 | // /* | |
1063 | // * The process has already been created : due to time | |
1064 | // * imprecision between multiple CPUs : it has been scheduled | |
1065 | // * in before creation. Note that we shouldn't have this kind | |
1066 | // * of imprecision. | |
1067 | // * | |
1068 | // * Simply put a correct parent. | |
1069 | // */ | |
1070 | // StringBuilder sb = new StringBuilder("Process " + child_pid); | |
1071 | // sb.append(" has been created at [" | |
1072 | // + child_process.getCration_time() + "] "); | |
1073 | // sb.append("and inserted at [" | |
1074 | // + child_process.getInsertion_time() + "] "); | |
1075 | // sb.append("before \nfork on cpu " + cpu + " Event time: [" | |
1076 | // + trcEvent + "]\n."); | |
1077 | // sb | |
1078 | // .append("Probably an unsynchronized TSD problem on the traced machine."); | |
1079 | // TraceDebug.debug(sb.toString()); | |
1080 | // | |
1081 | // // g_assert(0); /* This is a problematic case : the process | |
1082 | // // has | |
1083 | // // beencreated | |
1084 | // // before the fork event */ | |
1085 | // child_process.setPpid(process.getPid()); | |
1086 | // child_process.setTgid(child_tgid); | |
1087 | // } | |
1088 | // | |
1089 | // if (!child_process.getName().equals( | |
1090 | // ProcessStatus.LTTV_STATE_UNNAMED.getInName())) { | |
1091 | // TraceDebug.debug("Unexpected child process status: " | |
1092 | // + child_process.getName()); | |
1093 | // } | |
1094 | // | |
1095 | // child_process.setName(process.getName()); | |
1096 | // child_process.setBrand(process.getBrand()); | |
1097 | ||
1098 | return false; | |
1099 | ||
1100 | } | |
86de1b08 ASL |
1101 | |
1102 | // @Override | |
1103 | public Events getEventHandleType() { | |
1104 | return eventType; | |
1105 | } | |
03c71d1e ASL |
1106 | }; |
1107 | return handler; | |
1108 | } | |
1109 | ||
1110 | /** | |
1111 | * <p> | |
1112 | * Handles: LTT_EVENT_KTHREAD_CREATE | |
1113 | * </p> | |
1114 | * <p> | |
1115 | * Fields: LTT_FIELD_PID | |
1116 | * </p> | |
1117 | * | |
1118 | * @return | |
1119 | */ | |
86de1b08 | 1120 | final IEventProcessing getProcessKernelThreadHandler() { |
03c71d1e ASL |
1121 | AbsStateUpdate handler = new AbsStateUpdate() { |
1122 | ||
86de1b08 ASL |
1123 | private Events eventType = Events.LTT_EVENT_KTHREAD_CREATE; |
1124 | ||
03c71d1e ASL |
1125 | // @Override |
1126 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
1127 | // /* | |
1128 | // * We stamp a newly created process as kernel_thread. The | |
1129 | // thread | |
1130 | // * should not be running yet. | |
1131 | // */ | |
1132 | // | |
1133 | // LttngExecutionState exState; | |
1134 | // Long pid; | |
1135 | // LttngProcessState process; | |
1136 | // | |
1137 | // /* PID */ | |
1138 | // pid = getAFieldLong(trcEvent, traceSt, Fields.LTT_FIELD_PID); | |
1139 | // // s->parent.target_pid = pid; | |
1140 | // | |
1141 | // process = lttv_state_find_process_or_create(traceSt, ANY_CPU, | |
1142 | // pid, new TmfTimestamp()); | |
1143 | // | |
1144 | // if (!process.getState().getProc_status().equals( | |
1145 | // ProcessStatus.LTTV_STATE_DEAD)) { | |
1146 | // // Leave only the first element in the stack with execution | |
1147 | // // mode to | |
1148 | // // syscall | |
1149 | // Stack<LttngExecutionState> processExStack = process | |
1150 | // .getExecution_stack(); | |
1151 | // exState = processExStack.firstElement(); | |
1152 | // exState.setExec_mode(ExecutionMode.LTTV_STATE_SYSCALL); | |
1153 | // if (processExStack.size() > 1) { | |
1154 | // processExStack.clear(); | |
1155 | // processExStack.add(exState); | |
1156 | // } | |
1157 | // | |
1158 | // // update the process state to the only one in the stack | |
1159 | // process.setState(exState); | |
1160 | // } | |
1161 | // | |
1162 | // process.setType(ProcessType.LTTV_STATE_KERNEL_THREAD); | |
1163 | ||
1164 | return false; | |
1165 | ||
1166 | } | |
86de1b08 ASL |
1167 | |
1168 | // @Override | |
1169 | public Events getEventHandleType() { | |
1170 | return eventType; | |
1171 | } | |
03c71d1e ASL |
1172 | }; |
1173 | return handler; | |
1174 | } | |
1175 | ||
1176 | /** | |
1177 | * <p> | |
1178 | * Handles: LTT_EVENT_PROCESS_EXIT | |
1179 | * </p> | |
1180 | * <p> | |
1181 | * LTT_FIELD_PID | |
1182 | * </p> | |
1183 | * | |
1184 | * @return | |
1185 | */ | |
86de1b08 | 1186 | final IEventProcessing getProcessExitHandler() { |
03c71d1e ASL |
1187 | AbsStateUpdate handler = new AbsStateUpdate() { |
1188 | ||
86de1b08 ASL |
1189 | private Events eventType = Events.LTT_EVENT_PROCESS_EXIT; |
1190 | ||
03c71d1e ASL |
1191 | // @Override |
1192 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
1193 | // | |
1194 | // Long pid; | |
1195 | // LttngProcessState process; | |
1196 | // | |
1197 | // pid = getAFieldLong(trcEvent, traceSt, | |
1198 | // Fields.LTT_FIELD_PID); | |
1199 | // // s->parent.target_pid = pid; | |
1200 | // | |
1201 | // // FIXME : Add this test in the "known state" section | |
1202 | // // g_assert(process->pid == pid); | |
1203 | // | |
1204 | // process = lttv_state_find_process(traceSt, ANY_CPU, pid); | |
1205 | // if (process != null) { | |
1206 | // process.getState().setProc_status( | |
1207 | // ProcessStatus.LTTV_STATE_EXIT); | |
1208 | // } | |
1209 | return false; | |
1210 | ||
1211 | } | |
86de1b08 ASL |
1212 | |
1213 | // @Override | |
1214 | public Events getEventHandleType() { | |
1215 | return eventType; | |
1216 | } | |
03c71d1e ASL |
1217 | }; |
1218 | return handler; | |
1219 | } | |
1220 | ||
1221 | /** | |
1222 | * <p> | |
1223 | * Handles: LTT_EVENT_PROCESS_FREE | |
1224 | * </p> | |
1225 | * <p> | |
1226 | * Fields: LTT_FIELD_PID | |
1227 | * </p> | |
1228 | * | |
1229 | * @return | |
1230 | */ | |
86de1b08 | 1231 | final IEventProcessing getProcessFreeHandler() { |
03c71d1e ASL |
1232 | AbsStateUpdate handler = new AbsStateUpdate() { |
1233 | ||
86de1b08 ASL |
1234 | private Events eventType = Events.LTT_EVENT_PROCESS_FREE; |
1235 | ||
03c71d1e ASL |
1236 | // @Override |
1237 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
1238 | // | |
1239 | // Long release_pid; | |
1240 | // LttngProcessState process; | |
1241 | // | |
1242 | // /* PID of the process to release */ | |
1243 | // release_pid = getAFieldLong(trcEvent, traceSt, | |
1244 | // Fields.LTT_FIELD_PID); | |
1245 | // // s->parent.target_pid = release_pid; | |
1246 | // | |
1247 | // if (release_pid == 0) { | |
1248 | // TraceDebug.debug("Unexpected release_pid: 0, Event time: " | |
1249 | // + trcEvent.getTimestamp()); | |
1250 | // } | |
1251 | // | |
1252 | // process = lttv_state_find_process(traceSt, ANY_CPU, | |
1253 | // release_pid); | |
1254 | // if (process != null) { | |
1255 | // exit_process(traceSt, process); | |
1256 | // } | |
1257 | ||
1258 | return false; | |
1259 | // DISABLED | |
1260 | // if(process != null) { | |
1261 | /* | |
1262 | * release_task is happening at kernel level : we can now safely | |
1263 | * release the data structure of the process | |
1264 | */ | |
1265 | // This test is fun, though, as it may happen that | |
1266 | // at time t : CPU 0 : process_free | |
1267 | // at time t+150ns : CPU 1 : schedule out | |
1268 | // Clearly due to time imprecision, we disable it. (Mathieu) | |
1269 | // If this weird case happen, we have no choice but to put the | |
1270 | // Currently running process on the cpu to 0. | |
1271 | // I re-enable it following time precision fixes. (Mathieu) | |
1272 | // Well, in the case where an process is freed by a process on | |
1273 | // another | |
1274 | // CPU | |
1275 | // and still scheduled, it happens that this is the schedchange | |
1276 | // that | |
1277 | // will | |
1278 | // drop the last reference count. Do not free it here! | |
1279 | ||
1280 | // int num_cpus = ltt_trace_get_num_cpu(ts->parent.t); | |
1281 | // guint i; | |
1282 | // for(i=0; i< num_cpus; i++) { | |
1283 | // //g_assert(process != ts->running_process[i]); | |
1284 | // if(process == ts->running_process[i]) { | |
1285 | // //ts->running_process[i] = lttv_state_find_process(ts, i, 0); | |
1286 | // break; | |
1287 | // } | |
1288 | // } | |
1289 | // if(i == num_cpus) /* process is not scheduled */ | |
1290 | // exit_process(s, process); | |
1291 | // } | |
1292 | // | |
1293 | // return false; | |
1294 | ||
1295 | } | |
86de1b08 ASL |
1296 | |
1297 | // @Override | |
1298 | public Events getEventHandleType() { | |
1299 | return eventType; | |
1300 | } | |
03c71d1e ASL |
1301 | }; |
1302 | return handler; | |
1303 | } | |
1304 | ||
1305 | /** | |
1306 | * <p> | |
1307 | * Handles: LTT_EVENT_EXEC | |
1308 | * </p> | |
1309 | * <p> | |
1310 | * FIELDS: LTT_FIELD_FILENAME | |
1311 | * </p> | |
1312 | * | |
1313 | * @return | |
1314 | */ | |
86de1b08 | 1315 | final IEventProcessing getProcessExecHandler() { |
03c71d1e ASL |
1316 | AbsStateUpdate handler = new AbsStateUpdate() { |
1317 | ||
86de1b08 ASL |
1318 | private Events eventType = Events.LTT_EVENT_EXEC; |
1319 | ||
03c71d1e ASL |
1320 | // @Override |
1321 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
1322 | // | |
1323 | // Long cpu = trcEvent.getCpuId(); | |
1324 | // LttngProcessState process = traceSt.getRunning_process().get( | |
1325 | // cpu); | |
1326 | // | |
1327 | // // #if 0//how to use a sequence that must be transformed in a | |
1328 | // // string | |
1329 | // // /* PID of the process to release */ | |
1330 | // // guint64 name_len = ltt_event_field_element_number(e, | |
1331 | // // lttv_trace_get_hook_field(th, 0)); | |
1332 | // // //name = ltt_event_get_string(e, | |
1333 | // // lttv_trace_get_hook_field(th, 0)); | |
1334 | // // LttField *child = ltt_event_field_element_select(e, | |
1335 | // // lttv_trace_get_hook_field(th, 0), 0); | |
1336 | // // gchar *name_begin = | |
1337 | // // (gchar*)(ltt_event_data(e)+ltt_event_field_offset(e, | |
1338 | // child)); | |
1339 | // // gchar *null_term_name = g_new(gchar, name_len+1); | |
1340 | // // memcpy(null_term_name, name_begin, name_len); | |
1341 | // // null_term_name[name_len] = '\0'; | |
1342 | // // process->name = g_quark_from_string(null_term_name); | |
1343 | // // #endif //0 | |
1344 | // | |
1345 | // process.setName(getAFieldString(trcEvent, traceSt, | |
1346 | // Fields.LTT_FIELD_FILENAME)); | |
1347 | // process.setBrand(StateStrings.LTTV_STATE_UNBRANDED); | |
1348 | return false; | |
1349 | ||
1350 | } | |
86de1b08 ASL |
1351 | |
1352 | // @Override | |
1353 | public Events getEventHandleType() { | |
1354 | return eventType; | |
1355 | } | |
03c71d1e ASL |
1356 | }; |
1357 | return handler; | |
1358 | } | |
1359 | ||
1360 | /** | |
1361 | * <p> | |
1362 | * LTT_EVENT_THREAD_BRAND | |
1363 | * </p> | |
1364 | * <p> | |
1365 | * FIELDS: LTT_FIELD_NAME | |
1366 | * </p> | |
1367 | * | |
1368 | * @return | |
1369 | */ | |
86de1b08 | 1370 | final IEventProcessing GetThreadBrandHandler() { |
03c71d1e ASL |
1371 | AbsStateUpdate handler = new AbsStateUpdate() { |
1372 | ||
86de1b08 ASL |
1373 | private Events eventType = Events.LTT_EVENT_THREAD_BRAND; |
1374 | ||
03c71d1e ASL |
1375 | // @Override |
1376 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
1377 | // | |
1378 | // String name; | |
1379 | // Long cpu = trcEvent.getCpuId(); | |
1380 | // LttngProcessState process = traceSt.getRunning_process().get( | |
1381 | // cpu); | |
1382 | // | |
1383 | // name = getAFieldString(trcEvent, traceSt, | |
1384 | // Fields.LTT_FIELD_NAME); | |
1385 | // process.setBrand(name); | |
1386 | return false; | |
1387 | ||
1388 | } | |
86de1b08 ASL |
1389 | |
1390 | // @Override | |
1391 | public Events getEventHandleType() { | |
1392 | return eventType; | |
1393 | } | |
03c71d1e ASL |
1394 | }; |
1395 | return handler; | |
1396 | } | |
1397 | ||
1398 | /** | |
1399 | * @return | |
1400 | */ | |
86de1b08 | 1401 | final IEventProcessing getStateDumpEndHandler() { |
03c71d1e ASL |
1402 | AbsStateUpdate handler = new AbsStateUpdate() { |
1403 | ||
86de1b08 ASL |
1404 | private Events eventType = Events.LTT_EVENT_STATEDUMP_END; |
1405 | ||
03c71d1e ASL |
1406 | // @Override |
1407 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
1408 | // | |
1409 | // /* For all processes */ | |
1410 | // /* | |
1411 | // * if kernel thread, if stack[0] is unknown, set to syscall | |
1412 | // * mode, wait | |
1413 | // */ | |
1414 | // /* else, if stack[0] is unknown, set to user mode, running */ | |
1415 | // List<LttngProcessState> processes = traceSt.getProcesses(); | |
1416 | // TmfTimestamp time = trcEvent.getTimestamp(); | |
1417 | // | |
1418 | // for (LttngProcessState process : processes) { | |
1419 | // fix_process(process, time); | |
1420 | // } | |
1421 | ||
1422 | return false; | |
1423 | ||
1424 | } | |
86de1b08 ASL |
1425 | |
1426 | // @Override | |
1427 | public Events getEventHandleType() { | |
1428 | return eventType; | |
1429 | } | |
03c71d1e ASL |
1430 | }; |
1431 | return handler; | |
1432 | } | |
1433 | ||
1434 | /** | |
1435 | * Private method used to establish the first execution state in the stack | |
1436 | * for a given process | |
1437 | * | |
1438 | * @param process | |
1439 | * @param timestamp | |
1440 | */ | |
1441 | // private void fix_process(LttngProcessState process, | |
1442 | // TmfTimestamp timestamp) { | |
1443 | // | |
1444 | // LttngExecutionState es; | |
1445 | // Stack<LttngExecutionState> procStack = process | |
1446 | // .getExecution_stack(); | |
1447 | // | |
1448 | // if (process.getType() == ProcessType.LTTV_STATE_KERNEL_THREAD) { | |
1449 | // es = procStack.firstElement(); | |
1450 | // | |
1451 | // if (es.getExec_mode() == ExecutionMode.LTTV_STATE_MODE_UNKNOWN) { | |
1452 | // es.setExec_mode(ExecutionMode.LTTV_STATE_SYSCALL); | |
1453 | // es | |
1454 | // .setExec_submode(ExecutionSubMode.LTTV_STATE_SUBMODE_NONE | |
1455 | // .getInName()); | |
1456 | // es.setEntry_Time(timestamp); | |
1457 | // es.setChage_Time(timestamp); | |
1458 | // es.setCum_cpu_time(0L); | |
1459 | // if (es.getProc_status() == ProcessStatus.LTTV_STATE_UNNAMED) { | |
1460 | // es.setProc_status(ProcessStatus.LTTV_STATE_WAIT); | |
1461 | // } | |
1462 | // } | |
1463 | // } else { | |
1464 | // es = procStack.firstElement(); | |
1465 | // if (es.getExec_mode() == ExecutionMode.LTTV_STATE_MODE_UNKNOWN) { | |
1466 | // es.setExec_mode(ExecutionMode.LTTV_STATE_USER_MODE); | |
1467 | // es | |
1468 | // .setExec_submode(ExecutionSubMode.LTTV_STATE_SUBMODE_NONE | |
1469 | // .getInName()); | |
1470 | // es.setEntry_Time(timestamp); | |
1471 | // es.setChage_Time(timestamp); | |
1472 | // es.setCum_cpu_time(0L); | |
1473 | // if (es.getProc_status() == ProcessStatus.LTTV_STATE_UNNAMED) { | |
1474 | // es.setProc_status(ProcessStatus.LTTV_STATE_RUN); | |
1475 | // } | |
1476 | // | |
1477 | // if (procStack.size() == 1) { | |
1478 | // /* | |
1479 | // * Still in bottom unknown mode, means never did a | |
1480 | // * system call May be either in user mode, syscall | |
1481 | // * mode, running or waiting. | |
1482 | // */ | |
1483 | // /* | |
1484 | // * FIXME : we may be tagging syscall mode when being | |
1485 | // * user mode | |
1486 | // */ | |
1487 | // // Get a new execution State | |
1488 | // es = new LttngExecutionState(); | |
1489 | // | |
1490 | // // initialize values | |
1491 | // es.setExec_mode(ExecutionMode.LTTV_STATE_SYSCALL); | |
1492 | // es | |
1493 | // .setExec_submode(ExecutionSubMode.LTTV_STATE_SUBMODE_NONE | |
1494 | // .getInName()); | |
1495 | // es.setEntry_Time(timestamp); | |
1496 | // es.setChage_Time(timestamp); | |
1497 | // es.setCum_cpu_time(0L); | |
1498 | // es.setProc_status(ProcessStatus.LTTV_STATE_UNNAMED); | |
1499 | // | |
1500 | // // Push the new state to the stack | |
1501 | // procStack.push(es); | |
1502 | // } | |
1503 | // } | |
1504 | // } | |
1505 | // } | |
1506 | // }; | |
1507 | // return handler; | |
1508 | // } | |
1509 | ||
1510 | /** | |
1511 | * <p> | |
1512 | * Handles: LTT_EVENT_PROCESS_STATE | |
1513 | * </p> | |
1514 | * <p> | |
1515 | * FIELDS: LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME, | |
1516 | * LTT_FIELD_TYPE, LTT_FIELD_MODE, LTT_FIELD_SUBMODE, LTT_FIELD_STATUS, | |
1517 | * LTT_FIELD_TGID | |
1518 | * </p> | |
1519 | * | |
1520 | * @return | |
1521 | */ | |
86de1b08 | 1522 | final IEventProcessing getEnumProcessStateHandler() { |
03c71d1e ASL |
1523 | AbsStateUpdate handler = new AbsStateUpdate() { |
1524 | ||
86de1b08 ASL |
1525 | private Events eventType = Events.LTT_EVENT_PROCESS_STATE; |
1526 | ||
03c71d1e ASL |
1527 | // @Override |
1528 | public boolean process(LttngEvent trcEvent, LttngTraceState traceSt) { | |
1529 | // | |
1530 | // Long parent_pid; | |
1531 | // Long pid; | |
1532 | // Long tgid; | |
1533 | // String command; | |
1534 | // Long cpu = trcEvent.getCpuId(); | |
1535 | // LttngProcessState process = traceSt.getRunning_process().get( | |
1536 | // cpu); | |
1537 | // LttngProcessState parent_process; | |
1538 | // String type; | |
1539 | // // String mode, submode, status; | |
1540 | // LttngExecutionState es; | |
1541 | // | |
1542 | // /* PID */ | |
1543 | // pid = getAFieldLong(trcEvent, traceSt, Fields.LTT_FIELD_PID); | |
1544 | // | |
1545 | // /* Parent PID */ | |
1546 | // parent_pid = getAFieldLong(trcEvent, traceSt, | |
1547 | // Fields.LTT_FIELD_PARENT_PID); | |
1548 | // | |
1549 | // /* Command name */ | |
1550 | // command = getAFieldString(trcEvent, traceSt, | |
1551 | // Fields.LTT_FIELD_NAME); | |
1552 | // | |
1553 | // /* TODO: type field, Values need to be verified */ | |
1554 | // /* type */ | |
1555 | // Long typeVal = getAFieldLong(trcEvent, traceSt, | |
1556 | // Fields.LTT_FIELD_TYPE); | |
1557 | // if (typeVal == 0L) { | |
1558 | // type = ProcessType.LTTV_STATE_KERNEL_THREAD.getInName(); | |
1559 | // } else { | |
1560 | // type = ProcessType.LTTV_STATE_USER_THREAD.getInName(); | |
1561 | // } | |
1562 | // | |
1563 | // // FIXME: type is rarely used, enum must match possible | |
1564 | // types. | |
1565 | // | |
1566 | // // /* mode */ | |
1567 | // // mode = getAFieldString(trcEvent, traceSt, | |
1568 | // // Fields.LTT_FIELD_MODE); | |
1569 | // // | |
1570 | // // /* submode */ | |
1571 | // // submode = getAFieldString(trcEvent, traceSt, | |
1572 | // // Fields.LTT_FIELD_SUBMODE); | |
1573 | // // | |
1574 | // // /* status */ | |
1575 | // // status = getAFieldString(trcEvent, traceSt, | |
1576 | // // Fields.LTT_FIELD_STATUS); | |
1577 | // | |
1578 | // /* TGID */ | |
1579 | // tgid = getAFieldLong(trcEvent, traceSt, | |
1580 | // Fields.LTT_FIELD_TGID); | |
1581 | // if (tgid == null) { | |
1582 | // tgid = 0L; | |
1583 | // } | |
1584 | // | |
1585 | // if (pid == 0) { | |
1586 | // for (Long acpu : traceSt.getCpu_states().keySet()) { | |
1587 | // process = lttv_state_find_process(traceSt, acpu, pid); | |
1588 | // if (process != null) { | |
1589 | // process.setPpid(parent_pid); | |
1590 | // process.setTgid(tgid); | |
1591 | // process.setName(command); | |
1592 | // process | |
1593 | // .setType(ProcessType.LTTV_STATE_KERNEL_THREAD); | |
1594 | // } else { | |
1595 | // StringBuilder sb = new StringBuilder( | |
1596 | // "Unexpected, null process read from the TraceState list of processes, event time: " | |
1597 | // + trcEvent.getTimestamp()); | |
1598 | // TraceDebug.debug(sb.toString()); | |
1599 | // } | |
1600 | // } | |
1601 | // } else { | |
1602 | // /* | |
1603 | // * The process might exist if a process was forked while | |
1604 | // * performing the state dump. | |
1605 | // */ | |
1606 | // process = lttv_state_find_process(traceSt, ANY_CPU, pid); | |
1607 | // if (process == null) { | |
1608 | // parent_process = lttv_state_find_process(traceSt, | |
1609 | // ANY_CPU, parent_pid); | |
1610 | // process = create_process(traceSt, cpu, pid, tgid, | |
1611 | // command, trcEvent.getTimestamp()); | |
1612 | // if (parent_process != null) { | |
1613 | // process.setPpid(parent_process.getPid()); | |
1614 | // } | |
1615 | // | |
1616 | // /* Keep the stack bottom : a running user mode */ | |
1617 | // /* | |
1618 | // * Disabled because of inconsistencies in the current | |
1619 | // * statedump states. | |
1620 | // */ | |
1621 | // if (type.equals(ProcessType.LTTV_STATE_KERNEL_THREAD | |
1622 | // .getInName())) { | |
1623 | // /* | |
1624 | // * FIXME Kernel thread : can be in syscall or | |
1625 | // * interrupt or trap. | |
1626 | // */ | |
1627 | // /* | |
1628 | // * Will cause expected trap when in fact being | |
1629 | // * syscall (even after end of statedump event) Will | |
1630 | // * cause expected interrupt when being syscall. | |
1631 | // * (only before end of statedump event) | |
1632 | // */ | |
1633 | // process | |
1634 | // .setType(ProcessType.LTTV_STATE_KERNEL_THREAD); | |
1635 | // | |
1636 | // // #if 0 | |
1637 | // // es->t = LTTV_STATE_SYSCALL; | |
1638 | // // es->s = status; | |
1639 | // // es->n = submode; | |
1640 | // // #endif //0 | |
1641 | // } else { | |
1642 | // /* | |
1643 | // * User space process : bottom : user mode either | |
1644 | // * currently running or scheduled out. can be | |
1645 | // * scheduled out because interrupted in (user mode | |
1646 | // * or in syscall) or because of an explicit call to | |
1647 | // * the scheduler in syscall. Note that the scheduler | |
1648 | // * call comes after the irq_exit, so never in | |
1649 | // * interrupt context. | |
1650 | // */ | |
1651 | // // temp workaround : set size to 1 : only have user | |
1652 | // // mode | |
1653 | // // bottom of stack. | |
1654 | // // will cause g_info message of expected syscall | |
1655 | // // mode when | |
1656 | // // in fact being | |
1657 | // // in user mode. Can also cause expected trap when | |
1658 | // // in fact | |
1659 | // // being user | |
1660 | // // mode in the event of a page fault reenabling | |
1661 | // // interrupts | |
1662 | // // in the handler. | |
1663 | // // Expected syscall and trap can also happen after | |
1664 | // // the end | |
1665 | // // of statedump | |
1666 | // // This will cause a | |
1667 | // // "popping last state on stack, ignoring it." | |
1668 | // | |
1669 | // // process->execution_stack = | |
1670 | // // g_array_set_size(process->execution_stack, 1); | |
1671 | // // es = process->state = | |
1672 | // // &g_array_index(process->execution_stack, | |
1673 | // // LttvExecutionState, 0); | |
1674 | // // a new process must have only one state in the | |
1675 | // // stack and | |
1676 | // // be the same as the current state | |
1677 | // // es = process.getState(); | |
1678 | // // es.setExec_mode(ExecutionMode.LTTV_STATE_MODE_UNKNOWN); | |
1679 | // // es.setProc_status(ProcessStatus.LTTV_STATE_UNNAMED); | |
1680 | // // es | |
1681 | // // | |
1682 | // .setExec_submode(ExecutionSubMode.LTTV_STATE_SUBMODE_UNKNOWN | |
1683 | // // .getInName()); | |
1684 | // | |
1685 | // // #if 0 | |
1686 | // // es->t = LTTV_STATE_USER_MODE; | |
1687 | // // es->s = status; | |
1688 | // // es->n = submode; | |
1689 | // // #endif //0 | |
1690 | // } | |
1691 | // // TODO: clean up comments above: Moved repeated code | |
1692 | // // from both | |
1693 | // // if / else blocks above, | |
1694 | // // comments left temporarily for easier visualization | |
1695 | // // and | |
1696 | // // comparision with c code | |
1697 | // es = process.getState(); | |
1698 | // es.setExec_mode(ExecutionMode.LTTV_STATE_MODE_UNKNOWN); | |
1699 | // es.setProc_status(ProcessStatus.LTTV_STATE_UNNAMED); | |
1700 | // es | |
1701 | // .setExec_submode(ExecutionSubMode.LTTV_STATE_SUBMODE_UNKNOWN | |
1702 | // .getInName()); | |
1703 | // // #if 0 | |
1704 | // // /* UNKNOWN STATE */ | |
1705 | // // { | |
1706 | // // es = process->state = | |
1707 | // // &g_array_index(process->execution_stack, | |
1708 | // // LttvExecutionState, 1); | |
1709 | // // es->t = LTTV_STATE_MODE_UNKNOWN; | |
1710 | // // es->s = LTTV_STATE_UNNAMED; | |
1711 | // // es->n = LTTV_STATE_SUBMODE_UNKNOWN; | |
1712 | // // } | |
1713 | // // #endif //0 | |
1714 | // } else { | |
1715 | // /* | |
1716 | // * The process has already been created : Probably was | |
1717 | // * forked while dumping the process state or was simply | |
1718 | // * scheduled in prior to get the state dump event. | |
1719 | // */ | |
1720 | // process.setPpid(parent_pid); | |
1721 | // process.setTgid(tgid); | |
1722 | // process.setName(command); | |
1723 | // if (type.equals(ProcessType.LTTV_STATE_KERNEL_THREAD | |
1724 | // .getInName())) { | |
1725 | // process | |
1726 | // .setType(ProcessType.LTTV_STATE_KERNEL_THREAD); | |
1727 | // } else { | |
1728 | // process.setType(ProcessType.LTTV_STATE_USER_THREAD); | |
1729 | // } | |
1730 | // | |
1731 | // // es = | |
1732 | // // &g_array_index(process->execution_stack, | |
1733 | // // LttvExecutionState, | |
1734 | // // 0); | |
1735 | // // #if 0 | |
1736 | // // if(es->t == LTTV_STATE_MODE_UNKNOWN) { | |
1737 | // // if(type == LTTV_STATE_KERNEL_THREAD) | |
1738 | // // es->t = LTTV_STATE_SYSCALL; | |
1739 | // // else | |
1740 | // // es->t = LTTV_STATE_USER_MODE; | |
1741 | // // } | |
1742 | // // #endif //0 | |
1743 | // /* | |
1744 | // * Don't mess around with the stack, it will eventually | |
1745 | // * become ok after the end of state dump. | |
1746 | // */ | |
1747 | // } | |
1748 | // } | |
1749 | ||
1750 | return false; | |
1751 | ||
1752 | } | |
86de1b08 ASL |
1753 | |
1754 | // @Override | |
1755 | public Events getEventHandleType() { | |
1756 | return eventType; | |
1757 | } | |
03c71d1e ASL |
1758 | }; |
1759 | return handler; | |
1760 | } | |
1761 | ||
1762 | } |