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 SCHED_SWITCH
= "sched_switch"; //$NON-NLS-1$
42 private static final String SCHED_PI_SETPRIO
= "sched_pi_setprio"; //$NON-NLS-1$
44 private static final Collection
<String
> SCHED_WAKEUP_EVENTS
=
45 checkNotNull(ImmutableList
.of("sched_wakeup", "sched_wakeup_new")); //$NON-NLS-1$ //$NON-NLS-2$
47 private static final String SCHED_PROCESS_FORK
= "sched_process_fork"; //$NON-NLS-1$
48 private static final String SCHED_PROCESS_EXIT
= "sched_process_exit"; //$NON-NLS-1$
49 private static final String SCHED_PROCESS_FREE
= "sched_process_free"; //$NON-NLS-1$
50 private static final String STATEDUMP_PROCESS_STATE
= "lttng_statedump_process_state"; //$NON-NLS-1$
52 private static final String SYSCALL_ENTRY_PREFIX
= "sys_"; //$NON-NLS-1$
53 private static final String COMPAT_SYSCALL_ENTRY_PREFIX
= "compat_sys_"; //$NON-NLS-1$
54 private static final String SYSCALL_EXIT_PREFIX
= "exit_syscall"; //$NON-NLS-1$
57 private static final String IRQ
= "irq"; //$NON-NLS-1$
58 private static final String TID
= "tid"; //$NON-NLS-1$
59 private static final String VEC
= "vec"; //$NON-NLS-1$
60 private static final String PREV_TID
= "prev_tid"; //$NON-NLS-1$
61 private static final String PREV_STATE
= "prev_state"; //$NON-NLS-1$
62 private static final String NEXT_COMM
= "next_comm"; //$NON-NLS-1$
63 private static final String NEXT_TID
= "next_tid"; //$NON-NLS-1$
64 private static final String PARENT_TID
= "parent_tid"; //$NON-NLS-1$
65 private static final String CHILD_COMM
= "child_comm"; //$NON-NLS-1$
66 private static final String CHILD_TID
= "child_tid"; //$NON-NLS-1$
67 private static final String PRIO
= "prio"; //$NON-NLS-1$
68 private static final String NEW_PRIO
= "newprio"; //$NON-NLS-1$
69 private static final String NEXT_PRIO
= "next_prio"; //$NON-NLS-1$
71 /** All instances are the same. Only provide a static instance getter */
72 private DefaultEventLayout() {
76 * The instance of this event layout
78 * This object is completely immutable, so no need to create additional
79 * instances via the constructor.
81 static final IKernelAnalysisEventLayout INSTANCE
= new DefaultEventLayout();
83 // ------------------------------------------------------------------------
85 // ------------------------------------------------------------------------
88 public String
eventIrqHandlerEntry() {
89 return IRQ_HANDLER_ENTRY
;
93 public String
eventIrqHandlerExit() {
94 return IRQ_HANDLER_EXIT
;
98 public String
eventSoftIrqEntry() {
103 public String
eventSoftIrqExit() {
108 public String
eventSoftIrqRaise() {
109 return SOFTIRQ_RAISE
;
113 public String
eventSchedSwitch() {
121 public String
eventSchedPiSetprio() {
122 return SCHED_PI_SETPRIO
;
126 public Collection
<String
> eventsSchedWakeup() {
127 return SCHED_WAKEUP_EVENTS
;
131 public String
eventSchedProcessFork() {
132 return SCHED_PROCESS_FORK
;
136 public String
eventSchedProcessExit() {
137 return SCHED_PROCESS_EXIT
;
141 public String
eventSchedProcessFree() {
142 return SCHED_PROCESS_FREE
;
146 public @NonNull String
eventStatedumpProcessState() {
147 return STATEDUMP_PROCESS_STATE
;
151 public String
eventSyscallEntryPrefix() {
152 return SYSCALL_ENTRY_PREFIX
;
156 public String
eventCompatSyscallEntryPrefix() {
157 return COMPAT_SYSCALL_ENTRY_PREFIX
;
161 public String
eventSyscallExitPrefix() {
162 return SYSCALL_EXIT_PREFIX
;
165 // ------------------------------------------------------------------------
167 // ------------------------------------------------------------------------
170 public String
fieldIrq() {
175 public String
fieldVec() {
180 public String
fieldTid() {
185 public String
fieldPrevTid() {
190 public String
fieldPrevState() {
195 public String
fieldNextComm() {
200 public String
fieldNextTid() {
205 public String
fieldChildComm() {
210 public String
fieldParentTid() {
215 public String
fieldChildTid() {
223 public String
fieldPrio() {
231 public String
fieldNewPrio() {
239 public String
fieldNextPrio() {