Commit | Line | Data |
---|---|---|
50659279 | 1 | /******************************************************************************* |
792d23c2 | 2 | * Copyright (c) 2014, 2016 Ericsson |
50659279 AM |
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 | * Alexandre Montplaisir - Initial API and implementation | |
792d23c2 | 11 | * Bernd Hufmann - Added analysis requirements |
50659279 AM |
12 | *******************************************************************************/ |
13 | ||
9bc60be7 | 14 | package org.eclipse.tracecompass.lttng2.ust.ui.analysis.callstack; |
50659279 | 15 | |
d0c7e4ba AM |
16 | import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull; |
17 | ||
792d23c2 BH |
18 | import java.util.Set; |
19 | ||
20 | import org.eclipse.jdt.annotation.NonNull; | |
21 | import org.eclipse.jdt.annotation.Nullable; | |
116738ad | 22 | import org.eclipse.tracecompass.internal.lttng2.ust.core.callstack.LttngUstCallStackProvider; |
792d23c2 | 23 | import org.eclipse.tracecompass.internal.lttng2.ust.ui.analysis.callstack.LttngUstCallStackAnalysisRequirement; |
9bc60be7 | 24 | import org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace; |
792d23c2 | 25 | import org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout; |
58080002 | 26 | import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement; |
2bdf0193 AM |
27 | import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException; |
28 | import org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider; | |
29 | import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; | |
30 | import org.eclipse.tracecompass.tmf.ui.views.callstack.AbstractCallStackAnalysis; | |
50659279 | 31 | |
792d23c2 BH |
32 | import com.google.common.collect.ImmutableSet; |
33 | ||
50659279 AM |
34 | /** |
35 | * Call-stack analysis to populate the TMF CallStack View from UST cyg-profile | |
36 | * events. | |
37 | * | |
38 | * @author Alexandre Montplaisir | |
50659279 AM |
39 | */ |
40 | public class LttngUstCallStackAnalysis extends AbstractCallStackAnalysis { | |
41 | ||
58080002 | 42 | private @Nullable Set<@NonNull TmfAbstractAnalysisRequirement> fAnalysisRequirements = null; |
792d23c2 | 43 | |
f479550c GB |
44 | /** |
45 | * @since 1.0 | |
46 | */ | |
50659279 | 47 | @Override |
f479550c | 48 | public boolean setTrace(ITmfTrace trace) throws TmfAnalysisException { |
50659279 | 49 | if (!(trace instanceof LttngUstTrace)) { |
f479550c | 50 | return false; |
50659279 | 51 | } |
f479550c | 52 | return super.setTrace(trace); |
50659279 AM |
53 | } |
54 | ||
55 | @Override | |
56 | protected LttngUstTrace getTrace() { | |
57 | return (LttngUstTrace) super.getTrace(); | |
58 | } | |
59 | ||
60 | @Override | |
61 | protected ITmfStateProvider createStateProvider() { | |
d0c7e4ba | 62 | return new LttngUstCallStackProvider(checkNotNull(getTrace())); |
50659279 AM |
63 | } |
64 | ||
792d23c2 | 65 | @Override |
58080002 | 66 | public @NonNull Iterable<@NonNull TmfAbstractAnalysisRequirement> getAnalysisRequirements() { |
792d23c2 | 67 | |
58080002 | 68 | Set<@NonNull TmfAbstractAnalysisRequirement> requirements = fAnalysisRequirements; |
792d23c2 BH |
69 | if (requirements == null) { |
70 | LttngUstTrace trace = getTrace(); | |
71 | ILttngUstEventLayout layout = ILttngUstEventLayout.DEFAULT_LAYOUT; | |
72 | if (trace != null) { | |
73 | layout = trace.getEventLayout(); | |
74 | } | |
75 | requirements = ImmutableSet.of(new LttngUstCallStackAnalysisRequirement(layout)); | |
76 | fAnalysisRequirements = requirements; | |
77 | } | |
78 | return requirements; | |
79 | } | |
80 | ||
81 | ||
82 | ||
50659279 | 83 | } |