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 *******************************************************************************/
12 package org
.eclipse
.linuxtools
.lttng
.ui
.views
.statistics
.evProcessor
;
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
;
21 * Process the system call entry event
26 class StatsTimeCountHandlers
{
29 * Method to handle the event: LTT_EVENT_SYSCALL_ENTRY
33 final ILttngEventProcessor
getSyscallEntryBeforeHandler() {
34 AbstractStatsEventHandler handler
= new StatsModeChangeHandler(Events
.LTT_EVENT_SYSCALL_ENTRY
);
39 * Method to handle the event: LTT_EVENT_SYSCALL_EXIT
43 final ILttngEventProcessor
getsySyscallExitBeforeHandler() {
44 AbstractStatsEventHandler handler
= new StatsModeEndHandler(Events
.LTT_EVENT_SYSCALL_EXIT
);
49 * Method to handle the event: LTT_EVENT_TRAP_ENTRY
53 final ILttngEventProcessor
getTrapEntryBeforeHandler() {
54 AbstractStatsEventHandler handler
= new StatsModeChangeHandler(Events
.LTT_EVENT_TRAP_ENTRY
);
59 * Method to handle the event: LTT_EVENT_TRAP_EXIT
63 final ILttngEventProcessor
getTrapExitBeforeHandler() {
64 AbstractStatsEventHandler handler
= new StatsModeEndHandler(Events
.LTT_EVENT_TRAP_EXIT
);
69 * Method to handle the event: LTT_EVENT_IRQ_ENTRY
73 final ILttngEventProcessor
getIrqEntryBeforeHandler() {
74 AbstractStatsEventHandler handler
= new StatsModeChangeHandler(Events
.LTT_EVENT_IRQ_ENTRY
);
79 * Method to handle the event: LTT_EVENT_IRQ_EXIT
83 final ILttngEventProcessor
getIrqExitBeforeHandler() {
84 AbstractStatsEventHandler handler
= new StatsModeEndHandler(Events
.LTT_EVENT_IRQ_EXIT
);
89 * Method to handle the event: LTT_EVENT_SOFT_IRQ_ENTRY
93 final ILttngEventProcessor
getSoftIrqEntryBeforeHandler() {
94 AbstractStatsEventHandler handler
= new StatsModeChangeHandler(Events
.LTT_EVENT_SOFT_IRQ_ENTRY
);
99 * Method to handle the event: LTT_EVENT_SOFT_IRQ_EXIT
103 final ILttngEventProcessor
getSoftIrqExitBeforeHandler() {
104 AbstractStatsEventHandler handler
= new StatsModeEndHandler(Events
.LTT_EVENT_SOFT_IRQ_EXIT
);
110 * Handles event: LTT_EVENT_FUNCTION_ENTRY
113 * FIELDS: LTT_FIELD_THIS_FN, LTT_FIELD_CALL_SITE
118 final ILttngEventProcessor
getFunctionEntryBeforeHandler() {
119 AbstractStatsEventHandler handler
= new StatsModeChangeHandler(Events
.LTT_EVENT_FUNCTION_ENTRY
);
127 final ILttngEventProcessor
getFunctionExitBeforeHandler() {
128 AbstractStatsEventHandler handler
= new StatsModeEndHandler(Events
.LTT_EVENT_FUNCTION_EXIT
);
134 * Handles: LTT_EVENT_SCHED_SCHEDULE
137 * Fields: LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE
142 final ILttngEventProcessor
getSchedChangeBeforeHandler() {
143 AbstractStatsEventHandler handler
= new StatsModeChangeHandler(Events
.LTT_EVENT_SCHED_SCHEDULE
);
149 * Handles: LTT_EVENT_SCHED_SCHEDULE
152 * Fields: LTT_FIELD_PREV_PID, LTT_FIELD_NEXT_PID, LTT_FIELD_PREV_STATE
157 final ILttngEventProcessor
getAfterHandler() {
158 AbstractStatsEventHandler handler
= new StatsModeChangeHandler(null) {
159 int sched_hash
= StateStrings
.Events
.LTT_EVENT_SCHED_SCHEDULE
.getInName().hashCode();
161 public boolean process(LttngEvent event
, LttngTraceState traceState
) {
162 // Step the event counter for any after event
163 stepCount(event
, traceState
);
165 int eventNameHash
= event
.getMarkerName().hashCode();
166 // specific processing for after sched schedule
167 if (sched_hash
== eventNameHash
168 && event
.getMarkerName().equals(StateStrings
.Events
.LTT_EVENT_SCHED_SCHEDULE
.getInName())) {
169 return super.process(event
, traceState
);