Re-structure LTTng sub-project as per the Linux Tools guidelines
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.ui / src / org / eclipse / linuxtools / lttng / ui / views / statistics / evProcessor / StatsTimeCountHandlers.java
CommitLineData
6e512b93
ASL
1/*******************************************************************************
2 * Copyright (c) 2009 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 * Yann N. Dauphin (dhaemon@gmail.com) - Implementation for stats
11 *******************************************************************************/
9dbeec54 12
6e512b93
ASL
13package org.eclipse.linuxtools.lttng.ui.views.statistics.evProcessor;
14
6c13869b
FC
15import org.eclipse.linuxtools.lttng.core.event.LttngEvent;
16import org.eclipse.linuxtools.lttng.core.state.StateStrings;
17import org.eclipse.linuxtools.lttng.core.state.StateStrings.Events;
18import org.eclipse.linuxtools.lttng.core.state.evProcessor.ILttngEventProcessor;
19import org.eclipse.linuxtools.lttng.core.state.model.LttngTraceState;
6e512b93
ASL
20
21/**
22 * Process the system call entry event
23 *
24 * @author alvaro
25 *
26 */
27class StatsTimeCountHandlers {
28
29 /**
30 * Method to handle the event: LTT_EVENT_SYSCALL_ENTRY
31 *
32 * @return
33 */
8827c197 34 final ILttngEventProcessor getSyscallEntryBeforeHandler() {
6e512b93
ASL
35 AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_SYSCALL_ENTRY);
36 return handler;
37 }
38
39 /**
40 * Method to handle the event: LTT_EVENT_SYSCALL_EXIT
41 *
42 * @return
43 */
8827c197 44 final ILttngEventProcessor getsySyscallExitBeforeHandler() {
6e512b93
ASL
45 AbstractStatsEventHandler handler = new StatsModeEndHandler(Events.LTT_EVENT_SYSCALL_EXIT);
46 return handler;
47 }
48
49 /**
50 * Method to handle the event: LTT_EVENT_TRAP_ENTRY
51 *
52 * @return
53 */
8827c197 54 final ILttngEventProcessor getTrapEntryBeforeHandler() {
6e512b93
ASL
55 AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_TRAP_ENTRY);
56 return handler;
57 }
58
59 /**
60 * Method to handle the event: LTT_EVENT_TRAP_EXIT
61 *
62 * @return
63 */
8827c197 64 final ILttngEventProcessor getTrapExitBeforeHandler() {
6e512b93
ASL
65 AbstractStatsEventHandler handler = new StatsModeEndHandler(Events.LTT_EVENT_TRAP_EXIT);
66 return handler;
67 }
68
69 /**
70 * Method to handle the event: LTT_EVENT_IRQ_ENTRY
71 *
72 * @return
73 */
8827c197 74 final ILttngEventProcessor getIrqEntryBeforeHandler() {
6e512b93
ASL
75 AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_IRQ_ENTRY);
76 return handler;
77 }
78
79 /**
80 * Method to handle the event: LTT_EVENT_IRQ_EXIT
81 *
82 * @return
83 */
8827c197 84 final ILttngEventProcessor getIrqExitBeforeHandler() {
6e512b93
ASL
85 AbstractStatsEventHandler handler = new StatsModeEndHandler(Events.LTT_EVENT_IRQ_EXIT);
86 return handler;
87 }
88
89 /**
90 * Method to handle the event: LTT_EVENT_SOFT_IRQ_ENTRY
91 *
92 * @return
93 */
8827c197 94 final ILttngEventProcessor getSoftIrqEntryBeforeHandler() {
6e512b93
ASL
95 AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_SOFT_IRQ_ENTRY);
96 return handler;
97 }
98
99 /**
100 * Method to handle the event: LTT_EVENT_SOFT_IRQ_EXIT
101 *
102 * @return
103 */
8827c197 104 final ILttngEventProcessor getSoftIrqExitBeforeHandler() {
6e512b93
ASL
105 AbstractStatsEventHandler handler = new StatsModeEndHandler(Events.LTT_EVENT_SOFT_IRQ_EXIT);
106 return handler;
107 }
108
109 /**
110 * <p>
111 * Handles event: LTT_EVENT_FUNCTION_ENTRY
112 * </p>
113 * <p>
114 * FIELDS: LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE
115 * </p>
116 *
117 * @return
118 */
8827c197 119 final ILttngEventProcessor getFunctionEntryBeforeHandler() {
6e512b93
ASL
120 AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_FUNCTION_ENTRY);
121 return handler;
122 }
123
124 /**
125 *
126 * @return
127 */
8827c197 128 final ILttngEventProcessor getFunctionExitBeforeHandler() {
6e512b93
ASL
129 AbstractStatsEventHandler handler = new StatsModeEndHandler(Events.LTT_EVENT_FUNCTION_EXIT);
130 return handler;
131 }
132
133 /**
134 * <p>
135 * Handles: LTT_EVENT_SCHED_SCHEDULE
136 * </p>
137 * <p>
138 * Fields: LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE
139 * </p>
140 *
141 * @return
142 */
8827c197 143 final ILttngEventProcessor getSchedChangeBeforeHandler() {
6e512b93
ASL
144 AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_SCHED_SCHEDULE);
145 return handler;
146 }
147
148 /**
149 * <p>
150 * Handles: LTT_EVENT_SCHED_SCHEDULE
151 * </p>
152 * <p>
153 * Fields: LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE
154 * </p>
155 *
156 * @return
157 */
8827c197
FC
158 final ILttngEventProcessor getAfterHandler() {
159 AbstractStatsEventHandler handler = new StatsModeChangeHandler(null) {
160 int sched_hash = StateStrings.Events.LTT_EVENT_SCHED_SCHEDULE.getInName().hashCode();
550d787e 161 @Override
8827c197
FC
162 public boolean process(LttngEvent event, LttngTraceState traceState) {
163 // Step the event counter for any after event
164 stepCount(event, traceState);
165
166 int eventNameHash = event.getMarkerName().hashCode();
167 // specific processing for after sched schedule
168 if (sched_hash == eventNameHash
169 && event.getMarkerName().equals(StateStrings.Events.LTT_EVENT_SCHED_SCHEDULE.getInName())) {
170 return super.process(event, traceState);
171 }
172
173 return false;
174 }
175 };
176
6e512b93
ASL
177 return handler;
178 }
9dbeec54
FC
179 /**
180 * <h4>Get the trace end handler</h4>
181 * <p>Allow to do some calculations when the trace is finished.</p>
182 * @return The handler.
183 */
184 ILttngEventProcessor getTracesetEndHandler() {
185 return new StatsTracesetEndHandler();
186 }
187 /**
188 * <h4>Get the process exit handler</h4>
6c13869b 189 * <p> Handles: {@link org.eclipse.linuxtools.lttng.core.state.StateStrings.Events#LTT_EVENT_PROCESS_EXIT}.</p>
9dbeec54
FC
190 * @return The handler.
191 */
192 ILttngEventProcessor getProcessExitHandler() {
193 return new StatsProcessExitHandler();
194 }
6e512b93 195}
This page took 0.038578 seconds and 5 git commands to generate.