2fb581e2e37ec0288eb5f66e1c8d2125573bb41f
[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 package org.eclipse.linuxtools.lttng.ui.views.statistics.evProcessor;
13
14 import org.eclipse.linuxtools.lttng.event.LttngEvent;
15 import org.eclipse.linuxtools.lttng.state.StateStrings;
16 import org.eclipse.linuxtools.lttng.state.StateStrings.Events;
17 import org.eclipse.linuxtools.lttng.state.evProcessor.ILttngEventProcessor;
18 import org.eclipse.linuxtools.lttng.state.model.LttngTraceState;
19
20 /**
21 * Process the system call entry event
22 *
23 * @author alvaro
24 *
25 */
26 class StatsTimeCountHandlers {
27
28 /**
29 * Method to handle the event: LTT_EVENT_SYSCALL_ENTRY
30 *
31 * @return
32 */
33 final ILttngEventProcessor getSyscallEntryBeforeHandler() {
34 AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_SYSCALL_ENTRY);
35 return handler;
36 }
37
38 /**
39 * Method to handle the event: LTT_EVENT_SYSCALL_EXIT
40 *
41 * @return
42 */
43 final ILttngEventProcessor getsySyscallExitBeforeHandler() {
44 AbstractStatsEventHandler handler = new StatsModeEndHandler(Events.LTT_EVENT_SYSCALL_EXIT);
45 return handler;
46 }
47
48 /**
49 * Method to handle the event: LTT_EVENT_TRAP_ENTRY
50 *
51 * @return
52 */
53 final ILttngEventProcessor getTrapEntryBeforeHandler() {
54 AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_TRAP_ENTRY);
55 return handler;
56 }
57
58 /**
59 * Method to handle the event: LTT_EVENT_TRAP_EXIT
60 *
61 * @return
62 */
63 final ILttngEventProcessor getTrapExitBeforeHandler() {
64 AbstractStatsEventHandler handler = new StatsModeEndHandler(Events.LTT_EVENT_TRAP_EXIT);
65 return handler;
66 }
67
68 /**
69 * Method to handle the event: LTT_EVENT_IRQ_ENTRY
70 *
71 * @return
72 */
73 final ILttngEventProcessor getIrqEntryBeforeHandler() {
74 AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_IRQ_ENTRY);
75 return handler;
76 }
77
78 /**
79 * Method to handle the event: LTT_EVENT_IRQ_EXIT
80 *
81 * @return
82 */
83 final ILttngEventProcessor getIrqExitBeforeHandler() {
84 AbstractStatsEventHandler handler = new StatsModeEndHandler(Events.LTT_EVENT_IRQ_EXIT);
85 return handler;
86 }
87
88 /**
89 * Method to handle the event: LTT_EVENT_SOFT_IRQ_ENTRY
90 *
91 * @return
92 */
93 final ILttngEventProcessor getSoftIrqEntryBeforeHandler() {
94 AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_SOFT_IRQ_ENTRY);
95 return handler;
96 }
97
98 /**
99 * Method to handle the event: LTT_EVENT_SOFT_IRQ_EXIT
100 *
101 * @return
102 */
103 final ILttngEventProcessor getSoftIrqExitBeforeHandler() {
104 AbstractStatsEventHandler handler = new StatsModeEndHandler(Events.LTT_EVENT_SOFT_IRQ_EXIT);
105 return handler;
106 }
107
108 /**
109 * <p>
110 * Handles event: LTT_EVENT_FUNCTION_ENTRY
111 * </p>
112 * <p>
113 * FIELDS: LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE
114 * </p>
115 *
116 * @return
117 */
118 final ILttngEventProcessor getFunctionEntryBeforeHandler() {
119 AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_FUNCTION_ENTRY);
120 return handler;
121 }
122
123 /**
124 *
125 * @return
126 */
127 final ILttngEventProcessor getFunctionExitBeforeHandler() {
128 AbstractStatsEventHandler handler = new StatsModeEndHandler(Events.LTT_EVENT_FUNCTION_EXIT);
129 return handler;
130 }
131
132 /**
133 * <p>
134 * Handles: LTT_EVENT_SCHED_SCHEDULE
135 * </p>
136 * <p>
137 * Fields: LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE
138 * </p>
139 *
140 * @return
141 */
142 final ILttngEventProcessor getSchedChangeBeforeHandler() {
143 AbstractStatsEventHandler handler = new StatsModeChangeHandler(Events.LTT_EVENT_SCHED_SCHEDULE);
144 return handler;
145 }
146
147 /**
148 * <p>
149 * Handles: LTT_EVENT_SCHED_SCHEDULE
150 * </p>
151 * <p>
152 * Fields: LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE
153 * </p>
154 *
155 * @return
156 */
157 final ILttngEventProcessor getAfterHandler() {
158 AbstractStatsEventHandler handler = new StatsModeChangeHandler(null) {
159 int sched_hash = StateStrings.Events.LTT_EVENT_SCHED_SCHEDULE.getInName().hashCode();
160 public boolean process(LttngEvent event, LttngTraceState traceState) {
161 // Step the event counter for any after event
162 stepCount(event, traceState);
163
164 int eventNameHash = event.getMarkerName().hashCode();
165 // specific processing for after sched schedule
166 if (sched_hash == eventNameHash
167 && event.getMarkerName().equals(StateStrings.Events.LTT_EVENT_SCHED_SCHEDULE.getInName())) {
168 return super.process(event, traceState);
169 }
170
171 return false;
172 }
173 };
174
175 return handler;
176 }
177
178 }
This page took 0.033135 seconds and 4 git commands to generate.