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 / AbstractStatsEventHandler.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.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;
18 import org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsData;
19 import org.eclipse.linuxtools.lttng.ui.views.statistics.model.StatisticsTreeRootFactory;
20
21 abstract class AbstractStatsEventHandler implements ILttngEventProcessor {
22 private Events fEventType;
23
24 public AbstractStatsEventHandler(Events eventType) {
25 super();
26 fEventType = eventType;
27 }
28
29 /**
30 * @return root of of the tree for this experiment.
31 */
32 protected StatisticsData getStatisticsTree(LttngTraceState trcState) {
33 String experimentName = trcState.getContext().getExperimentName();
34 return StatisticsTreeRootFactory.getStatTree(experimentName);
35 }
36
37 public Events getEventHandleType() {
38 return fEventType;
39 }
40
41 protected void stepCount(LttngEvent event, LttngTraceState traceState) {
42 StatisticsData tree = getStatisticsTree(traceState);
43 tree.registerEvent(event, traceState);
44 }
45
46 }
This page took 0.030497 seconds and 5 git commands to generate.