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
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 *******************************************************************************/
12
13 package org.eclipse.linuxtools.lttng.ui.views.statistics.evProcessor;
14
15 import org.eclipse.linuxtools.lttng.core.event.LttngEvent;
16 import org.eclipse.linuxtools.lttng.core.state.StateStrings;
17 import org.eclipse.linuxtools.lttng.core.state.StateStrings.Events;
18 import org.eclipse.linuxtools.lttng.core.state.evProcessor.ILttngEventProcessor;
19 import org.eclipse.linuxtools.lttng.core.state.model.LttngTraceState;
20
21 /**
22 * Process the system call entry event
23 *
24 * @author alvaro
25 *
26 */
27 class StatsTimeCountHandlers {
28
29 /**
30 * Method to handle the event: LTT_EVENT_SYSCALL_ENTRY
31 *
32 * @return
33 */
34 final ILttngEventProcessor getSyscallEntryBeforeHandler() {
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 */
44 final ILttngEventProcessor getsySyscallExitBeforeHandler() {
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 */
54 final ILttngEventProcessor getTrapEntryBeforeHandler() {
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 */
64 final ILttngEventProcessor getTrapExitBeforeHandler() {
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 */
74 final ILttngEventProcessor getIrqEntryBeforeHandler() {
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 */
84 final ILttngEventProcessor getIrqExitBeforeHandler() {
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 */
94 final ILttngEventProcessor getSoftIrqEntryBeforeHandler() {
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 */
104 final ILttngEventProcessor getSoftIrqExitBeforeHandler() {
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 */
119 final ILttngEventProcessor getFunctionEntryBeforeHandler() {
120 AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_FUNCTION_ENTRY);
121 return handler;
122 }
123
124 /**
125 *
126 * @return
127 */
128 final ILttngEventProcessor getFunctionExitBeforeHandler() {
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 */
143 final ILttngEventProcessor getSchedChangeBeforeHandler() {
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 */
158 final ILttngEventProcessor getAfterHandler() {
159 AbstractStatsEventHandler handler = new StatsModeChangeHandler(null) {
160 int sched_hash = StateStrings.Events.LTT_EVENT_SCHED_SCHEDULE.getInName().hashCode();
161 @Override
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
177 return handler;
178 }
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>
189 * <p> Handles: {@link org.eclipse.linuxtools.lttng.core.state.StateStrings.Events#LTT_EVENT_PROCESS_EXIT}.</p>
190 * @return The handler.
191 */
192 ILttngEventProcessor getProcessExitHandler() {
193 return new StatsProcessExitHandler();
194 }
195 }
This page took 0.036645 seconds and 5 git commands to generate.