bin.includes = META-INF/,\
plugin.properties,\
.,\
- about.html
+ about.html,\
+ plugin.xml
additional.bundles = org.eclipse.jdt.annotation
jars.extra.classpath = platform:/plugin/org.eclipse.jdt.annotation
src.includes = about.html
Bundle-Vendor = Eclipse Trace Compass
Bundle-Name = Trace Compass Timing Analysis Core Plug-in
+
+callgraph.analysis = Call Graph Analysis
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.linuxtools.tmf.core.analysis">
+ <module
+ analysis_module="org.eclipse.tracecompass.internal.analysis.timing.core.callgraph.CallGraphAnalysis"
+ applies_experiment="true"
+ automatic="true"
+ icon="icons/callgraph.png"
+ id="org.eclipse.tracecompass.internal.analysis.timing.core.callgraph.callgraphanalysis"
+ name="%callgraph.analysis">
+ <tracetype
+ applies="true"
+ class="org.eclipse.tracecompass.tmf.core.trace.TmfTrace">
+ </tracetype>
+ </module>
+ </extension>
+
+</plugin>
import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
import org.eclipse.tracecompass.tmf.core.analysis.TmfAbstractAnalysisModule;
import org.eclipse.tracecompass.tmf.core.callstack.CallStackAnalysis;
+import org.eclipse.tracecompass.tmf.core.segment.ISegmentAspect;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
*
* @author Sonia Farrah
*/
-public abstract class CallGraphAnalysis extends TmfAbstractAnalysisModule implements ISegmentStoreProvider {
+public class CallGraphAnalysis extends TmfAbstractAnalysisModule implements ISegmentStoreProvider {
+
+ /**
+ * ID
+ */
+ public static final String ID = "org.eclipse.tracecompass.internal.analysis.timing.core.callgraph.callgraphanalysis"; //$NON-NLS-1$
// ------------------------------------------------------------------------
// Attributes
return true;
}
+ @Override
+ public @NonNull Iterable<@NonNull ISegmentAspect> getSegmentAspects() {
+ return Collections.singletonList(SymbolAspect.SYMBOL_ASPECT);
+ }
+
@Override
protected Iterable<IAnalysisModule> getDependentAnalyses() {
return TmfTraceManager.getTraceSet(getTrace()).stream()
}
return processId;
}
+
}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2016 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.internal.analysis.timing.core.callgraph;
+
+import java.util.Comparator;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.common.core.NonNullUtils;
+import org.eclipse.tracecompass.segmentstore.core.ISegment;
+import org.eclipse.tracecompass.tmf.core.segment.ISegmentAspect;
+import org.eclipse.tracecompass.tmf.core.symbols.ISymbolProvider;
+import org.eclipse.tracecompass.tmf.core.symbols.SymbolProviderManager;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
+
+/**
+ * An aspect used to get the function name of a call stack event or to compare
+ * the duration of two events
+ *
+ * @author Sonia Farrah
+ */
+public final class SymbolAspect implements ISegmentAspect {
+ /**
+ * A symbol aspect
+ */
+ public static final ISegmentAspect SYMBOL_ASPECT = new SymbolAspect();
+
+ /**
+ * Constructor
+ */
+ public SymbolAspect() {
+ }
+
+ @Override
+ public @NonNull String getName() {
+ return NonNullUtils.nullToEmptyString(Messages.CallStack_FunctionName);
+ }
+
+ @Override
+ public @NonNull String getHelpText() {
+ return NonNullUtils.nullToEmptyString(Messages.CallStack_FunctionName);
+ }
+
+ @Override
+ public @Nullable Comparator<?> getComparator() {
+ return new Comparator<ISegment>() {
+ @Override
+ public int compare(@Nullable ISegment o1, @Nullable ISegment o2) {
+ if (o1 == null || o2 == null) {
+ throw new IllegalArgumentException();
+ }
+ return Long.compare(o1.getLength(), o2.getLength());
+ }
+ };
+ }
+
+ @Override
+ public @Nullable Object resolve(@NonNull ISegment segment) {
+ if (segment instanceof ICalledFunction) {
+ ICalledFunction calledFunction = (ICalledFunction) segment;
+ // FIXME work around this trace
+ ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
+ if (trace != null) {
+ String symbolText;
+ Object symbol = calledFunction.getSymbol();
+ if (symbol instanceof Long) {
+ Long longAddress = (Long) symbol;
+ ISymbolProvider provider = SymbolProviderManager.getInstance().getSymbolProvider(trace);
+ symbolText = provider.getSymbolText(longAddress);
+ if (symbolText == null) {
+ return "0x" + Long.toHexString(longAddress); //$NON-NLS-1$
+ }
+ // take the start time in the query for the symbol name
+ long time = segment.getStart();
+ int pid = calledFunction.getProcessId();
+ if (pid > 0) {
+ String text = provider.getSymbolText(pid, time, longAddress);
+ if (text != null) {
+ return text;
+ }
+ }
+ return symbolText;
+ }
+ return String.valueOf(symbol);
+ }
+ }
+ return null;
+ }
+}
\ No newline at end of file
view.callgraphDensity= Function Durations Distribution
view.flameGraph= Flame Graph
view.segstore.table = Segment Store Table
-
-callgraph.analysis = Call Graph Analysis
<plugin>
<extension
point="org.eclipse.linuxtools.tmf.core.analysis">
- <module
- analysis_module="org.eclipse.tracecompass.internal.analysis.timing.ui.callgraph.CallGraphAnalysisUI"
- automatic="false"
- icon="icons/elcl16/callgraph.png"
- id="org.eclipse.tracecompass.internal.analysis.timing.ui.callgraph.callgraphanalysis"
- name="%callgraph.analysis">
- <tracetype
- applies="true"
- class="org.eclipse.tracecompass.tmf.core.trace.TmfTrace">
- </tracetype>
- </module>
<output
class="org.eclipse.tracecompass.tmf.ui.analysis.TmfAnalysisViewOutput"
id="org.eclipse.tracecompass.internal.analysis.timing.ui.callgraph.callgraphDensity">
<analysisModuleClass
- class="org.eclipse.tracecompass.internal.analysis.timing.ui.callgraph.CallGraphAnalysisUI">
+ class="org.eclipse.tracecompass.internal.analysis.timing.core.callgraph.CallGraphAnalysis">
</analysisModuleClass>
</output>
<output
class="org.eclipse.tracecompass.tmf.ui.analysis.TmfAnalysisViewOutput"
id="org.eclipse.tracecompass.internal.analysis.timing.ui.flamegraph.flamegraphView">
<analysisModuleClass
- class="org.eclipse.tracecompass.internal.analysis.timing.ui.callgraph.CallGraphAnalysisUI">
+ class="org.eclipse.tracecompass.internal.analysis.timing.core.callgraph.CallGraphAnalysis">
</analysisModuleClass>
</output>
</extension>
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2016 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.analysis.timing.ui.callgraph;
-
-import java.util.Collections;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.internal.analysis.timing.core.callgraph.CallGraphAnalysis;
-import org.eclipse.tracecompass.tmf.core.segment.ISegmentAspect;
-
-/**
- * CallGraph Analysis with aspects
- *
- * @author Sonia Farrah
- */
-public class CallGraphAnalysisUI extends CallGraphAnalysis {
-
- /**
- * ID
- */
- public static final @NonNull String ID = "org.eclipse.tracecompass.internal.analysis.timing.ui.callgraph.callgraphanalysis"; //$NON-NLS-1$
-
- /**
- * Default constructor
- */
- public CallGraphAnalysisUI() {
- super();
- }
-
- @Override
- public @NonNull Iterable<@NonNull ISegmentAspect> getSegmentAspects() {
- return Collections.singletonList(SymbolAspect.SYMBOL_ASPECT);
- }
-}
@Override
protected @Nullable ISegmentStoreProvider getSegmentStoreProvider(@NonNull ITmfTrace trace) {
- return TmfTraceUtils.getAnalysisModuleOfClass(trace, CallGraphAnalysis.class, CallGraphAnalysisUI.ID);
+ return TmfTraceUtils.getAnalysisModuleOfClass(trace, CallGraphAnalysis.class, CallGraphAnalysis.ID);
}
}
\ No newline at end of file
@Override
protected @Nullable ISegmentStoreProvider getSegmentStoreProvider(@NonNull ITmfTrace trace) {
- CallGraphAnalysis fModule = TmfTraceUtils.getAnalysisModuleOfClass(trace, CallGraphAnalysis.class, CallGraphAnalysisUI.ID);
+ CallGraphAnalysis fModule = TmfTraceUtils.getAnalysisModuleOfClass(trace, CallGraphAnalysis.class, CallGraphAnalysis.ID);
if (fModule == null) {
return null;
}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2016 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-
-package org.eclipse.tracecompass.internal.analysis.timing.ui.callgraph;
-
-import java.util.Comparator;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.common.core.NonNullUtils;
-import org.eclipse.tracecompass.internal.analysis.timing.core.callgraph.ICalledFunction;
-import org.eclipse.tracecompass.internal.analysis.timing.core.callgraph.Messages;
-import org.eclipse.tracecompass.segmentstore.core.ISegment;
-import org.eclipse.tracecompass.tmf.core.segment.ISegmentAspect;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
-import org.eclipse.tracecompass.tmf.ui.symbols.ISymbolProvider;
-import org.eclipse.tracecompass.tmf.ui.symbols.SymbolProviderManager;
-
-/**
- * An aspect used to get the function name of a call stack event or to compare
- * the duration of two events
- *
- * @author Sonia Farrah
- */
-public final class SymbolAspect implements ISegmentAspect {
- /**
- * A symbol aspect
- */
- public static final @NonNull ISegmentAspect SYMBOL_ASPECT = new SymbolAspect();
-
- /**
- * Constructor
- */
- public SymbolAspect() {
- }
-
- @Override
- public @NonNull String getName() {
- return NonNullUtils.nullToEmptyString(Messages.CallStack_FunctionName);
- }
-
- @Override
- public @NonNull String getHelpText() {
- return NonNullUtils.nullToEmptyString(Messages.CallStack_FunctionName);
- }
-
- @Override
- public @Nullable Comparator<?> getComparator() {
- return new Comparator<ISegment>() {
- @Override
- public int compare(@Nullable ISegment o1, @Nullable ISegment o2) {
- if (o1 == null || o2 == null) {
- throw new IllegalArgumentException();
- }
- return Long.compare(o1.getLength(), o2.getLength());
- }
- };
- }
-
- @Override
- public @Nullable Object resolve(@NonNull ISegment segment) {
- if (segment instanceof ICalledFunction) {
- ICalledFunction calledFunction = (ICalledFunction) segment;
- ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
- if (trace != null) {
- String symbolText;
- Object symbol = calledFunction.getSymbol();
- if (symbol instanceof Long) {
- Long longAddress = (Long) symbol;
- ISymbolProvider provider = SymbolProviderManager.getInstance().getSymbolProvider(trace);
- symbolText = provider.getSymbolText(longAddress);
- if (symbolText == null) {
- return "0x" + Long.toHexString(longAddress); //$NON-NLS-1$
- }
- // take the start time in the query for the symbol name
- long time = segment.getStart();
- int pid = calledFunction.getProcessId();
- if (pid > 0) {
- String text = provider.getSymbolText(pid, time, longAddress);
- if (text != null) {
- return text;
- }
- }
- return symbolText;
- }
- return String.valueOf(symbol);
- }
- }
- return null;
- }
-}
\ No newline at end of file
import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.SubSecondTimeWithUnitFormat;
import org.eclipse.tracecompass.internal.analysis.timing.core.callgraph.AggregatedCalledFunctionStatistics;
import org.eclipse.tracecompass.internal.analysis.timing.core.callgraph.ICalledFunction;
+import org.eclipse.tracecompass.internal.analysis.timing.core.callgraph.SymbolAspect;
+import org.eclipse.tracecompass.tmf.core.symbols.ISymbolProvider;
+import org.eclipse.tracecompass.tmf.core.symbols.SymbolProviderManager;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
-import org.eclipse.tracecompass.tmf.ui.symbols.ISymbolProvider;
-import org.eclipse.tracecompass.tmf.ui.symbols.SymbolProviderManager;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.StateItem;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.TimeGraphPresentationProvider;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent;
private static String getFuntionSymbol(FlamegraphEvent event, ISymbolProvider symbolProvider) {
String funcSymbol = ""; //$NON-NLS-1$
if (event.getSymbol() instanceof Long || event.getSymbol() instanceof Integer) {
- long longAddress = ((Long) event.getSymbol()).longValue();
- funcSymbol = symbolProvider.getSymbolText(longAddress);
- if (funcSymbol == null) {
- return "0x" + Long.toHexString(longAddress); //$NON-NLS-1$
- }
- // take time of max segment for time a query the symbol name
- ICalledFunction maxObject = event.getStatistics().getDurationStatistics().getMaxObject();
- if (maxObject == null) {
+
+ ICalledFunction segment = event.getStatistics().getDurationStatistics().getMinObject();
+ if (segment == null) {
+ long longAddress = ((Long) event.getSymbol()).longValue();
return "0x" + Long.toHexString(longAddress); //$NON-NLS-1$
}
- long time = maxObject.getStart();
- int pid = event.getProcessId();
- if (pid > 0) {
- String text = symbolProvider.getSymbolText(pid, time, longAddress);
- if (text != null) {
- return text;
- }
+ Object symbol = SymbolAspect.SYMBOL_ASPECT.resolve(segment);
+ if (symbol != null) {
+ return symbol.toString();
}
} else {
return event.getSymbol().toString();
import org.eclipse.swt.widgets.Menu;
import org.eclipse.tracecompass.internal.analysis.timing.core.callgraph.CallGraphAnalysis;
import org.eclipse.tracecompass.internal.analysis.timing.ui.Activator;
-import org.eclipse.tracecompass.internal.analysis.timing.ui.callgraph.CallGraphAnalysisUI;
import org.eclipse.tracecompass.segmentstore.core.ISegment;
import org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal;
import org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler;
public void traceSelected(final TmfTraceSelectedSignal signal) {
fTrace = signal.getTrace();
if (fTrace != null) {
- fFlamegraphModule = TmfTraceUtils.getAnalysisModuleOfClass(fTrace, CallGraphAnalysis.class, CallGraphAnalysisUI.ID);
+ fFlamegraphModule = TmfTraceUtils.getAnalysisModuleOfClass(fTrace, CallGraphAnalysis.class, CallGraphAnalysis.ID);
buildFlameGraph(fFlamegraphModule);
}
}
--- /dev/null
+class java/lang/ref/Reference
+get
+ ()TT;
+ ()T0T;
</output>
</extension>
<extension
- point="org.eclipse.tracecompass.tmf.ui.symbolProvider">
+ point="org.eclipse.tracecompass.tmf.core.symbolProvider">
<providerFactory
class="org.eclipse.tracecompass.internal.lttng2.ust.ui.analysis.debuginfo.UstDebugInfoSymbolProviderFactory"
id="org.eclipse.tracecompass.lttng2.ust.ui.analysis.debuginfo.providerFactory"
import org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoFunctionAspect;
import org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoSourceAspect;
import org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace;
+import org.eclipse.tracecompass.tmf.core.event.lookup.ITmfCallsite;
import org.eclipse.tracecompass.tmf.core.event.lookup.TmfCallsite;
-import org.eclipse.tracecompass.tmf.ui.symbols.DefaultSymbolProvider;
+import org.eclipse.tracecompass.tmf.core.symbols.DefaultSymbolProvider;
+import org.eclipse.tracecompass.tmf.ui.symbols.ISymbolProvider;
import org.eclipse.tracecompass.tmf.ui.symbols.ISymbolProviderPreferencePage;
/**
* @author Alexandre Montplaisir
* @see UstDebugInfoAnalysisModule
*/
-public class UstDebugInfoSymbolProvider extends DefaultSymbolProvider {
+public class UstDebugInfoSymbolProvider extends DefaultSymbolProvider implements ISymbolProvider{
/**
* Create a new {@link UstDebugInfoSymbolProvider} for the given trace
return new UstDebugInfoSymbolProviderPreferencePage(this);
}
+ @Deprecated
+ @Override
+ public @Nullable ITmfCallsite getSymbolInfo(long address) {
+ return null;
+ }
+
}
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoAnalysisModule;
import org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace;
+import org.eclipse.tracecompass.tmf.core.symbols.ISymbolProvider;
+import org.eclipse.tracecompass.tmf.core.symbols.ISymbolProviderFactory;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
-import org.eclipse.tracecompass.tmf.ui.symbols.ISymbolProvider;
-import org.eclipse.tracecompass.tmf.ui.symbols.ISymbolProviderFactory;
/**
* Factory to create {@link UstDebugInfoSymbolProvider}. Provided to TMF via
extensionpoint.analysis_module.name = Trace Analysis Module
extensionpoint.ondemand_analysis.name = On-demand Analysis
extensionpoint.custom_trace.name = Custom Trace
+extensionpoint.symbol_provider.name = Core Symbol Provider
# Experiment type
experimenttype.type.generic = Generic Experiment
<extension-point id="org.eclipse.linuxtools.tmf.core.analysis" name="%extensionpoint.analysis_module.name" schema="schema/org.eclipse.linuxtools.tmf.core.analysis.exsd"/>
<extension-point id="org.eclipse.tracecompass.tmf.core.analysis.ondemand" name="%extensionpoint.ondemand_analysis.name" schema="schema/org.eclipse.tracecompass.tmf.core.analysis.ondemand.exsd"/>
<extension-point id="org.eclipse.tracecompass.tmf.core.custom.trace" name="%extensionpoint.custom_trace.name" schema="schema/org.eclipse.tracecompass.tmf.core.custom.trace.exsd"/>
+ <extension-point id="org.eclipse.tracecompass.tmf.core.symbolProvider" name="%extensionpoint.symbol_provider.name" schema="schema/org.eclipse.tracecompass.tmf.core.symbolProvider.exsd"/>
<extension
point="org.eclipse.core.runtime.preferences">
--- /dev/null
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.tracecompass.tmf.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.tracecompass.tmf.core" id="org.eclipse.tracecompass.tmf.core.symbolProvider" name="Core Symbol Provider"/>
+ </appinfo>
+ <documentation>
+ Core symbol provider, provides a symbol factory for a given trace. This extension point can be used to transform from symbol addresses that might be found inside a TmfTrace into human readable texts, for example function names.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="providerFactory"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="providerFactory">
+ <complexType>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+ The name of the class responsible to create an ISymbolProvider
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.tracecompass.tmf.core.symbols.ISymbolProviderFactory"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="priority" type="string" use="default" value="50">
+ <annotation>
+ <documentation>
+ Specify the priority of this factory relative to the other. It should be an integer number. If not defined or not a valid integer it will be assumed to be zero.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ The ID of the extension
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 3.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ <p>For example, a symbol provider can be initialized with a priority. It is specified in the extension point.
+</p>
+
+<p>
+The following is an example of the extension point usage:
+<pre>
+ <extension
+ point="org.eclipse.tracecompass.tmf.core.symbolProvider">
+ <providerFactory
+ class="org.myproject.mypackage.mySymbolProviderFactory"
+ id="org.myproject.mypackage.mySymbolProviderFactory.id"
+ priority="42">
+ </providerFactory>
+ </extension>
+</pre>
+</p>
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ Since 3.0
+
+Symbol providers using this extension point have to specify the symbol provider factory. This class has to implement ISymbolProviderFactory.
+ </documentation>
+ </annotation>
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ Copyright (c) 2017 Ericsson and others
+
+All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
+ </documentation>
+ </annotation>
+
+</schema>
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2016-2017 Movidius Inc. and others
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.core.symbols;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+
+/**
+ * A default implementation of the {@link ISymbolProvider} which return a hex
+ * format representation of the symbol address
+ *
+ * @author Robert Kiss
+ * @since 2.4
+ */
+public class DefaultSymbolProvider implements ISymbolProvider {
+
+ private final ITmfTrace fTrace;
+
+ /**
+ * Create a new provider for the given trace
+ *
+ * @param trace
+ * the trace
+ */
+ public DefaultSymbolProvider(ITmfTrace trace) {
+ fTrace = trace;
+ }
+
+ @Override
+ public void loadConfiguration(@Nullable IProgressMonitor monitor) {
+ // no configuration here
+ }
+
+ @Override
+ public ITmfTrace getTrace() {
+ return fTrace;
+ }
+
+ /**
+ * Return a hex formated representation of the given address
+ *
+ * @param address
+ * the symbol address
+ * @return the hex representation of the given address
+ */
+ @Override
+ public @NonNull String getSymbolText(long address) {
+ if ((address & (0xFFFFFFFF << 32)) == 0) {
+ return String.format("%08x", address); //$NON-NLS-1$
+ }
+ return String.format("%016x", address); //$NON-NLS-1$
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2016-2017 Movidius Inc. and others
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.core.symbols;
+
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+
+/**
+ * Instance of this interface can be contributed using the
+ * <code>org.eclipse.tracecompass.tmf.core.symbolProvider</code> extension and is
+ * used to create instances of {@link ISymbolProvider}
+ *
+ * @author Robert Kiss
+ *
+ * @since 2.4
+ */
+public interface ISymbolProviderFactory {
+
+ /**
+ * Create a provider for the given trace. If this factory does not know how
+ * to handle the given trace it will return null;
+ *
+ * @param trace
+ * A non-null trace
+ * @return A newly created provider that can resolve symbols from the given
+ * trace or null if no such provider can be created by this factory
+ */
+ @Nullable ISymbolProvider createProvider(ITmfTrace trace);
+
+}
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2016-2017 Movidius Inc. and others
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.core.symbols;
+
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.tracecompass.internal.tmf.core.Activator;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+
+/**
+ * This class offer services around the
+ * <code>org.eclipse.tracecompass.tmf.core.symbolProvider</code> extension
+ * point.
+ *
+ * @author Robert Kiss
+ * @since 2.4
+ */
+public final class SymbolProviderManager {
+
+ /**
+ * The singleton instance of this manager
+ */
+ private static @Nullable SymbolProviderManager INSTANCE;
+
+ private static final String OLD_EXTENSION_POINT_ID = "org.eclipse.tracecompass.tmf.ui.symbolProvider"; //$NON-NLS-1$
+ private static final String EXTENSION_POINT_ID = "org.eclipse.tracecompass.tmf.core.symbolProvider"; //$NON-NLS-1$
+ private static final String ELEM_NAME_PROVIDER = "providerFactory"; //$NON-NLS-1$
+ private static final String ATTR_CLASS = "class"; //$NON-NLS-1$
+ private static final String ATTR_PRIORITY = "priority"; //$NON-NLS-1$
+
+ private final List<SymbolProviderFactoryWrapper> fProviders;
+
+ private final Map<ITmfTrace, WeakReference<ISymbolProvider>> fInstances = new WeakHashMap<>();
+
+ /**
+ * Internal class used to store extension point information
+ *
+ */
+ private static class SymbolProviderFactoryWrapper {
+
+ public final ISymbolProviderFactory factory;
+ public final int priority;
+
+ private SymbolProviderFactoryWrapper(ISymbolProviderFactory factory, int priority) {
+ this.factory = factory;
+ this.priority = priority;
+ }
+ }
+
+ /**
+ *
+ * @return the singleton instance of this class
+ */
+ public static synchronized SymbolProviderManager getInstance() {
+ SymbolProviderManager manager = INSTANCE;
+ if (manager == null) {
+ manager = new SymbolProviderManager();
+ INSTANCE = manager;
+ }
+ return manager;
+ }
+
+ /**
+ * The private constructor of this manager
+ */
+ private SymbolProviderManager() {
+ fProviders = new ArrayList<>();
+ load(OLD_EXTENSION_POINT_ID);
+ load(EXTENSION_POINT_ID);
+ // Those with a higher priority need to be on top
+ fProviders.sort(Comparator.comparingLong(o -> -o.priority));
+ }
+
+ private void load(String configElemPath) {
+ IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(configElemPath);
+ for (IConfigurationElement element : configElements) {
+ if (element != null && ELEM_NAME_PROVIDER.equals(element.getName())) {
+ try {
+ Object extension = checkNotNull(element.createExecutableExtension(ATTR_CLASS));
+ int priority = 0;
+ try {
+ priority = Integer.parseInt(element.getAttribute(ATTR_PRIORITY));
+ } catch (NumberFormatException e) {
+ // safe to ignore
+ }
+ fProviders.add(new SymbolProviderFactoryWrapper((ISymbolProviderFactory) extension, priority));
+ } catch (CoreException | ClassCastException e) {
+ Activator.logError("Exception while loading extensions", e); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+
+ /**
+ * Locate an {@link ISymbolProvider} capable to resolve symbols from the
+ * given trace. If no such provider is defined an instance of
+ * {@link DefaultSymbolProvider} will be returned
+ *
+ * @param trace
+ * The trace to create a provider for
+ * @return a valid {@link ISymbolProvider}, never null
+ */
+ public ISymbolProvider getSymbolProvider(ITmfTrace trace) {
+ // Check to see if we already have a provider for this trace
+ synchronized (fInstances) {
+ WeakReference<ISymbolProvider> reference = fInstances.get(trace);
+ if (reference != null) {
+ ISymbolProvider provider = reference.get();
+ if (provider != null) {
+ return provider;
+ }
+ }
+ // we don't have yet an instance, build one
+ for (SymbolProviderFactoryWrapper wrapper : fProviders) {
+ ISymbolProviderFactory factory = wrapper.factory;
+ ISymbolProvider provider = factory.createProvider(trace);
+ if (provider != null) {
+ fInstances.put(trace, new WeakReference<>(provider));
+ return provider;
+ }
+ }
+ }
+ // No provider found, return the default one
+ return new DefaultSymbolProvider(trace);
+ }
+
+}
</description>
</colorDefinition>
</extension>
- <extension
- point="org.eclipse.tracecompass.tmf.ui.symbolProvider">
- <providerFactory
- class="org.eclipse.tracecompass.internal.tmf.ui.symbols.BasicSymbolProviderFactory"
- id="org.eclipse.tracecompass.tmf.ui.providerFactory1"
- priority="0">
- </providerFactory>
- </extension>
<extension
point="org.eclipse.core.runtime.preferences">
<initializer
name="%preferences.page.trace.types">
</page>
</extension>
+ <extension
+ point="org.eclipse.tracecompass.tmf.core.symbolProvider">
+ <providerFactory
+ class="org.eclipse.tracecompass.internal.tmf.ui.symbols.BasicSymbolProviderFactory"
+ id="org.eclipse.tracecompass.tmf.ui.providerFactory.basic"
+ priority="0">
+ </providerFactory>
+ </extension>
</plugin>
<element name="extension">
<annotation>
<appinfo>
- <meta.element />
+ <meta.element deprecated="true" />
</appinfo>
</annotation>
<complexType>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
-
+
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
-
+
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
-
+
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
<element name="providerFactory">
<annotation>
+ <appinfo>
+ <meta.element deprecated="true"/>
+ </appinfo>
<documentation>
A symbol provider factory can be used to translate symbol addresses that can be found inside traces into symbol names.
</documentation>
<attribute name="priority" type="string" use="default" value="50">
<annotation>
<documentation>
- Specify the priority of this factory relativ to the other. It should be an integer number. If not defined or not a valid integer it will be assumed to be zero.
+ Specify the priority of this factory relative to the other. It should be an integer number. If not defined or not a valid integer it will be assumed to be zero.
</documentation>
</annotation>
</attribute>
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.tracecompass.tmf.core.symbols.ISymbolProvider;
+import org.eclipse.tracecompass.tmf.core.symbols.ISymbolProviderFactory;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.ui.symbols.ISymbolProvider;
-import org.eclipse.tracecompass.tmf.ui.symbols.ISymbolProviderFactory;
/**
* Basic symbol provider factory that can handle any trace. It will create a
*
* @author Robert Kiss
* @since 2.0
- *
+ * @deprecated use {@link org.eclipse.tracecompass.tmf.core.symbols.DefaultSymbolProvider}
*/
+@Deprecated
@NonNullByDefault
public class DefaultSymbolProvider implements ISymbolProvider {
* to handle the given trace it will return null;
*
* @param trace
- * A non-null trace
+ * A trace
* @return A newly created provider that can resolve symbols from the given
* trace or null if no such provider can be created by this factory
*/
*
* @author Robert Kiss
* @since 2.0
- *
+ * @deprecated use
+ * {@link org.eclipse.tracecompass.tmf.core.symbols.SymbolProviderManager}
+ * instead
*/
+@Deprecated
public final class SymbolProviderManager {
/**
/**
* Get the instance of the {@link SymbolProviderManager}
+ *
* @return the singleton instance of this class
*/
@SuppressWarnings("null")
import java.util.function.Consumer;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jface.action.Action;
import org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal;
import org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal;
import org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal;
+import org.eclipse.tracecompass.tmf.core.symbols.ISymbolProvider;
+import org.eclipse.tracecompass.tmf.core.symbols.SymbolProviderManager;
import org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
import org.eclipse.tracecompass.tmf.ui.editors.ITmfTraceEditor;
-import org.eclipse.tracecompass.tmf.ui.symbols.ISymbolProvider;
import org.eclipse.tracecompass.tmf.ui.symbols.ISymbolProviderPreferencePage;
import org.eclipse.tracecompass.tmf.ui.symbols.SymbolProviderConfigDialog;
-import org.eclipse.tracecompass.tmf.ui.symbols.SymbolProviderManager;
import org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.ITimeGraphTimeListener;
import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.TimeGraphContentProvider;
@Override
public int compare(ITimeGraphEntry o1, ITimeGraphEntry o2) {
- return reverse ? o2.getName().compareTo(o1.getName()) :
- o1.getName().compareTo(o2.getName());
+ return reverse ? o2.getName().compareTo(o1.getName()) : o1.getName().compareTo(o2.getName());
}
}
if (o1 instanceof ThreadEntry && o2 instanceof ThreadEntry) {
ThreadEntry t1 = (ThreadEntry) o1;
ThreadEntry t2 = (ThreadEntry) o2;
- return reverse ? Long.compare(t2.getThreadId(), t1.getThreadId()) :
- Long.compare(t1.getThreadId(), t2.getThreadId());
+ return reverse ? Long.compare(t2.getThreadId(), t1.getThreadId()) : Long.compare(t1.getThreadId(), t2.getThreadId());
}
return 0;
}
@Override
public int compare(ITimeGraphEntry o1, ITimeGraphEntry o2) {
- return reverse ? Long.compare(o2.getStartTime(), o1.getStartTime()) :
- Long.compare(o1.getStartTime(), o2.getStartTime());
+ return reverse ? Long.compare(o2.getStartTime(), o1.getStartTime()) : Long.compare(o1.getStartTime(), o2.getStartTime());
}
}
@TmfSignalHandler
public void traceClosed(TmfTraceClosedSignal signal) {
super.traceClosed(signal);
- synchronized(fSymbolProviders){
- for(ITmfTrace trace : getTracesToBuild(signal.getTrace())){
+ synchronized (fSymbolProviders) {
+ for (ITmfTrace trace : getTracesToBuild(signal.getTrace())) {
fSymbolProviders.remove(trace);
}
}
ISymbolProvider provider = fSymbolProviders.get(trace);
if (provider == null) {
provider = SymbolProviderManager.getInstance().getSymbolProvider(trace);
- provider.loadConfiguration(null);
+ provider.loadConfiguration(new NullProgressMonitor());
fSymbolProviders.put(trace, provider);
}
return;
}
long end = ss.getCurrentEndTime();
- if (start == end && !complete) { // when complete execute one last time regardless of end time
+ if (start == end && !complete) { // when complete execute one last
+ // time regardless of end time
continue;
}
try {
/*
- * Get quarks first to make sure they are in the full query result.
+ * Get quarks first to make sure they are in the full query
+ * result.
*/
List<Integer> processQuarks = ss.getQuarks(module.getProcessesPattern());
List<ITmfStateInterval> endStates = ss.queryFullState(end);
for (int processQuark : processQuarks) {
/*
- * Default to trace entry, overwrite if a process entry exists.
+ * Default to trace entry, overwrite if a process entry
+ * exists.
*/
TimeGraphEntry threadParent = traceEntry;
int processId = -1;
threadEnd = endInterval.getStartTime();
}
/*
- * Default to process/trace entry, overwrite if a thread entry exists.
+ * Default to process/trace entry, overwrite if a thread
+ * entry exists.
*/
TimeGraphEntry callStackParent = threadParent;
if (threadQuark != processQuark) {
ThreadEntry threadEntry = threadEntryMap.get(threadQuark);
if (threadEntry == null) {
if (startStates == null || callStackQuark >= startStates.size()) {
- /* attribute created after previous full query */
+ /*
+ * attribute created after previous full
+ * query
+ */
startStates = ss.queryFullState(ss.getStartTime());
}
long threadId = -1;
if (threadQuark >= endStates.size()) {
- /* attribute created after previous full query */
+ /*
+ * attribute created after previous full
+ * query
+ */
endStates = ss.queryFullState(end);
}
ITmfStateValue threadStateValue = endStates.get(threadQuark).getStateValue();
} else {
threadEntry.updateEndTime(threadEnd);
}
- /* The parent of the call stack entries will be a thread */
+ /*
+ * The parent of the call stack entries will be a
+ * thread
+ */
callStackParent = threadEntry;
}
int level = 1;
* Since we cannot know the exact analysis ID (in separate plugins), we
* will search using the analysis type.
*/
- Iterable<CallStackAnalysis> modules =
- TmfTraceUtils.getAnalysisModulesOfClass(trace, CallStackAnalysis.class);
+ Iterable<CallStackAnalysis> modules = TmfTraceUtils.getAnalysisModulesOfClass(trace, CallStackAnalysis.class);
Iterator<CallStackAnalysis> it = modules.iterator();
if (!it.hasNext()) {
/* This trace does not provide a call-stack analysis */
if (trace != null) {
for (ITmfTrace subTrace : getTracesToBuild(trace)) {
ISymbolProvider provider = fSymbolProviders.get(subTrace);
- if (provider != null) {
- ISymbolProviderPreferencePage page = provider.createPreferencePage();
+ if (provider instanceof org.eclipse.tracecompass.tmf.ui.symbols.ISymbolProvider) {
+ org.eclipse.tracecompass.tmf.ui.symbols.ISymbolProvider provider2 = (org.eclipse.tracecompass.tmf.ui.symbols.ISymbolProvider) provider;
+ ISymbolProviderPreferencePage page = provider2.createPreferencePage();
if (page != null) {
pages.add(page);
}