| 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2012, 2014 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 | * Alexandre Montplaisir - Initial API and implementation |
| 11 | ******************************************************************************/ |
| 12 | |
| 13 | package org.eclipse.tracecompass.internal.lttng2.kernel.core.trace.layout; |
| 14 | |
| 15 | import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull; |
| 16 | |
| 17 | import java.util.Collection; |
| 18 | |
| 19 | import org.eclipse.jdt.annotation.NonNull; |
| 20 | |
| 21 | import com.google.common.collect.ImmutableList; |
| 22 | |
| 23 | /** |
| 24 | * This file defines all the known event and field names for LTTng kernel |
| 25 | * traces, for versions of lttng-modules up to 2.5. |
| 26 | * |
| 27 | * These should not be externalized, since they need to match exactly what the |
| 28 | * tracer outputs. If you want to localize them in a view, you should do a |
| 29 | * mapping in the view itself. |
| 30 | * |
| 31 | * @author Alexandre Montplaisir |
| 32 | */ |
| 33 | @SuppressWarnings("nls") |
| 34 | public class LttngEventLayout implements IKernelAnalysisEventLayout { |
| 35 | |
| 36 | /* Event names */ |
| 37 | private static final String IRQ_HANDLER_ENTRY = "irq_handler_entry"; |
| 38 | private static final String IRQ_HANDLER_EXIT = "irq_handler_exit"; |
| 39 | private static final String SOFTIRQ_ENTRY = "softirq_entry"; |
| 40 | private static final String SOFTIRQ_EXIT = "softirq_exit"; |
| 41 | private static final String SOFTIRQ_RAISE = "softirq_raise"; |
| 42 | private static final String SCHED_SWITCH = "sched_switch"; |
| 43 | |
| 44 | private static final Collection<String> SCHED_WAKEUP_EVENTS = |
| 45 | checkNotNull(ImmutableList.of("sched_wakeup", "sched_wakeup_new")); |
| 46 | |
| 47 | private static final String SCHED_PROCESS_FORK = "sched_process_fork"; |
| 48 | private static final String SCHED_PROCESS_EXIT = "sched_process_exit"; |
| 49 | private static final String SCHED_PROCESS_FREE = "sched_process_free"; |
| 50 | private static final String STATEDUMP_PROCESS_STATE = "lttng_statedump_process_state"; |
| 51 | |
| 52 | private static final String SYSCALL_ENTRY_PREFIX = "sys_"; |
| 53 | private static final String COMPAT_SYSCALL_ENTRY_PREFIX = "compat_sys_"; |
| 54 | private static final String SYSCALL_EXIT_PREFIX = "exit_syscall"; |
| 55 | |
| 56 | /* Field names */ |
| 57 | private static final String IRQ = "irq"; |
| 58 | private static final String TID = "tid"; |
| 59 | private static final String VEC = "vec"; |
| 60 | private static final String PREV_TID = "prev_tid"; |
| 61 | private static final String PREV_STATE = "prev_state"; |
| 62 | private static final String NEXT_COMM = "next_comm"; |
| 63 | private static final String NEXT_TID = "next_tid"; |
| 64 | private static final String PARENT_TID = "parent_tid"; |
| 65 | private static final String CHILD_COMM = "child_comm"; |
| 66 | private static final String CHILD_TID = "child_tid"; |
| 67 | |
| 68 | /** All instances are the same. Only provide a static instance getter */ |
| 69 | protected LttngEventLayout() { |
| 70 | } |
| 71 | |
| 72 | private static final IKernelAnalysisEventLayout INSTANCE = new LttngEventLayout(); |
| 73 | |
| 74 | /** |
| 75 | * Get an instance of this event layout |
| 76 | * |
| 77 | * This object is completely immutable, so no need to create additional |
| 78 | * instances via the constructor. |
| 79 | * |
| 80 | * @return The instance |
| 81 | */ |
| 82 | public static IKernelAnalysisEventLayout getInstance() { |
| 83 | return INSTANCE; |
| 84 | } |
| 85 | |
| 86 | // ------------------------------------------------------------------------ |
| 87 | // Event names |
| 88 | // ------------------------------------------------------------------------ |
| 89 | |
| 90 | @Override |
| 91 | public String eventIrqHandlerEntry() { |
| 92 | return IRQ_HANDLER_ENTRY; |
| 93 | } |
| 94 | |
| 95 | @Override |
| 96 | public String eventIrqHandlerExit() { |
| 97 | return IRQ_HANDLER_EXIT; |
| 98 | } |
| 99 | |
| 100 | @Override |
| 101 | public String eventSoftIrqEntry() { |
| 102 | return SOFTIRQ_ENTRY; |
| 103 | } |
| 104 | |
| 105 | @Override |
| 106 | public String eventSoftIrqExit() { |
| 107 | return SOFTIRQ_EXIT; |
| 108 | } |
| 109 | |
| 110 | @Override |
| 111 | public String eventSoftIrqRaise() { |
| 112 | return SOFTIRQ_RAISE; |
| 113 | } |
| 114 | |
| 115 | @Override |
| 116 | public String eventSchedSwitch() { |
| 117 | return SCHED_SWITCH; |
| 118 | } |
| 119 | |
| 120 | @Override |
| 121 | public Collection<String> eventsSchedWakeup() { |
| 122 | return SCHED_WAKEUP_EVENTS; |
| 123 | } |
| 124 | |
| 125 | @Override |
| 126 | public String eventSchedProcessFork() { |
| 127 | return SCHED_PROCESS_FORK; |
| 128 | } |
| 129 | |
| 130 | @Override |
| 131 | public String eventSchedProcessExit() { |
| 132 | return SCHED_PROCESS_EXIT; |
| 133 | } |
| 134 | |
| 135 | @Override |
| 136 | public String eventSchedProcessFree() { |
| 137 | return SCHED_PROCESS_FREE; |
| 138 | } |
| 139 | |
| 140 | @Override |
| 141 | public @NonNull String eventStatedumpProcessState() { |
| 142 | return STATEDUMP_PROCESS_STATE; |
| 143 | } |
| 144 | |
| 145 | @Override |
| 146 | public String eventSyscallEntryPrefix() { |
| 147 | return SYSCALL_ENTRY_PREFIX; |
| 148 | } |
| 149 | |
| 150 | @Override |
| 151 | public String eventCompatSyscallEntryPrefix() { |
| 152 | return COMPAT_SYSCALL_ENTRY_PREFIX; |
| 153 | } |
| 154 | |
| 155 | @Override |
| 156 | public String eventSyscallExitPrefix() { |
| 157 | return SYSCALL_EXIT_PREFIX; |
| 158 | } |
| 159 | |
| 160 | // ------------------------------------------------------------------------ |
| 161 | // Event field names |
| 162 | // ------------------------------------------------------------------------ |
| 163 | |
| 164 | @Override |
| 165 | public String fieldIrq() { |
| 166 | return IRQ; |
| 167 | } |
| 168 | |
| 169 | @Override |
| 170 | public String fieldVec() { |
| 171 | return VEC; |
| 172 | } |
| 173 | |
| 174 | @Override |
| 175 | public String fieldTid() { |
| 176 | return TID; |
| 177 | } |
| 178 | |
| 179 | @Override |
| 180 | public String fieldPrevTid() { |
| 181 | return PREV_TID; |
| 182 | } |
| 183 | |
| 184 | @Override |
| 185 | public String fieldPrevState() { |
| 186 | return PREV_STATE; |
| 187 | } |
| 188 | |
| 189 | @Override |
| 190 | public String fieldNextComm() { |
| 191 | return NEXT_COMM; |
| 192 | } |
| 193 | |
| 194 | @Override |
| 195 | public String fieldNextTid() { |
| 196 | return NEXT_TID; |
| 197 | } |
| 198 | |
| 199 | @Override |
| 200 | public String fieldChildComm() { |
| 201 | return CHILD_COMM; |
| 202 | } |
| 203 | |
| 204 | @Override |
| 205 | public String fieldParentTid() { |
| 206 | return PARENT_TID; |
| 207 | } |
| 208 | |
| 209 | @Override |
| 210 | public String fieldChildTid() { |
| 211 | return CHILD_TID; |
| 212 | } |
| 213 | |
| 214 | } |