Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,28 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;

import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.osgi.util.NLS;
import org.eclipse.tracecompass.analysis.profiling.core.instrumented.IFlameChartProvider;
import org.eclipse.tracecompass.analysis.profiling.core.tree.IWeightedTreeProvider;
import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
import org.eclipse.tracecompass.tmf.core.component.DataProviderConstants;
import org.eclipse.tracecompass.tmf.core.dataprovider.IDataProviderDescriptor;
import org.eclipse.tracecompass.tmf.core.dataprovider.IDataProviderDescriptor.ProviderType;
import org.eclipse.tracecompass.tmf.core.dataprovider.IDataProviderFactory;
import org.eclipse.tracecompass.tmf.core.model.DataProviderDescriptor;
import org.eclipse.tracecompass.tmf.core.model.timegraph.TmfTimeGraphCompositeDataProvider;
import org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel;
import org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataProvider;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;

import com.google.common.annotations.VisibleForTesting;

Expand Down Expand Up @@ -97,4 +107,27 @@ public static void registerDataProviderWithId(String id, @Nullable FlameGraphDat
}
INSTANCES.put(id, dataProvider);
}
@Override
public Collection<IDataProviderDescriptor> getDescriptors(ITmfTrace trace) {
Iterable<IFlameChartProvider> modules = TmfTraceUtils.getAnalysisModulesOfClass(trace, IFlameChartProvider.class);
List<IDataProviderDescriptor> descriptors = new ArrayList<>();
Set<String> existingModules = new HashSet<>();
for (IFlameChartProvider module : modules) {
IAnalysisModule analysis = module;
// Only add analysis once per trace (which could be an experiment)
if (!existingModules.contains(analysis.getId())) {
DataProviderDescriptor.Builder builder = new DataProviderDescriptor.Builder();
builder.setId(FlameGraphDataProvider.ID + DataProviderConstants.ID_SEPARATOR + analysis.getId())
.setParentId(analysis.getConfiguration() != null ? analysis.getId() : null)
.setName(Objects.requireNonNull(analysis.getName() + " - " + Messages.FlameGraphDataProvider_Title)) //$NON-NLS-1$
.setDescription(Objects.requireNonNull(NLS.bind(Messages.FlameGraphDataProvider_Description, analysis.getHelpText())))
.setProviderType(ProviderType.GANTT_CHART)
.setConfiguration(analysis.getConfiguration());
descriptors.add(builder.build());
existingModules.add(analysis.getId());
}
}
return descriptors;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2016 Ericsson
* Copyright (c) 2016, 2025 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License 2.0 which
Expand All @@ -12,6 +12,7 @@
package org.eclipse.tracecompass.internal.analysis.profiling.core.flamegraph;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.osgi.util.NLS;

/**
Expand Down Expand Up @@ -40,6 +41,13 @@ public class Messages extends NLS {
/** Label for the goto max action */
public static String FlameGraph_GoToMax;

/** Title of the dataprovider */
public static @Nullable String FlameGraphDataProvider_Title;

/** Description of the dataprovider */
public static @Nullable String FlameGraphDataProvider_Description;


static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2019 École Polytechnique de Montréal
# Copyright (c) 2019, 2025 École Polytechnique de Montréal and others
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -17,3 +17,6 @@ FlameGraph_Max=Maximum
FlameGraph_Deviation=Deviation
FlameGraph_GoToMin=Go to minimum
FlameGraph_GoToMax=Go to maximum

FlameGraphDataProvider_Title=Flame Graph
FlameGraphDataProvider_Description=Show Flame Graph provided by {0}
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,11 @@ public class DataProviderManagerTest {
.setProviderType(ProviderType.TREE_TIME_XY)
.setId("org.eclipse.tracecompass.internal.analysis.timing.core.segmentstore.scatter.dataprovider:org.eclipse.tracecompass.lttng2.ust.core.analysis.callstack");
EXPECTED_UST_DP_DESCRIPTORS.add(builder.build());
builder.setName("LTTng-UST CallStack (new) - Flame Graph")
.setDescription("Show Flame Graph provided by Analysis module: LTTng-UST CallStack (new)")
.setProviderType(ProviderType.GANTT_CHART)
.setId("org.eclipse.tracecompass.analysis.profiling.core.flamegraph:org.eclipse.tracecompass.lttng2.ust.core.analysis.callstack");
EXPECTED_UST_DP_DESCRIPTORS.add(builder.build());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tmf/org.eclipse.tracecompass.tmf.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-Vendor: %Bundle-Vendor
Bundle-Version: 10.1.0.qualifier
Bundle-Version: 10.2.0.qualifier
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.tracecompass.tmf.core;singleton:=true
Bundle-Activator: org.eclipse.tracecompass.internal.tmf.core.Activator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,15 @@ public enum ProviderType {
* A provider with no data. Can be used for grouping purposes and/or as data provider configurator.
* @since 9.5
*/
NONE
NONE,
/**
* A provider for a generic GANTT_CHART model. It uses the same data
* provider interface than TIME_GRAPH, but has a different x-axis other
* than time, e.g. durations.
*
* @since 10.2
*/
GANTT_CHART
}

/**
Expand Down
Loading