Commit | Line | Data |
---|---|---|
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 | *******************************************************************************/ | |
12 | package org.eclipse.linuxtools.lttng.ui.views.statistics.evProcessor; | |
13 | ||
6c13869b FC |
14 | import org.eclipse.linuxtools.lttng.core.event.LttngEvent; |
15 | import org.eclipse.linuxtools.lttng.core.state.StateStrings.Events; | |
16 | import org.eclipse.linuxtools.lttng.core.state.evProcessor.ILttngEventProcessor; | |
17 | import org.eclipse.linuxtools.lttng.core.state.model.LttngTraceState; | |
9dbeec54 | 18 | import org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData; |
8827c197 | 19 | import org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsTreeRootFactory; |
6e512b93 | 20 | |
8827c197 | 21 | abstract class AbstractStatsEventHandler implements ILttngEventProcessor { |
9dbeec54 | 22 | private Events fEventType; |
6e512b93 ASL |
23 | |
24 | public AbstractStatsEventHandler(Events eventType) { | |
25 | super(); | |
9dbeec54 | 26 | fEventType = eventType; |
6e512b93 ASL |
27 | } |
28 | ||
29 | /** | |
30 | * @return root of of the tree for this experiment. | |
31 | */ | |
9dbeec54 | 32 | protected StatisticsData getStatisticsTree(LttngTraceState trcState) { |
8827c197 | 33 | String experimentName = trcState.getContext().getExperimentName(); |
9dbeec54 | 34 | return StatisticsTreeRootFactory.getStatTree(experimentName); |
6e512b93 ASL |
35 | } |
36 | ||
6e512b93 | 37 | public Events getEventHandleType() { |
9dbeec54 | 38 | return fEventType; |
6e512b93 | 39 | } |
8827c197 FC |
40 | |
41 | protected void stepCount(LttngEvent event, LttngTraceState traceState) { | |
9dbeec54 FC |
42 | StatisticsData tree = getStatisticsTree(traceState); |
43 | tree.registerEvent(event, traceState); | |
8827c197 | 44 | } |
6e512b93 ASL |
45 | |
46 | } |