1 /*******************************************************************************
2 * Copyright (c) 2015 Ericsson
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
10 * Alexandre Montplaisir - Initial API and implementation
11 ******************************************************************************/
13 package org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.trace
;
15 import static org
.eclipse
.tracecompass
.common
.core
.NonNullUtils
.checkNotNull
;
17 import java
.util
.Collection
;
19 import org
.eclipse
.jdt
.annotation
.NonNull
;
21 import com
.google
.common
.collect
.ImmutableList
;
24 * A kernel event layout to be used by default. This can be useful for
25 * data-driven traces for example, where they can provide whatever event names
28 * Due to historical reasons, the definitions are the same as LTTng event names.
30 * @author Alexandre Montplaisir
33 public class DefaultEventLayout
implements IKernelAnalysisEventLayout
{
36 private static final String IRQ_HANDLER_ENTRY
= "irq_handler_entry"; //$NON-NLS-1$
37 private static final String IRQ_HANDLER_EXIT
= "irq_handler_exit"; //$NON-NLS-1$
38 private static final String SOFTIRQ_ENTRY
= "softirq_entry"; //$NON-NLS-1$
39 private static final String SOFTIRQ_EXIT
= "softirq_exit"; //$NON-NLS-1$
40 private static final String SOFTIRQ_RAISE
= "softirq_raise"; //$NON-NLS-1$
41 private static final String HRTIMER_START
= "hrtimer_start"; //$NON-NLS-1$
42 private static final String HRTIMER_CANCEL
= "hrtimer_cancel"; //$NON-NLS-1$
43 private static final String HRTIMER_EXPIRE_ENTRY
= "hrtimer_expire_entry"; //$NON-NLS-1$
44 private static final String HRTIMER_EXPIRE_EXIT
= "hrtimer_expire_exit"; //$NON-NLS-1$
45 private static final String SCHED_SWITCH
= "sched_switch"; //$NON-NLS-1$
46 private static final String SCHED_PI_SETPRIO
= "sched_pi_setprio"; //$NON-NLS-1$
48 private static final String SCHED_TTWU
= "sched_ttwu"; //$NON-NLS-1$
49 private static final String SCHED_WAKING
= "sched_waking"; //$NON-NLS-1$
50 private static final String SCHED_WAKEUP
= "sched_wakeup"; //$NON-NLS-1$
51 private static final String SCHED_WAKEUP_NEW
= "sched_wakeup_new"; //$NON-NLS-1$
52 private static final Collection
<String
> SCHED_WAKEUP_EVENTS
=
53 checkNotNull(ImmutableList
.of(SCHED_WAKEUP
, SCHED_WAKEUP_NEW
));
55 private static final String SCHED_PROCESS_FORK
= "sched_process_fork"; //$NON-NLS-1$
56 private static final String SCHED_PROCESS_EXIT
= "sched_process_exit"; //$NON-NLS-1$
57 private static final String SCHED_PROCESS_FREE
= "sched_process_free"; //$NON-NLS-1$
58 private static final String SCHED_PROCESS_EXEC
= "sched_process_exec"; //$NON-NLS-1$
59 private static final String STATEDUMP_PROCESS_STATE
= "lttng_statedump_process_state"; //$NON-NLS-1$
61 private static final String SYSCALL_ENTRY_PREFIX
= "sys_"; //$NON-NLS-1$
62 private static final String COMPAT_SYSCALL_ENTRY_PREFIX
= "compat_sys_"; //$NON-NLS-1$
63 private static final String SYSCALL_EXIT_PREFIX
= "exit_syscall"; //$NON-NLS-1$
66 private static final String IRQ
= "irq"; //$NON-NLS-1$
67 private static final String TID
= "tid"; //$NON-NLS-1$
68 private static final String VEC
= "vec"; //$NON-NLS-1$
69 private static final String PREV_TID
= "prev_tid"; //$NON-NLS-1$
70 private static final String PREV_STATE
= "prev_state"; //$NON-NLS-1$
71 private static final String NEXT_COMM
= "next_comm"; //$NON-NLS-1$
72 private static final String NEXT_TID
= "next_tid"; //$NON-NLS-1$
73 private static final String PARENT_TID
= "parent_tid"; //$NON-NLS-1$
74 private static final String CHILD_COMM
= "child_comm"; //$NON-NLS-1$
75 private static final String CHILD_TID
= "child_tid"; //$NON-NLS-1$
76 private static final String PRIO
= "prio"; //$NON-NLS-1$
77 private static final String NEW_PRIO
= "newprio"; //$NON-NLS-1$
78 private static final String NEXT_PRIO
= "next_prio"; //$NON-NLS-1$
79 private static final String COMM
= "comm"; //$NON-NLS-1$
80 private static final String NAME
= "name"; //$NON-NLS-1$
81 private static final String STATUS
= "status"; //$NON-NLS-1$
82 private static final String PREV_COMM
= "prev_comm"; //$NON-NLS-1$
83 private static final String FILENAME
= "filename"; //$NON-NLS-1$
84 private static final String HRTIMER
= "hrtimer"; //$NON-NLS-1$
85 private static final String FUNCTION
= "function"; //$NON-NLS-1$
86 private static final String EXPIRES
= "expires"; //$NON-NLS-1$
87 private static final String NOW
= "now"; //$NON-NLS-1$
88 private static final String SOFT_EXPIRES
= "softexpires"; //$NON-NLS-1$
90 /** All instances are the same. Only provide a static instance getter */
91 private DefaultEventLayout() {
95 * The instance of this event layout
97 * This object is completely immutable, so no need to create additional
98 * instances via the constructor.
100 static final IKernelAnalysisEventLayout INSTANCE
= new DefaultEventLayout();
102 // ------------------------------------------------------------------------
104 // ------------------------------------------------------------------------
107 public String
eventIrqHandlerEntry() {
108 return IRQ_HANDLER_ENTRY
;
112 public String
eventIrqHandlerExit() {
113 return IRQ_HANDLER_EXIT
;
117 public String
eventSoftIrqEntry() {
118 return SOFTIRQ_ENTRY
;
122 public String
eventSoftIrqExit() {
127 public String
eventSoftIrqRaise() {
128 return SOFTIRQ_RAISE
;
132 public String
eventSchedSwitch() {
140 public String
eventSchedPiSetprio() {
141 return SCHED_PI_SETPRIO
;
145 public Collection
<String
> eventsSchedWakeup() {
146 return SCHED_WAKEUP_EVENTS
;
150 public String
eventSchedProcessFork() {
151 return SCHED_PROCESS_FORK
;
155 public String
eventSchedProcessExit() {
156 return SCHED_PROCESS_EXIT
;
160 public String
eventSchedProcessFree() {
161 return SCHED_PROCESS_FREE
;
165 public @NonNull String
eventStatedumpProcessState() {
166 return STATEDUMP_PROCESS_STATE
;
170 public String
eventSyscallEntryPrefix() {
171 return SYSCALL_ENTRY_PREFIX
;
175 public String
eventCompatSyscallEntryPrefix() {
176 return COMPAT_SYSCALL_ENTRY_PREFIX
;
180 public String
eventSyscallExitPrefix() {
181 return SYSCALL_EXIT_PREFIX
;
186 public String
eventCompatSyscallExitPrefix() {
187 return SYSCALL_EXIT_PREFIX
;
190 // ------------------------------------------------------------------------
192 // ------------------------------------------------------------------------
195 public String
fieldIrq() {
200 public String
fieldVec() {
205 public String
fieldTid() {
210 public String
fieldPrevTid() {
215 public String
fieldPrevState() {
220 public String
fieldNextComm() {
225 public String
fieldNextTid() {
230 public String
fieldChildComm() {
235 public String
fieldParentTid() {
240 public String
fieldChildTid() {
246 public String
fieldPrio() {
252 public String
fieldNewPrio() {
258 public String
fieldNextPrio() {
264 public String
fieldComm() {
270 public String
fieldName() {
276 public String
fieldStatus() {
282 public String
fieldPrevComm() {
288 public String
fieldFilename() {
294 public String
eventSchedProcessExec() {
295 return SCHED_PROCESS_EXEC
;
300 public String
eventSchedProcessWakeup() {
306 public String
eventSchedProcessWakeupNew() {
307 return SCHED_WAKEUP_NEW
;
312 public String
eventHRTimerStart() {
313 return HRTIMER_START
;
318 public String
eventHRTimerCancel() {
319 return HRTIMER_CANCEL
;
324 public String
eventHRTimerExpireEntry() {
325 return HRTIMER_EXPIRE_ENTRY
;
330 public String
eventHRTimerExpireExit() {
331 return HRTIMER_EXPIRE_EXIT
;
335 * Event indicating the source of the wakeup signal.
337 * @return The name of the event
340 public String
eventSchedProcessTTWU() {
346 public String
fieldHRtimer() {
352 public String
fieldHRtimerFunction() {
358 public String
fieldHRtimerExpires() {
364 public String
fieldHRtimerSoftexpires() {
370 public String
fieldHRtimerNow() {
375 * Event indicating the source of the wakeup signal.
377 * @return The name of the event
380 public String
eventSchedProcessWaking() {