1 /*******************************************************************************
2 * Copyright (c) 2009 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 * Yann N. Dauphin (dhaemon@gmail.com) - Implementation for stats
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.lttng
.ui
.views
.statistics
.evProcessor
;
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
;
22 * Process the system call entry event
27 class StatsTimeCountHandlers
{
30 * Method to handle the event: LTT_EVENT_SYSCALL_ENTRY
34 final ILttngEventProcessor
getSyscallEntryBeforeHandler() {
35 AbstractStatsEventHandler handler
= new StatsModeChangeHandler(Events
.LTT_EVENT_SYSCALL_ENTRY
);
40 * Method to handle the event: LTT_EVENT_SYSCALL_EXIT
44 final ILttngEventProcessor
getsySyscallExitBeforeHandler() {
45 AbstractStatsEventHandler handler
= new StatsModeEndHandler(Events
.LTT_EVENT_SYSCALL_EXIT
);
50 * Method to handle the event: LTT_EVENT_TRAP_ENTRY
54 final ILttngEventProcessor
getTrapEntryBeforeHandler() {
55 AbstractStatsEventHandler handler
= new StatsModeChangeHandler(Events
.LTT_EVENT_TRAP_ENTRY
);
60 * Method to handle the event: LTT_EVENT_TRAP_EXIT
64 final ILttngEventProcessor
getTrapExitBeforeHandler() {
65 AbstractStatsEventHandler handler
= new StatsModeEndHandler(Events
.LTT_EVENT_TRAP_EXIT
);
70 * Method to handle the event: LTT_EVENT_IRQ_ENTRY
74 final ILttngEventProcessor
getIrqEntryBeforeHandler() {
75 AbstractStatsEventHandler handler
= new StatsModeChangeHandler(Events
.LTT_EVENT_IRQ_ENTRY
);
80 * Method to handle the event: LTT_EVENT_IRQ_EXIT
84 final ILttngEventProcessor
getIrqExitBeforeHandler() {
85 AbstractStatsEventHandler handler
= new StatsModeEndHandler(Events
.LTT_EVENT_IRQ_EXIT
);
90 * Method to handle the event: LTT_EVENT_SOFT_IRQ_ENTRY
94 final ILttngEventProcessor
getSoftIrqEntryBeforeHandler() {
95 AbstractStatsEventHandler handler
= new StatsModeChangeHandler(Events
.LTT_EVENT_SOFT_IRQ_ENTRY
);
100 * Method to handle the event: LTT_EVENT_SOFT_IRQ_EXIT
104 final ILttngEventProcessor
getSoftIrqExitBeforeHandler() {
105 AbstractStatsEventHandler handler
= new StatsModeEndHandler(Events
.LTT_EVENT_SOFT_IRQ_EXIT
);
111 * Handles event: LTT_EVENT_FUNCTION_ENTRY
114 * FIELDS: LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE
119 final ILttngEventProcessor
getFunctionEntryBeforeHandler() {
120 AbstractStatsEventHandler handler
= new StatsModeChangeHandler(Events
.LTT_EVENT_FUNCTION_ENTRY
);
128 final ILttngEventProcessor
getFunctionExitBeforeHandler() {
129 AbstractStatsEventHandler handler
= new StatsModeEndHandler(Events
.LTT_EVENT_FUNCTION_EXIT
);
135 * Handles: LTT_EVENT_SCHED_SCHEDULE
138 * Fields: LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE
143 final ILttngEventProcessor
getSchedChangeBeforeHandler() {
144 AbstractStatsEventHandler handler
= new StatsModeChangeHandler(Events
.LTT_EVENT_SCHED_SCHEDULE
);
150 * Handles: LTT_EVENT_SCHED_SCHEDULE
153 * Fields: LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE
158 final ILttngEventProcessor
getAfterHandler() {
159 AbstractStatsEventHandler handler
= new StatsModeChangeHandler(null) {
160 int sched_hash
= StateStrings
.Events
.LTT_EVENT_SCHED_SCHEDULE
.getInName().hashCode();
162 public boolean process(LttngEvent event
, LttngTraceState traceState
) {
163 // Step the event counter for any after event
164 stepCount(event
, traceState
);
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
);
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.
184 ILttngEventProcessor
getTracesetEndHandler() {
185 return new StatsTracesetEndHandler();
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.
192 ILttngEventProcessor
getProcessExitHandler() {
193 return new StatsProcessExitHandler();