--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2016 EfficiOS Inc., Philippe Proulx
+ *
+ * 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.provisional.analysis.lami.core;
+
+/**
+ * Strings used in the config files describing LAMI analyses.
+ *
+ * @author Philippe Proulx
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+@SuppressWarnings({ "javadoc", "nls" })
+public interface LamiConfigFileStrings {
+
+ String PROP_NAME = "name";
+ String PROP_COMMAND = "command";
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2016 EfficiOS Inc., Philippe Proulx
+ *
+ * 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.provisional.analysis.lami.core;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Static methods to convert from a shell-like command string to individual
+ * arguments and vice versa. Not all shell parsing features are implemented.
+ *
+ * @author Philippe Proulx
+ */
+public class ShellUtils {
+
+ /**
+ * Converts the string {@code command} to a list of individual arguments.
+ * {@code command} is split on one or more spaces, but double-quoted
+ * arguments are supported, as well as escaped backslashes ({@code \\})
+ * and double quotes ({@code \"}).
+ *
+ * @param command Command string
+ * @return List of arguments extracted from {@code command}
+ */
+ public static List<String> commandStringToArgs(String command) {
+ int index = 0;
+ boolean inQuotes = false;
+ List<String> args = new ArrayList<>();
+ StringBuilder sb = new StringBuilder();
+
+ while (index < command.length()) {
+ char ch = command.charAt(index);
+
+ if (ch == '\\' && index < command.length() - 1) {
+ char escaped = command.charAt(index + 1);
+
+ if (escaped == '\\' || escaped == '"') {
+ // Valid escaped character
+ sb.append(escaped);
+ index += 2;
+ continue;
+ }
+ }
+
+ if (ch == '"') {
+ if (inQuotes) {
+ // Quoted string ends: keep the quoted string, even if empty
+ args.add(sb.toString());
+ sb.setLength(0);
+ } else {
+ // Quoted string begins
+ if (sb.length() > 0) {
+ args.add(sb.toString());
+ sb.setLength(0);
+ }
+ }
+
+ inQuotes = !inQuotes;
+ index++;
+ continue;
+ }
+
+ if (!inQuotes && ch == ' ') {
+ // Argument delimiter
+ if (sb.length() > 0) {
+ args.add(sb.toString());
+ sb.setLength(0);
+ }
+
+ index++;
+ continue;
+ }
+
+ sb.append(ch);
+ index++;
+ }
+
+ // Last argument, if any
+ if (sb.length() > 0) {
+ args.add(sb.toString());
+ }
+
+ return args;
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2016 EfficiOS Inc., Philippe Proulx
+ *
+ * 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.provisional.analysis.lami.core.module;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.function.Predicate;
+
+import org.eclipse.tracecompass.internal.provisional.analysis.lami.core.LamiConfigFileStrings;
+import org.eclipse.tracecompass.internal.provisional.analysis.lami.core.ShellUtils;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+
+/**
+ * Factory which builds {@link LamiAnalysis} objects out of configuration
+ * files.
+ *
+ * @author Philippe Proulx
+ */
+public final class ConfigFileLamiAnalysisFactory {
+
+ /**
+ * Class-specific exception, for when things go wrong with the
+ * {@link ConfigFileLamiAnalysisFactory}.
+ */
+ public static class ConfigFileLamiAnalysisFactoryException extends Exception {
+
+ private static final long serialVersionUID = 1349804105078874111L;
+
+ /**
+ * Default constructor
+ */
+ public ConfigFileLamiAnalysisFactoryException() {
+ super();
+ }
+
+ /**
+ * Constructor specifying a message
+ *
+ * @param message
+ * The exception message
+ */
+ public ConfigFileLamiAnalysisFactoryException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructor specifying both a cause and a message
+ *
+ * @param message
+ * The exception message
+ * @param cause
+ * The exception that caused this one
+ */
+ public ConfigFileLamiAnalysisFactoryException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructor specifying a cause
+ *
+ * @param cause
+ * The exception that caused this one
+ */
+ public ConfigFileLamiAnalysisFactoryException(Throwable cause) {
+ super(cause);
+ }
+
+ }
+
+ private ConfigFileLamiAnalysisFactory() {
+ }
+
+ private static String getProperty(Properties props, String propName) throws ConfigFileLamiAnalysisFactoryException {
+ String prop = props.getProperty(propName);
+
+ if (prop == null) {
+ throw new ConfigFileLamiAnalysisFactoryException(String.format("Cannot find \"%s\" property", propName)); //$NON-NLS-1$
+ }
+
+ prop = prop.trim();
+
+ if (prop.isEmpty()) {
+ throw new ConfigFileLamiAnalysisFactoryException(String.format("\"%s\" property cannot be empty", propName)); //$NON-NLS-1$
+ }
+
+ return prop;
+ }
+
+ /**
+ * Builds a {@link LamiAnalysis} object from an input stream providing the
+ * content of a configuration file.
+ * <p>
+ * The caller is responsible for opening and closing {@code inputStream}.
+ *
+ * @param inputStream
+ * Input stream for reading the configuration file; the stream is
+ * not closed by this method
+ * @param isUserDefined
+ * {@code true} if the analysis to build is user-defined
+ * @param appliesTo
+ * Predicate to use to check whether or not this analysis applies
+ * to a given trace
+ * @return Built {@link LamiAnalysis} object
+ * @throws ConfigFileLamiAnalysisFactoryException
+ * If something go wrong
+ */
+ public static LamiAnalysis buildFromInputStream(InputStream inputStream, boolean isUserDefined,
+ Predicate<ITmfTrace> appliesTo) throws ConfigFileLamiAnalysisFactoryException {
+ Properties props = new Properties();
+
+ // Load properties
+ try {
+ props.load(inputStream);
+ } catch (IOException e) {
+ throw new ConfigFileLamiAnalysisFactoryException(e);
+ }
+
+ // Get analysis' name and command
+ String name = getProperty(props, LamiConfigFileStrings.PROP_NAME);
+ String command = getProperty(props, LamiConfigFileStrings.PROP_COMMAND);
+
+ // Get individual arguments from command string
+ List<String> args = ShellUtils.commandStringToArgs(command);
+
+ return new LamiAnalysis(name, isUserDefined, appliesTo, args);
+ }
+
+ /**
+ * Builds a {@link LamiAnalysis} object from a configuration file.
+ *
+ * @param configFilePath
+ * Configuration file path
+ * @param isUserDefined
+ * {@code true} if the analysis to build is user-defined
+ * @param appliesTo
+ * Predicate to use to check whether or not this analysis applies
+ * to a given trace
+ * @return Built {@link LamiAnalysis} object
+ * @throws ConfigFileLamiAnalysisFactoryException
+ * If something go wrong
+ */
+ public static LamiAnalysis buildFromConfigFile(Path configFilePath, boolean isUserDefined,
+ Predicate<ITmfTrace> appliesTo) throws ConfigFileLamiAnalysisFactoryException {
+ try (FileInputStream propsStream = new FileInputStream(configFilePath.toFile())) {
+ return buildFromInputStream(propsStream, isUserDefined, appliesTo);
+ } catch (IOException e) {
+ throw new ConfigFileLamiAnalysisFactoryException(e);
+ }
+ }
+
+ /**
+ * Builds a list of {@link LamiAnalysis} objects from a directory containing
+ * configuration files.
+ *
+ * @param configDir
+ * Configuration directory containing the configuration files to
+ * load
+ * @param isUserDefined
+ * {@code true} if the analyses to build are user-defined
+ * @param appliesTo
+ * Predicate to use to check whether or not those analyses apply
+ * to a given trace
+ * @return List of built {@link LamiAnalysis} objects
+ * @throws ConfigFileLamiAnalysisFactoryException
+ * If something go wrong
+ */
+ public static List<LamiAnalysis> buildFromConfigDir(Path configDir, boolean isUserDefined,
+ Predicate<ITmfTrace> appliesTo) throws ConfigFileLamiAnalysisFactoryException {
+ List<LamiAnalysis> analyses = new ArrayList<>();
+
+ try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(configDir)) {
+ for (Path path : directoryStream) {
+ analyses.add(buildFromConfigFile(path, isUserDefined, appliesTo));
+ }
+ } catch (IOException e) {
+ throw new ConfigFileLamiAnalysisFactoryException(e);
+ }
+
+ return analyses;
+ }
+
+}
org.eclipse.tracecompass.tmf.core,
org.eclipse.tracecompass.tmf.ctf.core,
org.eclipse.tracecompass.analysis.os.linux.core,
- org.eclipse.tracecompass.analysis.graph.core
+ org.eclipse.tracecompass.analysis.graph.core,
+ org.eclipse.tracecompass.analysis.lami.core
Export-Package: org.eclipse.tracecompass.internal.lttng2.kernel.core;x-friends:="org.eclipse.tracecompass.lttng2.kernel.ui,org.eclipse.tracecompass.lttng2.kernel.core.tests",
org.eclipse.tracecompass.internal.lttng2.kernel.core.analysis.graph.building;x-friends:="org.eclipse.tracecompass.lttng2.kernel.ui,org.eclipse.tracecompass.lttng2.kernel.core.tests",
org.eclipse.tracecompass.internal.lttng2.kernel.core.analysis.graph.handlers;x-friends:="org.eclipse.tracecompass.lttng2.kernel.ui,org.eclipse.tracecompass.lttng2.kernel.core.tests",
.,\
about.html,\
plugin.properties,\
- plugin.xml
+ plugin.xml,\
+ lttng-analyses-configs/
src.includes = about.html
additional.bundles = org.eclipse.jdt.annotation
jars.extra.classpath = platform:/plugin/org.eclipse.jdt.annotation
--- /dev/null
+###############################################################################
+# Copyright (c) 2016 EfficiOS 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
+###############################################################################
+
+name = LTTng-Analyses: CPU Usage Top
+command = lttng-cputop-mi
--- /dev/null
+###############################################################################
+# Copyright (c) 2016 EfficiOS 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
+###############################################################################
+
+analyses = cputop \
+ iolatencyfreq \
+ iolatencystats \
+ iolatencytop \
+ iolog \
+ iousagetop \
+ irqfreq \
+ irqlog \
+ irqstats \
+ memtop \
+ schedfreq \
+ schedlog \
+ schedstats \
+ schedtop \
+ syscallstats
--- /dev/null
+###############################################################################
+# Copyright (c) 2016 EfficiOS 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
+###############################################################################
+
+name = LTTng-Analyses: I/O Latency Frequency Distribution
+command = lttng-iolatencyfreq-mi
--- /dev/null
+###############################################################################
+# Copyright (c) 2016 EfficiOS 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
+###############################################################################
+
+name = LTTng-Analyses: I/O Latency Statistics
+command = lttng-iolatencystats-mi
--- /dev/null
+###############################################################################
+# Copyright (c) 2016 EfficiOS 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
+###############################################################################
+
+name = LTTng-Analyses: I/O Latency Top
+command = lttng-iolatencytop-mi
--- /dev/null
+###############################################################################
+# Copyright (c) 2016 EfficiOS 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
+###############################################################################
+
+name = LTTng-Analyses: I/O Usage Log
+command = lttng-iolog-mi
--- /dev/null
+###############################################################################
+# Copyright (c) 2016 EfficiOS 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
+###############################################################################
+
+name = LTTng-Analyses: I/O Usage Top
+command = lttng-iousagetop-mi
--- /dev/null
+###############################################################################
+# Copyright (c) 2016 EfficiOS 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
+###############################################################################
+
+name = LTTng-Analyses: Interrupt Frequency Distribution
+command = lttng-irqfreq-mi
--- /dev/null
+###############################################################################
+# Copyright (c) 2016 EfficiOS 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
+###############################################################################
+
+name = LTTng-Analyses: Interrupt Log
+command = lttng-irqlog-mi
--- /dev/null
+###############################################################################
+# Copyright (c) 2016 EfficiOS 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
+###############################################################################
+
+name = LTTng-Analyses: Interrupt Statistics
+command = lttng-irqstats-mi
--- /dev/null
+###############################################################################
+# Copyright (c) 2016 EfficiOS 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
+###############################################################################
+
+name = LTTng-Analyses: Memory Usage Top
+command = lttng-memtop-mi
--- /dev/null
+###############################################################################
+# Copyright (c) 2016 EfficiOS 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
+###############################################################################
+
+name = LTTng-Analyses: Scheduling Latency Frequency Distribution
+command = lttng-schedfreq-mi
--- /dev/null
+###############################################################################
+# Copyright (c) 2016 EfficiOS 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
+###############################################################################
+
+name = LTTng-Analyses: Scheduling Latency Log
+command = lttng-schedlog-mi
--- /dev/null
+###############################################################################
+# Copyright (c) 2016 EfficiOS 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
+###############################################################################
+
+name = LTTng-Analyses: Scheduling Latency Statistics
+command = lttng-schedstats-mi
--- /dev/null
+###############################################################################
+# Copyright (c) 2016 EfficiOS 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
+###############################################################################
+
+name = LTTng-Analyses: Scheduling Latency Top
+command = lttng-schedtop-mi
--- /dev/null
+###############################################################################
+# Copyright (c) 2016 EfficiOS 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
+###############################################################################
+
+name = LTTng-Analyses: System Call Statistics
+command = lttng-syscallstats-mi
package org.eclipse.tracecompass.internal.lttng2.kernel.core;
+import java.io.IOException;
+
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.tracecompass.internal.lttng2.kernel.core.event.matching.TcpEventMatching;
import org.eclipse.tracecompass.internal.lttng2.kernel.core.event.matching.TcpLttngEventMatching;
+import org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.ConfigFileLamiAnalysisFactory.ConfigFileLamiAnalysisFactoryException;
import org.eclipse.tracecompass.tmf.core.event.matching.TmfEventMatching;
import org.osgi.framework.BundleContext;
plugin = this;
TmfEventMatching.registerMatchObject(new TcpEventMatching());
TmfEventMatching.registerMatchObject(new TcpLttngEventMatching());
+
+ try {
+ LttngAnalysesLoader.load();
+ } catch (ConfigFileLamiAnalysisFactoryException | IOException e) {
+ // Not the end of the world if the analyses are not available
+ logWarning("Cannot find LTTng analyses configuration files: " + e.getMessage()); //$NON-NLS-1$
+ }
}
@Override
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2016 EfficiOS Inc., Philippe Proulx
+ *
+ * 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.lttng2.kernel.core;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout;
+import org.eclipse.tracecompass.internal.lttng2.kernel.core.trace.layout.Lttng27EventLayout;
+import org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.ConfigFileLamiAnalysisFactory;
+import org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.ConfigFileLamiAnalysisFactory.ConfigFileLamiAnalysisFactoryException;
+import org.eclipse.tracecompass.internal.provisional.analysis.lami.core.module.LamiAnalysis;
+import org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace;
+import org.eclipse.tracecompass.tmf.core.analysis.ondemand.OnDemandAnalysisManager;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+
+/**
+ * Loader of LTTng analyses.
+ *
+ * @author Philippe Proulx
+ */
+final class LttngAnalysesLoader {
+
+ private static final String CONFIG_DIR_NAME = "lttng-analyses-configs"; //$NON-NLS-1$
+
+ private LttngAnalysesLoader() {
+ }
+
+ private static boolean appliesTo(ITmfTrace trace) {
+ /* LTTng-Analysis is supported only on LTTng >= 2.7 kernel traces */
+ if (trace instanceof LttngKernelTrace) {
+ LttngKernelTrace kernelTrace = (LttngKernelTrace) trace;
+ IKernelAnalysisEventLayout layout = kernelTrace.getKernelEventLayout();
+
+ if (layout instanceof Lttng27EventLayout) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private static String[] getAnalysisNames() throws IOException {
+ ClassLoader loader = LttngAnalysesLoader.class.getClassLoader();
+ String path = "/" + CONFIG_DIR_NAME + "/index.properties"; //$NON-NLS-1$ //$NON-NLS-2$
+ String[] names = new String[0];
+ Properties indexProps = new Properties();
+
+ try (InputStream in = loader.getResourceAsStream(path)) {
+ if (in == null) {
+ return names;
+ }
+
+ indexProps.load(in);
+ }
+
+ String analyses = indexProps.getProperty("analyses"); //$NON-NLS-1$
+
+ if (analyses == null) {
+ return names;
+ }
+
+ analyses = analyses.trim();
+ String[] splitNames = analyses.split("\\s+"); //$NON-NLS-1$
+
+ return splitNames;
+ }
+
+ public static void load() throws ConfigFileLamiAnalysisFactoryException, IOException {
+ String[] names = getAnalysisNames();
+ ClassLoader loader = LttngAnalysesLoader.class.getClassLoader();
+
+ for (String name : names) {
+ String path = String.format("/%s/%s.properties", CONFIG_DIR_NAME, name); //$NON-NLS-1$
+
+ try (InputStream in = loader.getResourceAsStream(path)) {
+ if (in == null) {
+ continue;
+ }
+
+ LamiAnalysis analysis = ConfigFileLamiAnalysisFactory.buildFromInputStream(in, false, LttngAnalysesLoader::appliesTo);
+ OnDemandAnalysisManager.getInstance().registerAnalysis(analysis);
+ }
+ }
+ }
+
+}
<import plugin="org.eclipse.help"/>
</requires>
+ <plugin
+ id="org.eclipse.tracecompass.analysis.lami.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.tracecompass.analysis.lami.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
<plugin
id="org.eclipse.tracecompass.analysis.os.linux.core"
download-size="0"
<import feature="org.eclipse.platform" version="0.0.0" match="greaterOrEqual"/>
</requires>
+ <plugin
+ id="org.json"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
<plugin
id="org.antlr.runtime"
download-size="0"
<plugin id="org.eclipse.core.net.linux.x86"/>
<plugin id="org.eclipse.linuxtools.dataviewers.piechart"/>
<plugin id="org.eclipse.tracecompass.tracing.rcp.help"/>
+ <plugin id="org.json"/>
<plugin id="org.sat4j.core"/>
<plugin id="org.sat4j.pb"/>
<plugin id="org.swtchart"/>
import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;
}
}));
- private final List<OndemandAnalysisWrapper> fAnalysisWrappers;
+ private final Set<OndemandAnalysisWrapper> fAnalysisWrappers;
/**
* Internal class used to store extension point information
* Private constructor, should only be called via {@link #getInstance()}.
*/
private OnDemandAnalysisManager() {
- fAnalysisWrappers = new ArrayList<>();
+ fAnalysisWrappers = new HashSet<>();
IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_POINT_ID);
for (IConfigurationElement element : configElements) {
public Set<IOnDemandAnalysis> getOndemandAnalyses(ITmfTrace trace) {
return checkNotNull(analysisCache.getUnchecked(trace));
}
+
+ /**
+ * Registers an on-demand analysis to this manager.
+ *
+ * @param analysis
+ * On-demand analysis to register
+ */
+ public void registerAnalysis(IOnDemandAnalysis analysis) {
+ fAnalysisWrappers.add(new OndemandAnalysisWrapper(analysis));
+ }
}