Import lttng.kernel.core plugins from Scope
[deliverable/tracecompass.git] / lttng / org.lttng.scope.lttng.kernel.core / src / org / lttng / scope / lttng / kernel / core / trace / layout / ILttngKernelEventLayout.java
CommitLineData
af3275f8
AM
1/*******************************************************************************
2 * Copyright (c) 2014, 2015 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
13package org.lttng.scope.lttng.kernel.core.trace.layout;
14
15import java.util.Collection;
16import java.util.Collections;
17
18import org.eclipse.jdt.annotation.Nullable;
19
20/**
21 * Interface to define "concepts" present in the Linux kernel (represented by
22 * its tracepoints), that can then be exposed by different tracers under
23 * different names.
24 *
25 * @author Alexandre Montplaisir
26 * @author Matthew Khouzam - Javadoc
27 */
28public interface ILttngKernelEventLayout {
29
30 // ------------------------------------------------------------------------
31 // Common definitions
32 // ------------------------------------------------------------------------
33
34 /**
35 * Whenever a process appears for the first time in a trace, we assume it
36 * starts inside this system call. (The syscall prefix is defined by the
37 * implementer of this interface.)
38 *
39 * TODO Change to a default method with Java 8?
40 */
41 String INITIAL_SYSCALL_NAME = "clone"; //$NON-NLS-1$
42
43 // ------------------------------------------------------------------------
44 // Event names
45 // ------------------------------------------------------------------------
46
47 /**
48 * The system has just entered an interrupt handler or interrupt service
49 * routine. On some systems, this is known as the first level interrupt
50 * handler.
51 *
52 * @return the event name
53 */
54 String eventIrqHandlerEntry();
55
56 /**
57 * The system will soon return from an interrupt handler or interrupt
58 * service routine.
59 *
60 * @return the event name
61 */
62 String eventIrqHandlerExit();
63
64 /**
65 * Whenever a system call is about to return to userspace, or a hardware
66 * interrupt handler exits, any 'software interrupts' which are marked
67 * pending (usually by hardware interrupts) are run. Much of the real
68 * interrupt handling work is done here. The soft IRQ is also known as a
69 * deferred IRQ in windows. An event identifying as this needs to occur as
70 * the system is beginning to process the interrupt.
71 *
72 * @return the event name
73 */
74 String eventSoftIrqEntry();
75
76 /**
77 * Whenever a system call is about to return to userspace, or a hardware
78 * interrupt handler exits, any 'software interrupts' which are marked
79 * pending (usually by hardware interrupts) are run Much of the real
80 * interrupt handling work is done here. The soft IRQ is also known as a
81 * deferred IRQ in windows. An event identifying as this needs to occur as
82 * the system is returning from the interrupt.
83 *
84 * @return the event name
85 */
86 String eventSoftIrqExit();
87
88 /**
89 * Whenever a system call is about to return to userspace, or a hardware
90 * interrupt handler exits, any 'software interrupts' which are marked
91 * pending (usually by hardware interrupts) are run Much of the real
92 * interrupt handling work is done here. The soft IRQ is also known as a
93 * deferred IRQ in windows. An event identifying as this needs to occur as
94 * the system is signaling the need to enter the interrupt.
95 *
96 * @return the event name
97 */
98 String eventSoftIrqRaise();
99
100 /**
101 * The scheduler will call a scheduler switch event when it is removing a
102 * task from a cpu and placing another one in its place. Which task and when
103 * depend on the scheduling strategy and the task priorities. This is a
104 * context switch.
105 *
106 * @return the event name
107 */
108 String eventSchedSwitch();
109
110 /**
111 * sched_PI_setprio is a tracepoint called often when the schedulder
112 * priorities for a given task changes.
113 *
114 * @return the event name
115 */
116 String eventSchedPiSetprio();
117
118 /**
119 * Scheduler is waking up a task. this happens before it is executed, and
120 * the data is loaded in memory if needed.
121 *
122 * @return the event names, as there are often several different ways to
123 * wake up
124 */
125 Collection<String> eventsSchedWakeup();
126
127 /**
128 * Scheduler just forked a process, that means it has duplicated the program
129 * and assigned it a different process ID. This event is often followed by
130 * an {@link #eventSchedProcessExec()}. In windows, this is part of the
131 * "spawn" process.
132 *
133 * @return the event name
134 */
135 String eventSchedProcessFork();
136
137 /**
138 * The process has finished running and the scheduler takes its TID back.
139 *
140 * @return the event name
141 */
142 String eventSchedProcessExit();
143
144 /**
145 * The process free tracepoint is called when a process has finished running
146 * and the scheduler retrieves it's process ID.
147 *
148 * @return the event name
149 */
150 String eventSchedProcessFree();
151
152 /**
153 * Optional event used by some tracers to deliver an initial state.
154 *
155 * @return the event name
156 */
157 @Nullable String eventStatedumpProcessState();
158
159 /**
160 * System call entry prefix, something like "sys_open" or just "sys".
161 *
162 * @return the event name
163 */
164 String eventSyscallEntryPrefix();
165
166 /**
167 * System call compatibility layer entry prefix, something like
168 * "compat_sys".
169 *
170 * @return the event name
171 */
172 String eventCompatSyscallEntryPrefix();
173
174 /**
175 * System call exit prefix, something like "sys_exit".
176 *
177 * @return the event name
178 */
179 String eventSyscallExitPrefix();
180
181 /**
182 * System call compatibility layer exit prefix, something like
183 * "compat_syscall_exit".
184 *
185 * @return the event name
186 */
187 String eventCompatSyscallExitPrefix();
188
189 /**
190 * The scheduler replaced the current process image with a new one. The
191 * process should also be renamed at this point. In windows, this is part of
192 * the spawn process as well as fork.
193 *
194 * @return the event name
195 */
196 String eventSchedProcessExec();
197
198 /**
199 * The scheduler calls wakeup on a sleeping process. The process will
200 * probably soon be scheduled in.
201 *
202 * @return the event name
203 */
204 String eventSchedProcessWakeup();
205
206 /**
207 * The scheduler calls wakeup on a sleeping process. The process will
208 * probably soon be scheduled in. The new wakeup knows who triggered the
209 * wakeup.
210 *
211 * @return the event name
212 */
213 String eventSchedProcessWakeupNew();
214
215 /**
216 * Event called when waking a task; this event is guaranteed to be called
217 * from the waking context.
218 *
219 * @return The name of the event
220 */
221 default String eventSchedProcessWaking() {
222 return "sched_waking"; //$NON-NLS-1$
223 }
224
225 /**
226 * Migration event, moving a non-running thread from one CPU's run queue to
227 * another.
228 *
229 * @return The event name
230 */
231 String eventSchedMigrateTask();
232
233 /**
234 * Starting the high resolution timer
235 * <p>
236 * In Linux, High resolution timers are used in the following:
237 * <ul>
238 * <li>nanosleep</li>
239 * <li>itimers</li>
240 * <li>posix timers</li>
241 * </ul>
242 *
243 * @return the event name
244 */
245 String eventHRTimerStart();
246
247 /**
248 * Canceling the high resolution timer
249 * <p>
250 * In Linux, High resolution timers are used in the following:
251 * <ul>
252 * <li>nanosleep</li>
253 * <li>itimers</li>
254 * <li>posix timers</li>
255 * </ul>
256 *
257 * @return the event name
258 */
259 String eventHRTimerCancel();
260
261 /**
262 * Entering the high resolution timer expired handler.
263 * <p>
264 * In Linux, High resolution timers are used in the following:
265 * <ul>
266 * <li>nanosleep</li>
267 * <li>itimers</li>
268 * <li>posix timers</li>
269 * </ul>
270 *
271 * @return the event name
272 */
273 String eventHRTimerExpireEntry();
274
275 /**
276 * Exiting the high resolution timer expired handler.
277 * <p>
278 * In Linux, High resolution timers are used in the following:
279 * <ul>
280 * <li>nanosleep</li>
281 * <li>itimers</li>
282 * <li>posix timers</li>
283 * </ul>
284 *
285 * @return the event name
286 */
287 String eventHRTimerExpireExit();
288
289 /**
290 * The kernel just allocated a page of memory.
291 * <p>
292 * In Linux, this typically means a user space application just got a page
293 * of ram.
294 *
295 * @return the event name
296 */
297 String eventKmemPageAlloc();
298
299 /**
300 * The kernel just deallocated a page of memory.
301 * <p>
302 * In Linux, this typically means a page of ram was just freed
303 *
304 * @return the event name
305 */
306 String eventKmemPageFree();
307
308 /**
309 * <em>Interprocessor interrupts</em> (IPIs) are special types of interrupts by which
310 * one processor will interrupt another in a multi-core and multi-cpu system. They are
311 * typically used for
312 * <ol>
313 * <li>cache flushes</li>
314 * <li>shutdowns</li>
315 * <ol>
316 * They are not logged with standard events, but rather events looking like
317 * "x86_irq_vectors_thermal_apic_exit".
318 * <p>
319 * This event describes the entries into IPIs.
320 *
321 * @return the IPI list
322 */
323 default Collection<String> getIPIIrqVectorsEntries() {
324 return Collections.emptyList();
325 }
326
327 /**
328 * <em>Interprocessor interrupts</em> (IPIs) are special types of interrupts by which
329 * one processor will interrupt another in a multi-core and multi-cpu system. They are
330 * typically used for
331 * <ol>
332 * <li>cache flushes</li>
333 * <li>shutdowns</li>
334 * <ol>
335 * They are not logged with standard events, but rather events looking like
336 * "x86_irq_vectors_thermal_apic_exit".
337 * <p>
338 * This event describes the exits into IPIs.
339 *
340 * @return the IPI list
341 */
342 default Collection<String> getIPIIrqVectorsExits() {
343 return Collections.emptyList();
344 }
345
346 // ------------------------------------------------------------------------
347 // Event field names
348 // ------------------------------------------------------------------------
349
350 /**
351 * The field with the IRQ number. This is used in irq_handlers (entry and
352 * exit). For soft IRQs see {@link #fieldVec}.
353 *
354 * @return the name of the field with the IRQ number
355 */
356 String fieldIrq();
357
358 /**
359 * The field with the vector. This is the soft IRQ vector field used in soft
360 * IRQ raise, entry and exit. For hardware IRQs see {@link #fieldIrq}.
361 *
362 * @return the name of the field with the soft IRQ vector name
363 */
364 String fieldVec();
365
366 /**
367 * The field with the thread ID. This is often used in scheduler calls to
368 * know which thread is being affected. (normally not in switch, but in
369 * priority and wakeup calls).
370 *
371 * @return the name of the field with the thread ID
372 */
373 String fieldTid();
374
375 /**
376 * The field with the previous thread id. This is used in switching
377 * operations of a scheduler, when a thread is scheduled out for another,
378 * this field shows the thread id being scheduled out.
379 *
380 * @return The name of the field with the ID of the previous thread
381 */
382 String fieldPrevTid();
383
384 /**
385 * The field with the state of the previous thread. This is used in
386 * switching operations of a scheduler, when a thread is scheduled out for
387 * another, this field shows the state of the thread being scheduled out.
388 *
389 * @return the name of the field of the previous thread's state
390 */
391 String fieldPrevState();
392
393 /**
394 * The field with the next command to be run. This is used in switching
395 * operations of a scheduler, when a thread is scheduled out for another,
396 * this field shows the command being scheduled in. A command's value is
397 * often a String like "ls" or "hl3.exe".
398 *
399 * @return the name of the field with the next command to be run
400 */
401 String fieldNextComm();
402
403 /**
404 * The field with the next thread ID. This is used in switching operations
405 * of a scheduler, when a thread is scheduled out for another, this field
406 * shows the thread being scheduled in.
407 *
408 * @return the name of the field with the next thread ID
409 */
410 String fieldNextTid();
411
412 /**
413 * The field with the child command. This field is used in clone and spawn
414 * activities, to know which executable the clone is running.
415 *
416 * @return the name of the field with the child command
417 */
418 String fieldChildComm();
419
420 /**
421 * The field with the parent thread ID. This field is used in clone and
422 * spawn activities, to know which thread triggered the clone.
423 *
424 * @return the name of the field with the parent thread ID
425 */
426 String fieldParentTid();
427
428 /**
429 * The field with the child thread ID. This field is used in clone and spawn
430 * activities, to know which thread is the clone.
431 *
432 * @return the name of the field with the child thread ID
433 */
434 String fieldChildTid();
435
436 /**
437 * The field with the command. This is used in scheduling tracepoints that
438 * are not switches, and show the current process name. It is often a string
439 * like "zsh" or "cmd.exe".
440 *
441 * @return the name of the command field
442 */
443 String fieldComm();
444
445 /**
446 * The field with the name. The name field is used in several disjoint
447 * events.
448 * <p>
449 * Examples include:
450 * <ul>
451 * <li>writeback_* - the name of the io device, often "(unknown)"</li>
452 * <li>module_* - the name of the module such as "binfmt_misc"</li>
453 * <li>irq_handler_entry - the field describes the name of the handler such
454 * as "i915"</li>
455 * <ul>
456 *
457 * @return the name of the field with a name
458 */
459 String fieldName();
460
461 /**
462 * The field with the status. Often functions like a return value before we
463 * hit an exit.
464 * <p>
465 * Examples include:
466 * <ul>
467 * <li>ext4* - status</li>
468 * <li>asoc_snd_soc_cache_sync</li>
469 * <li>rpc_*</li>
470 * <li>state dumps</li>
471 * </ul>
472 *
473 * @return The name of the field with a status
474 */
475 String fieldStatus();
476
477 /**
478 * The field with the last command to be run. This is often a string
479 * representing the command of the thread being scheduled out from a
480 * scheduler switch operation.
481 *
482 * @return the name of the field with the last command to be run
483 */
484 String fieldPrevComm();
485
486 /**
487 * The field with the file name field. This is a string used mostly with
488 * file operations. These operations are often wrapped in system calls and
489 * can be:
490 * <ul>
491 * <li>open</li>
492 * <li>change mode</li>
493 * <li>change directory</li>
494 * <li>stat</li>
495 * </ul>
496 * It can also be used in exec commands to see what the command name should
497 * be.
498 * <p>
499 * Please note that file read and write often do not use the file name, they
500 * just use the file handle.
501 *
502 * @return the name of the field with the file name
503 */
504 String fieldFilename();
505
506 /**
507 * The field with the priority. The priority of a given process is used by
508 * most scheduler events. The major exception is the switching operation as
509 * it has two processes so it has a previous and next priority.
510 *
511 * @return the name of the field with the thread or process' priority
512 */
513 String fieldPrio();
514
515 /**
516 * The field with the new priority. This is used in the scheduler's
517 * pi_setprio event event to show the new priority of the thread or process.
518 *
519 * @return the name of the field with the thread or process' new priority
520 */
521 String fieldNewPrio();
522
523 /**
524 * The field with the prev priority. This is used in the scheduler's switch
525 * event to show the priority of the thread being scheduled out.
526 *
527 * @return the name of the field with the priority of the previous thread
528 */
529 String fieldPrevPrio();
530
531 /**
532 * The field with the next priority. This is used in the scheduler's switch
533 * event to show the priority of the next thread or process.
534 *
535 * @return the name of the field with the thread or process' next priority
536 */
537 String fieldNextPrio();
538
539 /**
540 * The field with the hrtimer. The hrtimer holds the timer instance.
541 *
542 * @return the name of the hrTimer field
543 */
544 String fieldHRtimer();
545
546 /**
547 * The field with the expires value. The expires field holds the expiry
548 * time. of the hrtimer.
549 *
550 * @return the name of the expires field
551 */
552 String fieldHRtimerExpires();
553
554 /**
555 * Gets the field name with the softexpires value. The softexpire value is
556 * the absolute earliest expiry time of the hrtimer.
557 *
558 * @return the name of the softexpires field
559 */
560 String fieldHRtimerSoftexpires();
561
562 /**
563 * The field of the function address value. The function field holds timer
564 * expiry callback function.
565 *
566 * @return the name of the function field
567 */
568 String fieldHRtimerFunction();
569
570 /**
571 * The field of the now value. The now field holds the current time.
572 *
573 * @return the name of the now field (hrtimer)
574 */
575 String fieldHRtimerNow();
576
577 /**
578 * The field containing the return value of a system call exit.
579 *
580 * @return The name of return field
581 */
582 default String fieldSyscallRet() {
583 return "ret"; //$NON-NLS-1$
584 }
585
586 /**
587 * Field indicating the upcoming CPU of sched_wakeup and sched_waking
588 * events.
589 *
590 * @return The field name
591 */
592 default String fieldTargetCpu() {
593 return "target_cpu"; //$NON-NLS-1$
594 }
595
596 /**
597 * Field of scheduler migration events, indicating the destination CPU of a
598 * thread being migrated.
599 *
600 * @return The field name
601 */
602 default String fieldDestCpu() {
603 return "dest_cpu"; //$NON-NLS-1$
604 }
605
606 // ------------------------------------------------------------------------
607 // I/O events and fields
608 // ------------------------------------------------------------------------
609
610 /**
611 * A request to a block IO has just been inserted in the waiting queue.
612 *
613 * @return The name of the event
614 */
615 default String eventBlockRqInsert() {
616 return "block_rq_insert"; //$NON-NLS-1$
617 }
618
619 /**
620 * A request to a block IO has just been issued and passed from the waiting
621 * queue to the driver queue. It is being served.
622 *
623 * @return The name of the event
624 */
625 default String eventBlockRqIssue() {
626 return "block_rq_issue"; //$NON-NLS-1$
627 }
628
629 /**
630 * A request to a block IO has just been completed.
631 *
632 * @return The name of the event
633 */
634 default String eventBlockRqComplete() {
635 return "block_rq_complete"; //$NON-NLS-1$
636 }
637
638 /**
639 * A BIO operation is being merged at the front of a waiting request
640 *
641 * @return The name of the event
642 */
643 default String eventBlockBioFrontmerge() {
644 return "block_bio_frontmerge"; //$NON-NLS-1$
645 }
646
647 /**
648 * A BIO operation is being merged at the back of a waiting request
649 *
650 * @return The name of the event
651 */
652 default String eventBlockBioBackmerge() {
653 return "block_bio_backmerge"; //$NON-NLS-1$
654 }
655
656 /**
657 * 2 requests previously inserted in the waiting queue are being merged
658 *
659 * @return The name of the event
660 */
661 default String eventBlockRqMerge() {
662 return "block_rq_merge"; //$NON-NLS-1$
663 }
664
665 /**
666 * Optional event used by some tracers to associate the name of the block
667 * device to a device ID
668 *
669 * @return The name of the event
670 */
671 default @Nullable String eventStatedumpBlockDevice() {
672 return null;
673 }
674
675 /**
676 * The field containing the device ID
677 *
678 * @return The name of the field
679 */
680 default String fieldBlockDeviceId() {
681 return "dev"; //$NON-NLS-1$
682 }
683
684 /**
685 * The field with the first sector of a block operation
686 *
687 * @return The name of the field
688 */
689 default String fieldBlockSector() {
690 return "sector"; //$NON-NLS-1$
691 }
692
693 /**
694 * The field with the number of sectors involved in a block operation
695 *
696 * @return The name of the field
697 */
698 default String fieldBlockNrSector() {
699 return "nr_sector"; //$NON-NLS-1$
700 }
701
702 /**
703 * The field containing the read/write flag of a block operation
704 *
705 * @return The name of the field
706 */
707 default String fieldBlockRwbs() {
708 return "rwbs"; //$NON-NLS-1$
709 }
710
711 /**
712 * The field with the first sector of a request in which another block
713 * operation is being merged
714 *
715 * @return The name of the field
716 */
717 default String fieldBlockRqSector() {
718 return "rq_sector"; //$NON-NLS-1$
719 }
720
721 /**
722 * The field with the sector of the request being merged in another one
723 *
724 * @return The name of the field
725 */
726 default String fieldBlockNextRqSector() {
727 return "nextrq_sector"; //$NON-NLS-1$
728 }
729
730 /**
731 * The field containing the name of the disk
732 *
733 * @return The name of the field
734 */
735 default String fieldDiskname() {
736 return "diskname"; //$NON-NLS-1$
737 }
738
739 /**
740 * The field with the IRQ number. This is used in IPI handlers (entry and
741 * exit).
742 *
743 * @return the name of the field with the IRQ number
744 */
745 default String fieldIPIVector() {
746 return "vector"; //$NON-NLS-1$
747 }
748
749
750 /**
751 * Get the name of the 'order' field from memory page allocation events.
752 *
753 * The 'order' of a page allocation is it's logarithm to the base 2, and the
754 * size of the allocation is 2^order, an integral power-of-2 number of
755 * pages. 'Order' ranges from from 0 to MAX_ORDER-1.
756 *
757 * The smallest - and most frequent - page allocation is 2^0 or 1 page. The
758 * maximum allocation possible is 2^(MAX_ORDER-1) pages. MAX_ORDER is
759 * assigned a default value of 11 - resulting in a maximum allocation of
760 * 2^10 or 1024 pages. However it may be redefined at kernel configuration
761 * time with the option CONFIG_FORCE_MAX_ZONEORDER.
762 *
763 * @return the name of the order field
764 */
765 default @Nullable String fieldOrder() {
766 return null;
767 }
768
769 // ------------------------------------------------------------------------
770 // Network events and fields
771 // ------------------------------------------------------------------------
772
773 /**
774 * Get the list of events indicating that a packet is sent on the network
775 *
776 * @return The name of the packet send event
777 */
778 default Collection<String> eventsNetworkSend() {
779 return Collections.EMPTY_SET;
780 }
781
782 /**
783 * Get the list of events indicating that a packet is received from the
784 * network
785 *
786 * @return The collection of names of the packet receive event
787 */
788 default Collection<String> eventsNetworkReceive() {
789 return Collections.EMPTY_SET;
790 }
791
792 /**
793 * The path of the field corresponding to the sequence number field of a TCP
794 * header
795 *
796 * @return The path of the sequence number field in the TCP header of a
797 * network packet
798 */
799 default String[] fieldPathTcpSeq() {
800 return new String[] { "seq" }; //$NON-NLS-1$
801 }
802
803 /**
804 * The path of the field corresponding to the acknowledgment number field of
805 * a TCP header
806 *
807 * @return The name of the acknowledgment number field in the TCP header of
808 * a network packet
809 */
810 default String[] fieldPathTcpAckSeq() {
811 return new String[] { "ack_seq" }; //$NON-NLS-1$
812 }
813
814 /**
815 * The path of the field corresponding to the flags field of a TCP header
816 *
817 * @return The path of the flags field in the TCP header of a network packet
818 */
819 default String[] fieldPathTcpFlags() {
820 return new String[] { "flags" }; //$NON-NLS-1$
821 }
822
823 // ------------------------------------------------------------------------
824 // VirtualMachine events : kvm entry/exit events
825 // ------------------------------------------------------------------------
826
827 /**
828 * KVM kernel event indicating that virtual machine code is being run
829 *
830 * @return The name of the kvm entry event
831 */
832 default Collection<String> eventsKVMEntry() {
833 return Collections.EMPTY_SET;
834 }
835
836 /**
837 * KVM kernel event indicating that virtual machine code is not run anymore,
838 * but rather hypervisor-specific code
839 *
840 * @return The name of the kvm exit event
841 */
842 default Collection<String> eventsKVMExit() {
843 return Collections.EMPTY_SET;
844 }
845
846}
This page took 0.055332 seconds and 5 git commands to generate.