1 /*******************************************************************************
2 * Copyright (c) 2014, 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 java
.util
.Collection
;
17 import org
.eclipse
.jdt
.annotation
.Nullable
;
20 * Interface to define "concepts" present in the Linux kernel (represented by
21 * its tracepoints), that can then be exposed by different tracers under
24 * @author Alexandre Montplaisir
25 * @author Matthew Khouzam - Javadoc
27 public interface IKernelAnalysisEventLayout
{
29 // ------------------------------------------------------------------------
31 // ------------------------------------------------------------------------
34 * The standard layout, very useful for test vectors that are not kernel
37 IKernelAnalysisEventLayout DEFAULT_LAYOUT
= DefaultEventLayout
.INSTANCE
;
40 * Whenever a process appears for the first time in a trace, we assume it
41 * starts inside this system call. (The syscall prefix is defined by the
42 * implementer of this interface.)
44 * TODO Change to a default method with Java 8?
46 String INITIAL_SYSCALL_NAME
= "clone"; //$NON-NLS-1$
48 // ------------------------------------------------------------------------
50 // ------------------------------------------------------------------------
53 * The system has just entered an interrupt handler or interrupt service
54 * routine. On some systems, this is known as the first level interrupt
57 * @return the event name
59 String
eventIrqHandlerEntry();
62 * The system will soon return from an interrupt handler or interrupt
65 * @return the event name
67 String
eventIrqHandlerExit();
70 * Whenever a system call is about to return to userspace, or a hardware
71 * interrupt handler exits, any 'software interrupts' which are marked
72 * pending (usually by hardware interrupts) are run. Much of the real
73 * interrupt handling work is done here. The soft IRQ is also known as a
74 * deferred IRQ in windows. An event identifying as this needs to occur as
75 * the system is beginning to process the interrupt.
77 * @return the event name
79 String
eventSoftIrqEntry();
82 * Whenever a system call is about to return to userspace, or a hardware
83 * interrupt handler exits, any 'software interrupts' which are marked
84 * pending (usually by hardware interrupts) are run Much of the real
85 * interrupt handling work is done here. The soft IRQ is also known as a
86 * deferred IRQ in windows. An event identifying as this needs to occur as
87 * the system is returning from the interrupt.
89 * @return the event name
91 String
eventSoftIrqExit();
94 * Whenever a system call is about to return to userspace, or a hardware
95 * interrupt handler exits, any 'software interrupts' which are marked
96 * pending (usually by hardware interrupts) are run Much of the real
97 * interrupt handling work is done here. The soft IRQ is also known as a
98 * deferred IRQ in windows. An event identifying as this needs to occur as
99 * the system is signaling the need to enter the interrupt.
101 * @return the event name
103 String
eventSoftIrqRaise();
106 * The scheduler will call a scheduler switch event when it is removing a
107 * task from a cpu and placing another one in its place. Which task and when
108 * depend on the scheduling strategy and the task priorities. This is a
111 * @return the event name
113 String
eventSchedSwitch();
116 * sched_PI_setprio is a tracepoint called often when the schedulder
117 * priorities for a given task changes.
119 * @return the event name
122 String
eventSchedPiSetprio();
125 * Scheduler is waking up a task. this happens before it is executed, and
126 * the data is loaded in memory if needed.
128 * @return the event names, as there are often several different ways to
131 Collection
<String
> eventsSchedWakeup();
134 * Scheduler just forked a process, that means it has duplicated the program
135 * and assigned it a different process ID. This event is often followed by
136 * an {@link #eventSchedProcessExec()}. In windows, this is part of the
139 * @return the event name
141 String
eventSchedProcessFork();
144 * The process has finished running and the scheduler takes its TID back.
146 * @return the event name
148 String
eventSchedProcessExit();
151 * The process free tracepoint is called when a process has finished running
152 * and the scheduler retrieves it's process ID.
154 * @return the event name
156 String
eventSchedProcessFree();
159 * Optional event used by some tracers to deliver an initial state.
161 * @return the event name
163 @Nullable String
eventStatedumpProcessState();
166 * System call entry prefix, something like "sys_open" or just "sys".
168 * @return the event name
170 String
eventSyscallEntryPrefix();
173 * System call compatibility layer entry prefix, something like
176 * @return the event name
178 String
eventCompatSyscallEntryPrefix();
181 * System call exit prefix, something like "sys_exit".
183 * @return the event name
185 String
eventSyscallExitPrefix();
188 * System call compatibility layer exit prefix, something like
189 * "compat_syscall_exit".
191 * @return the event name
194 String
eventCompatSyscallExitPrefix();
197 * The scheduler replaced the current process image with a new one. The
198 * process should also be renamed at this point. In windows, this is part of
199 * the spawn process as well as fork.
201 * @return the event name
205 String
eventSchedProcessExec();
208 * The scheduler calls wakeup on a sleeping process. The process will
209 * probably soon be scheduled in.
211 * @return the event name
215 String
eventSchedProcessWakeup();
218 * The scheduler calls wakeup on a sleeping process. The process will
219 * probably soon be scheduled in. The new wakeup knows who triggered the
222 * @return the event name
226 String
eventSchedProcessWakeupNew();
230 * Starting the high resolution timer
232 * In Linux, High resolution timers are used in the following:
236 * <li>posix timers</li>
239 * @return the event name
243 String
eventHRTimerStart();
246 * Canceling the high resolution timer
248 * In Linux, High resolution timers are used in the following:
252 * <li>posix timers</li>
255 * @return the event name
259 String
eventHRTimerCancel();
262 * Entering the high resolution timer expired handler.
264 * In Linux, High resolution timers are used in the following:
268 * <li>posix timers</li>
271 * @return the event name
275 String
eventHRTimerExpireEntry();
278 * Exiting the high resolution timer expired handler.
280 * In Linux, High resolution timers are used in the following:
284 * <li>posix timers</li>
287 * @return the event name
291 String
eventHRTimerExpireExit();
293 // ------------------------------------------------------------------------
295 // ------------------------------------------------------------------------
298 * The field with the IRQ number. This is used in irq_handlers (entry and
299 * exit). For soft IRQs see {@link #fieldVec}.
301 * @return the name of the field with the IRQ number
306 * The field with the vector. This is the soft IRQ vector field used in soft
307 * IRQ raise, entry and exit. For hardware IRQs see {@link #fieldIrq}.
309 * @return the name of the field with the soft IRQ vector name
314 * The field with the thread ID. This is often used in scheduler calls to
315 * know which thread is being affected. (normally not in switch, but in
316 * priority and wakeup calls).
318 * @return the name of the field with the thread ID
323 * The field with the previous thread id. This is used in switching
324 * operations of a scheduler, when a thread is scheduled out for another,
325 * this field shows the thread id being scheduled out.
327 * @return The name of the field with the ID of the previous thread
329 String
fieldPrevTid();
332 * The field with the state of the previous thread. This is used in
333 * switching operations of a scheduler, when a thread is scheduled out for
334 * another, this field shows the state of the thread being scheduled out.
336 * @return the name of the field of the previous thread's state
338 String
fieldPrevState();
341 * The field with the next command to be run. This is used in switching
342 * operations of a scheduler, when a thread is scheduled out for another,
343 * this field shows the command being scheduled in. A command's value is
344 * often a String like "ls" or "hl3.exe".
346 * @return the name of the field with the next command to be run
348 String
fieldNextComm();
351 * The field with the next thread ID. This is used in switching operations
352 * of a scheduler, when a thread is scheduled out for another, this field
353 * shows the thread being scheduled in.
355 * @return the name of the field with the next thread ID
357 String
fieldNextTid();
360 * The field with the child command. This field is used in clone and spawn
361 * activities, to know which executable the clone is running.
363 * @return the name of the field with the child command
365 String
fieldChildComm();
368 * The field with the parent thread ID. This field is used in clone and
369 * spawn activities, to know which thread triggered the clone.
371 * @return the name of the field with the parent thread ID
373 String
fieldParentTid();
376 * The field with the child thread ID. This field is used in clone and spawn
377 * activities, to know which thread is the clone.
379 * @return the name of the field with the child thread ID
381 String
fieldChildTid();
384 * The field with the command. This is used in scheduling tracepoints that
385 * are not switches, and show the current process name. It is often a string
386 * like "zsh" or "cmd.exe".
388 * @return the name of the command field
394 * The field with the name. The name field is used in several disjoint
399 * <li>writeback_* - the name of the io device, often "(unknown)"</li>
400 * <li>module_* - the name of the module such as "binfmt_misc"</li>
401 * <li>irq_handler_entry - the field describes the name of the handler such
405 * @return the name of the field with a name
411 * The field with the status. Often functions like a return value before we
416 * <li>ext4* - status</li>
417 * <li>asoc_snd_soc_cache_sync</li>
419 * <li>state dumps</li>
422 * @return The name of the field with a status
425 String
fieldStatus();
428 * The field with the last command to be run. This is often a string
429 * representing the command of the thread being scheduled out from a
430 * scheduler switch operation.
432 * @return the name of the field with the last command to be run
435 String
fieldPrevComm();
438 * The field with the file name field. This is a string used mostly with
439 * file operations. These operations are often wrapped in system calls and
443 * <li>change mode</li>
444 * <li>change directory</li>
447 * It can also be used in exec commands to see what the command name should
450 * Please note that file read and write often do not use the file name, they
451 * just use the file handle.
453 * @return the name of the field with the file name
456 String
fieldFilename();
459 * The field with the priority. The priority of a given process is used by
460 * most scheduler events. The major exception is the switching operation as
461 * it has two processes so it has a previous and next priority.
463 * @return the name of the field with the thread or process' priority
469 * The field with the new priority. This is used in the scheduler's
470 * pi_setprio event event to show the new priority of the thread or process.
472 * @return the name of the field with the thread or process' new priority
475 String
fieldNewPrio();
478 * The field with the next priority. This is used in the scheduler's switch
479 * event to show the priority of the next thread or process.
481 * @return the name of the field with the thread or process' next priority
484 String
fieldNextPrio();
487 * The field with the hrtimer. The hrtimer holds the timer instance.
489 * @return the name of the hrTimer field
492 String
fieldHRtimer();
495 * The field with the expires value. The expires field holds the expiry time.
498 * @return the name of the expires field
501 String
fieldHRtimerExpires();
504 * Gets the field name with the softexpires value. The softexpire value is the
505 * absolute earliest expiry time of the hrtimer.
507 * @return the name of the softexpires field
510 String
fieldHRtimerSoftexpires();
513 * The field of the function address value. The function field holds timer
514 * expiry callback function.
516 * @return the name of the function field
519 String
fieldHRtimerFunction();
522 * The field of the now value. The now field holds the current time.
524 * @return the name of the now field (hrtimer)
527 String
fieldHRtimerNow();