Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
callstack: Add incubated LttngUstCallStackAnalysis
Bring Incubator's LTTng-UST CallStack analysis as the new mainlined one. Add com.google.common.base to the UI dependencies, which was reported as missing at runtime otherwise, upon exiting. [Added] o.e.t.i.a.callstack.core.LttngUstCallStackAnalysis Change-Id: I6e190aa1e85906e99c307bf61fc5062d9a69d9f7 Signed-off-by: Marco Miller <marco.miller@ericsson.com> Reviewed-on: https://git.eclipse.org/r/c/tracecompass/org.eclipse.tracecompass/+/199641 Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org> Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com> Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
- Loading branch information
1 parent
441d948
commit 93fa955
Showing
7 changed files
with
178 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
analysis/org.eclipse.tracecompass.analysis.callstack.core/plugin.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
.../org/eclipse/tracecompass/internal/analysis/callstack/core/LttngUstCallStackAnalysis.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2017 École Polytechnique de Montréal | ||
* | ||
* All rights reserved. This program and the accompanying materials are | ||
* made available under the terms of the Eclipse Public License 2.0 which | ||
* accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.tracecompass.internal.analysis.callstack.core; | ||
|
||
import java.util.Collections; | ||
import java.util.EnumSet; | ||
import java.util.Objects; | ||
import java.util.Set; | ||
|
||
import org.eclipse.jdt.annotation.NonNull; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.eclipse.tracecompass.internal.analysis.callstack.core.instrumented.InstrumentedCallStackAnalysis; | ||
import org.eclipse.tracecompass.internal.analysis.callstack.core.model.IHostModel; | ||
import org.eclipse.tracecompass.internal.analysis.callstack.core.model.IHostModel.ModelDataType; | ||
import org.eclipse.tracecompass.internal.analysis.callstack.core.model.ModelManager; | ||
import org.eclipse.tracecompass.internal.lttng2.ust.core.callstack.LttngUstCallStackProvider; | ||
import org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace; | ||
import org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout; | ||
import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule; | ||
import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement; | ||
import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException; | ||
import org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider; | ||
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; | ||
|
||
import com.google.common.collect.ImmutableSet; | ||
|
||
/** | ||
* This is the LTTng UST analysis, ported to the new CallStack structure. It | ||
* uses the same state provider as before | ||
* | ||
* @author Geneviève Bastien | ||
*/ | ||
public class LttngUstCallStackAnalysis extends InstrumentedCallStackAnalysis { | ||
|
||
/** | ||
* ID of this analysis | ||
*/ | ||
public static final String ID = "org.eclipse.tracecompass.analysis.callstack.core.analysis"; //$NON-NLS-1$ | ||
|
||
private @Nullable Set<@NonNull TmfAbstractAnalysisRequirement> fAnalysisRequirements = null; | ||
|
||
@Override | ||
public boolean setTrace(ITmfTrace trace) throws TmfAnalysisException { | ||
if (!(trace instanceof LttngUstTrace)) { | ||
return false; | ||
} | ||
return super.setTrace(trace); | ||
} | ||
|
||
@Override | ||
public @Nullable LttngUstTrace getTrace() { | ||
return (LttngUstTrace) super.getTrace(); | ||
} | ||
|
||
@Override | ||
protected @NonNull ITmfStateProvider createStateProvider() { | ||
return new LttngUstCallStackProvider(Objects.requireNonNull(getTrace())); | ||
} | ||
|
||
@Override | ||
protected @NonNull Iterable<@NonNull IAnalysisModule> getDependentAnalyses() { | ||
LttngUstTrace trace = getTrace(); | ||
if (trace == null) { | ||
return Collections.emptyList(); | ||
} | ||
IHostModel modelFor = ModelManager.getModelFor(trace.getHostId()); | ||
return modelFor.getRequiredModules(Objects.requireNonNull(EnumSet.of(ModelDataType.TID, ModelDataType.PID))); | ||
} | ||
|
||
@Override | ||
public @NonNull Iterable<@NonNull TmfAbstractAnalysisRequirement> getAnalysisRequirements() { | ||
Set<@NonNull TmfAbstractAnalysisRequirement> requirements = fAnalysisRequirements; | ||
if (requirements == null) { | ||
LttngUstTrace trace = getTrace(); | ||
ILttngUstEventLayout layout = ILttngUstEventLayout.DEFAULT_LAYOUT; | ||
if (trace != null) { | ||
layout = trace.getEventLayout(); | ||
} | ||
requirements = ImmutableSet.of(new LttngUstCallStackAnalysisRequirement(layout)); | ||
fAnalysisRequirements = requirements; | ||
} | ||
return requirements; | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
...e/tracecompass/internal/analysis/callstack/core/LttngUstCallStackAnalysisRequirement.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2016 Ericsson | ||
* | ||
* All rights reserved. This program and the accompanying materials are | ||
* made available under the terms of the Eclipse Public License 2.0 which | ||
* accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
|
||
package org.eclipse.tracecompass.internal.analysis.callstack.core; | ||
|
||
import static org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString; | ||
|
||
import java.util.Collection; | ||
|
||
import org.eclipse.tracecompass.internal.lttng2.ust.core.callstack.Messages; | ||
import org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout; | ||
import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement; | ||
import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisEventRequirement; | ||
import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfCompositeAnalysisRequirement; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import com.google.common.collect.ImmutableSet; | ||
|
||
/** | ||
* Analysis requirement implementation for LTTng Call Stack Analysis. | ||
* | ||
* @author Bernd Hufmann | ||
* | ||
*/ | ||
public class LttngUstCallStackAnalysisRequirement extends TmfCompositeAnalysisRequirement { | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param layout | ||
* The event layout (non-null) | ||
*/ | ||
public LttngUstCallStackAnalysisRequirement(ILttngUstEventLayout layout) { | ||
super(getSubRequirements(layout), PriorityLevel.AT_LEAST_ONE); | ||
|
||
addInformation(nullToEmptyString(Messages.LttnUstCallStackAnalysisModule_EventsLoadingInformation)); | ||
} | ||
|
||
private static Collection<TmfAbstractAnalysisRequirement> getSubRequirements(ILttngUstEventLayout layout) { | ||
|
||
// Requirement for the cyg_profile events | ||
TmfAnalysisEventRequirement cygProfile = new TmfAnalysisEventRequirement( | ||
ImmutableList.of(layout.eventCygProfileFuncEntry(), layout.eventCygProfileFuncExit()), | ||
PriorityLevel.MANDATORY); | ||
|
||
// Requirement for the cyg_profile_fast events | ||
TmfAbstractAnalysisRequirement cygProfileFast = new TmfAnalysisEventRequirement( | ||
ImmutableList.of(layout.eventCygProfileFastFuncEntry(), layout.eventCygProfileFastFuncExit()), | ||
PriorityLevel.MANDATORY); | ||
|
||
return ImmutableSet.of(cygProfile, cygProfileFast); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters