that being the packages in the "alltests" and "examples" plugins.
Change-Id: Ia9d28cefaed3d2974ba67e6902eb04763ba75413
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
org.eclipse.tracecompass.pcap.core.tests;bundle-version="1.0.0",
org.eclipse.tracecompass.tmf.pcap.core.tests;bundle-version="1.0.0",
org.eclipse.tracecompass.tmf.pcap.ui.swtbot.tests;bundle-version="1.0.0"
-Export-Package: org.eclipse.linuxtools.lttng.alltests;x-internal:=true,
- org.eclipse.linuxtools.lttng.alltests.perf;x-internal:=true,
- org.eclipse.linuxtools.lttng.alltests.swtbot;x-internal:=true
+Export-Package: org.eclipse.tracecompass.alltests;x-internal:=true,
+ org.eclipse.tracecompass.alltests.perf;x-internal:=true,
+ org.eclipse.tracecompass.alltests.swtbot;x-internal:=true
Import-Package: org.apache.derby.jdbc,
org.json
-Bundle-Activator: org.eclipse.linuxtools.lttng.alltests.Activator
+Bundle-Activator: org.eclipse.tracecompass.alltests.Activator
<booleanAttribute key="includeOptional" value="true"/>
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/org.eclipse.tracecompass.lttng.alltests/src/org/eclipse/linuxtools/lttng/alltests/RunAllCoreTests.java"/>
+<listEntry value="/org.eclipse.tracecompass.lttng.alltests/src/org/eclipse/tracecompass/lttng/alltests/RunAllCoreTests.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.linuxtools.lttng.alltests.RunAllCoreTests"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.tracecompass.lttng.alltests.RunAllCoreTests"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -consolelog"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.tracecompass.lttng.alltests"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 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
- *
- * Contributors:
- * Marc-Andre Laperle - Initial implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.alltests;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle. No more than one such
- * plug-in can exist at any time.
- * <p>
- * It also provides the plug-in's general logging facility and manages the
- * internal tracer.
- */
-public class Activator extends Plugin {
-
- /**
- * The plug-in ID
- */
- public static final String PLUGIN_ID = "org.eclipse.linuxtools.lttng.alltests"; //$NON-NLS-1$
-
- /**
- * The shared instance
- */
- private static Activator fPlugin;
-
- /**
- * Constructor
- */
- public Activator() {
- setDefault(this);
- }
-
- // ------------------------------------------------------------------------
- // Accessors
- // ------------------------------------------------------------------------
-
- /**
- * Returns the AllTests plug-in instance.
- *
- * @return the AllTests plug-in instance.
- */
- public static Activator getDefault() {
- return fPlugin;
- }
-
- // Sets plug-in instance
- private static void setDefault(Activator plugin) {
- fPlugin = plugin;
- }
-
- // ------------------------------------------------------------------------
- // Plugin
- // ------------------------------------------------------------------------
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- setDefault(this);
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- setDefault(null);
- super.stop(context);
- }
-
-
- /**
- * Log an IStatus object directly
- *
- * @param status
- * The status to log
- */
- public static void log(IStatus status) {
- fPlugin.getLog().log(status);
- }
-
- // ------------------------------------------------------------------------
- // Log INFO
- // ------------------------------------------------------------------------
-
- /**
- * Logs a message with severity INFO in the runtime log of the plug-in.
- *
- * @param message
- * A message to log
- */
- public static void logInfo(String message) {
- fPlugin.getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
- }
-
- /**
- * Logs a message and exception with severity INFO in the runtime log of the
- * plug-in.
- *
- * @param message
- * A message to log
- * @param exception
- * The corresponding exception
- */
- public static void logInfo(String message, Throwable exception) {
- fPlugin.getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message, exception));
- }
-
- // ------------------------------------------------------------------------
- // Log WARNING
- // ------------------------------------------------------------------------
-
- /**
- * Logs a message and exception with severity WARNING in the runtime log of
- * the plug-in.
- *
- * @param message
- * A message to log
- */
- public static void logWarning(String message) {
- fPlugin.getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message));
- }
-
- /**
- * Logs a message and exception with severity WARNING in the runtime log of
- * the plug-in.
- *
- * @param message
- * A message to log
- * @param exception
- * The corresponding exception
- */
- public static void logWarning(String message, Throwable exception) {
- fPlugin.getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message, exception));
- }
-
- // ------------------------------------------------------------------------
- // Log ERROR
- // ------------------------------------------------------------------------
-
- /**
- * Logs a message and exception with severity ERROR in the runtime log of
- * the plug-in.
- *
- * @param message
- * A message to log
- */
- public static void logError(String message) {
- fPlugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
- }
-
- /**
- * Logs a message and exception with severity ERROR in the runtime log of
- * the plug-in.
- *
- * @param message
- * A message to log
- * @param exception
- * The corresponding exception
- */
- public static void logError(String message, Throwable exception) {
- fPlugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 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
- *
- * Contributors:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.alltests;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * Master test suite for all Linux Tools LTTng unit tests.
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- org.eclipse.tracecompass.btf.core.tests.AllTests.class,
- org.eclipse.tracecompass.ctf.core.tests.AllCtfCoreTests.class,
- org.eclipse.tracecompass.ctf.parser.tests.AllCtfParserTests.class,
- org.eclipse.tracecompass.gdbtrace.core.tests.AllGdbTraceCoreTests.class,
- org.eclipse.tracecompass.lttng2.control.core.tests.AllTests.class,
- org.eclipse.tracecompass.lttng2.kernel.core.tests.AllTests.class,
- org.eclipse.tracecompass.lttng2.ust.core.tests.AllTests.class,
- org.eclipse.tracecompass.pcap.core.tests.AllPcapCoreTests.class,
- org.eclipse.tracecompass.statesystem.core.tests.AllTests.class,
- org.eclipse.tracecompass.tmf.analysis.xml.core.tests.AllAnalysisXmlCoreTests.class,
- org.eclipse.tracecompass.tmf.core.tests.AllTmfCoreTests.class,
- org.eclipse.tracecompass.tmf.ctf.core.tests.AllTests.class,
- org.eclipse.tracecompass.tmf.pcap.core.tests.AllTmfPcapCoreTests.class,
- org.eclipse.tracecompass.tmf.analysis.xml.core.tests.AllAnalysisXmlCoreTests.class,
- org.eclipse.tracecompass.tmf.ctf.core.tests.AllTests.class,
- org.eclipse.tracecompass.tmf.pcap.core.tests.AllTmfPcapCoreTests.class
-})
-public class RunAllCoreTests {
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 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
- *
- * Contributors:
- * Alexandre Montplaisir - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.alltests;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * Master test suite for all Linux Tools LTTng unit tests.
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- org.eclipse.tracecompass.gdbtrace.ui.tests.AllGdbTraceUITests.class,
- org.eclipse.tracecompass.lttng2.control.ui.tests.AllTests.class,
- org.eclipse.tracecompass.lttng2.kernel.ui.tests.AllTests.class,
- org.eclipse.tracecompass.lttng2.ust.ui.tests.AllTests.class,
- org.eclipse.tracecompass.tmf.analysis.xml.ui.tests.AllAnalysisXmlUiTests.class,
- org.eclipse.tracecompass.tmf.ui.tests.AllTmfUITests.class,
-})
-public class RunAllUITests {
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 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
- *
- * Contributors:
- * Marc-Andre Laperle - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.alltests.perf;
-
-import java.io.FileWriter;
-import java.io.IOException;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.linuxtools.lttng.alltests.Activator;
-import org.eclipse.test.internal.performance.PerformanceTestPlugin;
-import org.eclipse.test.internal.performance.data.Dim;
-import org.eclipse.test.internal.performance.db.DB;
-import org.eclipse.test.internal.performance.db.Scenario;
-import org.eclipse.test.internal.performance.db.SummaryEntry;
-import org.eclipse.test.internal.performance.db.TimeSeries;
-import org.eclipse.test.internal.performance.db.Variations;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.junit.Test;
-
-/**
- * Convert results from the database to JSON suitable for display.
- *
- * Normal charts:
- *
- * Individual charts are generated into JSON files in the form chart#.json where
- * # is incremented for each new chart. A chart contains data points consisting
- * of X and Y values suitable for a line chart. Each point can also have
- * additional data, for example the commit id. This format is compatible with
- * nvd3. For example:
- *
- * <pre>
- * <code>
- * [{
- * "key": "Experiment Benchmark:84 traces",
- * "values": [{
- * "label": {"commit": "fe3c142"},
- * "x": 1405024320000,
- * "y": 17592
- * }]
- * }]
- * </code>
- * </pre>
- *
- * Normal charts metadata:
- *
- * Each chart has an entry in the metada.js file which organizes the charts per
- * component and contains additional information to augment the format expected
- * by nvd3. Each entry contains the combination of OS and JVM, the filename (in
- * JSON format), the title of the chart, the unit (seconds, etc) and the
- * dimension (CPU time, used heap, etc).
- *
- * <pre>
- * <code>
- * var MetaData = {
- * "applicationComponents": {
- * "Experiment benchmark": {
- * "name": "Experiment benchmark",
- * "tests": [
- * {
- * "dimension": "CPU Time",
- * "file": "chart12",
- * "jvm": "1.7",
- * "os": "linux",
- * "title": "Experiment Benchmark:84 traces",
- * "unit": "s"
- * },
- * {
- * "dimension": "CPU Time",
- * "file": "chart11",
- * "jvm": "1.7",
- * "os": "linux",
- * "title": "Experiment Benchmark:6 traces",
- * "unit": "s"
- * },
- * ...
- * </code>
- * </pre>
- *
- * Overview charts:
- *
- * In addition to the normal charts, overview charts are generated. An overview
- * chart presents a summary of the scenarios ran for a given OS and JVM
- * combination. Only scenarios marked as "global" are added to the overview
- * because of space concerns. Overview charts are generated under the
- * chart_overview#.json name and look similar in structure to the normal charts
- * except that they contain more than one series.
- *
- * <pre>
- * <code>
- * [
- * {
- * "key": "CTF Read & Seek Benchmark (500 seeks):tr",
- * "values": [
- * {
- * "label": {"commit": "4d34345"},
- * "x": 1405436820000,
- * "y": 5382.5
- * },
- * ...
- * ]
- * },
- * {
- * "key": "CTF Read Benchmark:trace-kernel",
- * "values": [
- * {
- * "label": {"commit": "4d34345"},
- * "x": 1405436820000,
- * "y": 1311.5
- * },
- * ...
- * ]
- * },
- * ...
- * </code>
- * </pre>
- *
- * Overview charts metadata:
- *
- * Overview charts also have similar metadata entries to normal charts except
- * they are not organized by component.
- *
- * <pre>
- * <code>
- * var MetaData = {
- * ...
- * "overviews": {
- * "1": {
- * "dimension": "",
- * "file": "chart_overview0",
- * "jvm": "1.7",
- * "os": "linux",
- * "title": "linux / 1.7",
- * "unit": ""
- * },
- * "2": {
- * "dimension": "",
- * "file": "chart_overview1",
- * "jvm": "1.7",
- * "os": "windows",
- * "title": "windows / 1.7",
- * "unit": ""
- * },
- * ...
- * </code>
- * </pre>
- *
- * Finally, since we want to be able to filter all the charts by OS/JVM
- * combination, there is a section in the metadata that lists all the
- * combinations:
- *
- * <pre>
- * <code>
- * "osjvm": {
- * "1": {
- * "description": "linux / 1.7",
- * "jvm": "1.7",
- * "os": "linux"
- * },
- * "2": {
- * "description": "windows / 1.7",
- * "jvm": "1.7",
- * "os": "windows"
- * },
- * "3": {
- * "description": "mac / 1.7",
- * "jvm": "1.7",
- * "os": "mac"
- * }
- * },
- * </code>
- * </pre>
- *
- * All of this data is meant to be view on a website. Specifically, the source
- * code for our implementation is available on GitHub at
- * https://github.com/PSRCode/ITCFYWebsite
- *
- * It makes use of the NVD3 project to display the charts based on the data
- * generated by this class.
- */
-public class PerfResultsToJSon {
-
- /*
- * Labels
- */
- private static final String APPLICATION_COMPONENTS_LABEL = "applicationComponents";
- private static final String BUILD_LABEL = "build";
- private static final String COMMIT_LABEL = "commit";
- private static final String CONFIG_LABEL = "config";
- private static final String DESCRIPTION_LABEL = "description";
- private static final String DIMENSION_LABEL = "dimension";
- private static final String FILE_LABEL = "file";
- private static final String HOST_LABEL = "host";
- private static final String JVM_LABEL = "jvm";
- private static final String KEY_LABEL = "key";
- private static final String LABEL_LABEL = "label";
- private static final String NAME_LABEL = "name";
- private static final String OS_LABEL = "os";
- private static final String OSJVM_LABEL = "osjvm";
- private static final String OVERVIEWS_LABEL = "overviews";
- private static final String TESTS_LABEL = "tests";
- private static final String TITLE_LABEL = "title";
- private static final String UNIT_LABEL = "unit";
- private static final String VALUES_LABEL = "values";
- private static final String X_LABEL = "x";
- private static final String Y_LABEL = "y";
-
- private static final String BUILD_DATE_FORMAT = "yyyyMMdd-HHmm";
- private static final String OVERVIEW_CHART_FILE_NAME = "chart_overview";
- private static final String METADATA_FILE_NAME = "meta";
- private static final String METADATA_FILE_NAME_EXTENSION = ".js";
- private static final String CHART_FILE_NAME = "chart";
- private static final String CHART_FILE_NAME_EXTENSION = ".json";
- private static final String WILDCARD_PATTERN = "%";
- private static final String COMPONENT_SEPARATOR = "#";
- private static final String META_DATA_JAVASCRIPT_START = "var MetaData = ";
-
- private static Pattern BUILD_DATE_PATTERN = Pattern.compile("(\\w+-\\w+)(-\\w+)?");
- private static Pattern COMMIT_PATTERN = Pattern.compile(".*-.*-(.*)");
-
- private JSONObject fApplicationComponents = new JSONObject();
- private JSONObject fOverviews = new JSONObject();
-
- private int fNumChart = 0;
- private int fNumOverviewChart = 0;
-
- /**
- * Convert results from the database to JSON suitable for display
- *
- * <pre>
- * For each variant (os/jvm combination)
- * - For each summary entry (scenario)
- * - Generate a chart
- * - Add it to global summary (if needed)
- * - Create the metadata for this test
- * - Create an overview chart for this os/jvm
- * </pre>
- *
- * @throws JSONException
- * JSON error
- * @throws IOException
- * IO error
- */
- @Test
- public void parseResults() throws JSONException, IOException {
- Variations configVariations = PerformanceTestPlugin.getVariations();
- JSONObject osJvmVariants = createOsJvm();
-
- Iterator<?> keysIt = osJvmVariants.keys();
- while (keysIt.hasNext()) {
- JSONArray overviewSummarySeries = new JSONArray();
-
- JSONObject variant = osJvmVariants.getJSONObject((String) keysIt.next());
- String seriesKey = PerformanceTestPlugin.BUILD;
-
- // Clone the variations from the environment because it might have
- // extra parameters like host=, etc.
- Variations buildVariations = (Variations) configVariations.clone();
- buildVariations.setProperty(JVM_LABEL, variant.getString(JVM_LABEL));
- buildVariations.setProperty(CONFIG_LABEL, variant.getString(OS_LABEL));
- buildVariations.setProperty(BUILD_LABEL, WILDCARD_PATTERN);
-
- Scenario[] scenarios = DB.queryScenarios(buildVariations, WILDCARD_PATTERN, seriesKey, null);
- SummaryEntry[] summaryEntries = DB.querySummaries(buildVariations, WILDCARD_PATTERN);
- for (SummaryEntry entry : summaryEntries) {
- Scenario scenario = getScenario(entry.scenarioName, scenarios);
- JSONObject scenarioSeries = createScenarioChart(scenario, entry, buildVariations);
- // Add to global summary
- if (scenarioSeries != null && entry.isGlobal) {
- overviewSummarySeries.put(scenarioSeries);
- }
- }
-
- JSONObject overviewMetadata = createOverviewChart(overviewSummarySeries, buildVariations);
- fOverviews.put(Integer.toString(fNumOverviewChart), overviewMetadata);
- }
-
- // Create the matadata javascript file that includes OS/JVM combinations
- // (for filtering), application components and overviews (one of OS/JVM
- // combination)
- JSONObject rootMetadata = new JSONObject();
- rootMetadata.put(OSJVM_LABEL, osJvmVariants);
- rootMetadata.put(APPLICATION_COMPONENTS_LABEL, fApplicationComponents);
- rootMetadata.put(OVERVIEWS_LABEL, fOverviews);
- try (FileWriter fw1 = new FileWriter(METADATA_FILE_NAME + METADATA_FILE_NAME_EXTENSION)) {
- fw1.write(META_DATA_JAVASCRIPT_START + rootMetadata.toString(4));
- }
- }
-
- /**
- * Create chart for a scenario instance and add it to the relevant metadatas
- *
- * @param scenario
- * the scenario. For example,
- * "CTF Read & Seek Benchmark (500 seeks)".
- * @param entry
- * an entry from the summary. Only scenarios that are part of the
- * summary are processed.
- * @param variations
- * all variations to consider to create the scenario chart. For
- * example build=%;jvm=1.7;config=linux will generate a chart for
- * all builds on Linux / JVM 1.7
- *
- * @return
- * @throws JSONException
- * JSON error
- * @throws IOException
- * IO error
- */
- private JSONObject createScenarioChart(Scenario scenario, SummaryEntry entry, Variations variations) throws JSONException, IOException {
- if (scenario == null) {
- return null;
- }
- String[] split = entry.scenarioName.split(COMPONENT_SEPARATOR);
- if (split.length < 3) {
- Activator.logError("Invalid scenario name \"" + entry.scenarioName + "\", it must be in format: org.package.foo#component#test");
- return null;
- }
-
- // Generate individual chart
- JSONArray rootScenario = new JSONArray();
- JSONObject series = createSerie(scenario, variations, entry.shortName, entry.dimension);
- rootScenario.put(series);
- int numChart = fNumChart++;
- try (FileWriter fw = new FileWriter(CHART_FILE_NAME + numChart + CHART_FILE_NAME_EXTENSION)) {
- fw.write(rootScenario.toString(4));
- }
-
- // Create the metadata
- JSONObject testMetadata = new JSONObject();
- testMetadata.put(TITLE_LABEL, entry.shortName);
- testMetadata.put(FILE_LABEL, CHART_FILE_NAME + numChart);
- testMetadata.put(OS_LABEL, variations.getProperty(CONFIG_LABEL));
- testMetadata.put(JVM_LABEL, variations.getProperty(JVM_LABEL));
- testMetadata.put(DIMENSION_LABEL, entry.dimension.getName());
- testMetadata.put(UNIT_LABEL, entry.dimension.getUnit().getShortName());
-
- // Add the scenario to the metadata, under the correct component
- String componentName = split[1];
- JSONObject componentObject = null;
- if (fApplicationComponents.has(componentName)) {
- componentObject = fApplicationComponents.getJSONObject(componentName);
- } else {
- componentObject = new JSONObject();
- componentObject.put(NAME_LABEL, componentName);
- componentObject.put(TESTS_LABEL, new JSONArray());
- fApplicationComponents.put(componentName, componentObject);
- }
- JSONArray tests = componentObject.getJSONArray(TESTS_LABEL);
- tests.put(testMetadata);
-
- return series;
- }
-
- /**
- * Create an overview chart for this OS / JVM combination. The chart is made
- * of multiple series (scenarios) that were marked as global.
- *
- * @param overviewSummarySeries
- * an array of series to include in the chart (multiple
- * scenarios)
- * @param variations
- * the variations used to generate the series to be included in
- * this overview chart. For example build=%;jvm=1.7;config=linux
- * will generate an overview chart for Linux / JVM 1.7
- * @return the overview metadata JSON object
- * @throws JSONException
- * JSON error
- * @throws IOException
- * io error
- */
- private JSONObject createOverviewChart(JSONArray overviewSummarySeries, Variations variations) throws IOException, JSONException {
- int numOverviewChart = fNumOverviewChart++;
- try (FileWriter fw = new FileWriter(OVERVIEW_CHART_FILE_NAME + numOverviewChart + CHART_FILE_NAME_EXTENSION)) {
- fw.write(overviewSummarySeries.toString(4));
- }
-
- String os = variations.getProperty(CONFIG_LABEL);
- String jvm = variations.getProperty(JVM_LABEL);
-
- // Create the overview metadata
- JSONObject overviewMetadata = new JSONObject();
- overviewMetadata.put(TITLE_LABEL, os + " / " + jvm);
- overviewMetadata.put(FILE_LABEL, OVERVIEW_CHART_FILE_NAME + numOverviewChart);
- overviewMetadata.put(OS_LABEL, os);
- overviewMetadata.put(JVM_LABEL, jvm);
- overviewMetadata.put(DIMENSION_LABEL, "");
- overviewMetadata.put(UNIT_LABEL, "");
-
- return overviewMetadata;
- }
-
- private static Scenario getScenario(String scenarioName, Scenario[] scenarios) {
- for (int i = 0; i < scenarios.length; i++) {
- Scenario s = scenarios[i];
- if (s.getScenarioName().equals(scenarioName)) {
- return s;
- }
-
- }
- return null;
- }
-
- /**
- * Get all combinations of OS / JVM. This will be used for filtering.
- *
- * @return the JSON object containing all the combinations
- * @throws JSONException
- * JSON error
- */
- private static JSONObject createOsJvm() throws JSONException {
- JSONObject osjvm = new JSONObject();
- List<String> oses = getDistinctOses();
-
- int osJvmIndex = 1;
- for (String os : oses) {
- String key = JVM_LABEL;
- Variations v = new Variations();
-
- v.setProperty(BUILD_LABEL, WILDCARD_PATTERN);
- v.setProperty(HOST_LABEL, WILDCARD_PATTERN);
- v.setProperty(CONFIG_LABEL, os);
- v.setProperty(JVM_LABEL, WILDCARD_PATTERN);
-
- List<String> jvms = new ArrayList<>();
- DB.queryDistinctValues(jvms, key, v, WILDCARD_PATTERN);
- for (String jvm : jvms) {
- JSONObject osjvmItem = new JSONObject();
- osjvmItem.put(OS_LABEL, os);
- osjvmItem.put(JVM_LABEL, jvm);
- osjvmItem.put(DESCRIPTION_LABEL, os + " / " + jvm);
- osjvm.put(Integer.toString(osJvmIndex), osjvmItem);
- osJvmIndex++;
- }
- }
-
- return osjvm;
- }
-
- /**
- * Get all the distinct OS values
- *
- * @return the distinct OS values
- */
- private static List<String> getDistinctOses() {
- List<String> configs = new ArrayList<>();
- String key = PerformanceTestPlugin.CONFIG;
- Variations v = new Variations();
- v.setProperty(WILDCARD_PATTERN, WILDCARD_PATTERN);
- DB.queryDistinctValues(configs, key, v, WILDCARD_PATTERN);
- return configs;
- }
-
- /**
- * This main can be run from within Eclipse provided everything is on the
- * class path.
- *
- * @param args
- * the arguments
- * @throws JSONException
- * JSON error
- * @throws IOException
- * io error
- */
- public static void main(String[] args) throws JSONException, IOException {
- new PerfResultsToJSon().parseResults();
- }
-
- /**
- * Create a series of data points for a given scenario through variations
- *
- * @param scenario
- * the scenario. For example,
- * "CTF Read & Seek Benchmark (500 seeks)".
- * @param variations
- * all variations to consider to create the series. For example
- * build=%;jvm=1.7;config=linux will generate the series for all
- * builds on Linux / JVM 1.7
- * @param shortName
- * the short name of the scenario
- * @param dimension
- * the dimension of interest (CPU time, used java heap, etc).
- * @return the generated JSON object representing a series of data points
- * for this scenario
- * @throws JSONException
- */
- private static JSONObject createSerie(Scenario scenario, Variations variations, String shortName, Dim dimension) throws JSONException {
- JSONObject o = new JSONObject();
- o.putOpt(KEY_LABEL, shortName);
- o.putOpt(VALUES_LABEL, createDataPoints(scenario, variations, dimension));
- return o;
- }
-
- /**
- * Create data points for a given scenario and variations.
- *
- * @param s
- * the scenario. For example,
- * "CTF Read & Seek Benchmark (500 seeks)".
- * @param variations
- * all variations to consider to create the data points. For
- * example build=%;jvm=1.7;config=linux will generate the data
- * points for all builds on Linux / JVM 1.7
- * @param dimension
- * the dimension of interest (CPU time, used java heap, etc).
- *
- * @return the generated JSON array of points
- * @throws JSONException
- * JSON error
- */
- private static JSONArray createDataPoints(Scenario s, Variations variations, Dim dimension) throws JSONException {
- // Can be uncommented to see raw dump
- //s.dump(System.out, PerformanceTestPlugin.BUILD);
-
- String[] builds = DB.querySeriesValues(s.getScenarioName(), variations, PerformanceTestPlugin.BUILD);
- Date[] dates = new Date[builds.length];
- String[] commits = new String[builds.length];
- for (int i = 0; i < builds.length; i++) {
- dates[i] = parseBuildDate(builds[i]);
- commits[i] = parseCommit(builds[i]);
- }
-
- TimeSeries timeSeries = s.getTimeSeries(dimension);
- JSONArray dataPoints = new JSONArray();
- int length = timeSeries.getLength();
- for (int i = 0; i < length; i++) {
- JSONObject point = new JSONObject();
- if (dates[i] == null) {
- continue;
- }
- point.put(X_LABEL, dates[i].getTime());
- double value = 0;
- if (timeSeries.getCount(i) > 0) {
- value = timeSeries.getValue(i);
- if (Double.isNaN(value)) {
- value = 0;
- }
- }
- point.put(Y_LABEL, value);
- dataPoints.put(point);
- point.put(LABEL_LABEL, createLabel(commits[i]));
- }
- return dataPoints;
- }
-
- /**
- * Create a label JSONObject which is used to attach more information to a
- * data point.
- *
- * @param commit
- * the commit id for this data point
- * @return the resulting JSON object
- * @throws JSONException
- * JSON error
- */
- private static JSONObject createLabel(String commit) throws JSONException {
- /*
- * Here we could add more information about this specific data point
- * like the commit author, the commit message, etc.
- */
- JSONObject label = new JSONObject();
- if (commit != null && !commit.isEmpty()) {
- label.put(COMMIT_LABEL, commit);
- }
- return label;
- }
-
- /**
- * Get the commit id out of the build= string
- *
- * @param build
- * the build string
- * @return the parsed commit id
- */
- private static String parseCommit(String build) {
- Matcher matcher = COMMIT_PATTERN.matcher(build);
- if (matcher.matches()) {
- return matcher.group(1);
- }
- return null;
- }
-
- /**
- * Get the Date out of the build= string
- *
- * @param build
- * the build string
- * @return the parsed Date
- */
- private static Date parseBuildDate(String build) {
- Matcher matcher = BUILD_DATE_PATTERN.matcher(build);
- Date date = null;
- if (matcher.matches()) {
- String dateStr = matcher.group(1);
- SimpleDateFormat f = new SimpleDateFormat(BUILD_DATE_FORMAT);
- try {
- date = dateStr.length() > BUILD_DATE_FORMAT.length() ?
- f.parse(dateStr.substring(dateStr.length() - BUILD_DATE_FORMAT.length())) :
- f.parse(dateStr);
- } catch (ParseException e) {
- return null;
- }
- }
- return date;
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 É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 v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Geneviève Bastien - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.alltests.perf;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * Master test suite for all Linux Tools LTTng performance tests.
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- org.eclipse.tracecompass.ctf.core.tests.perf.AllPerfTests.class,
- org.eclipse.tracecompass.lttng2.kernel.core.tests.perf.AllPerfTests.class,
- org.eclipse.tracecompass.pcap.core.tests.perf.AllPerfTests.class,
- org.eclipse.tracecompass.tmf.core.tests.perf.AllPerfTests.class,
- org.eclipse.tracecompass.tmf.ctf.core.tests.perf.AllPerfTests.class
-})
-public class RunAllPerfTests {
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 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
- *
- * Contributors:
- * Marc-Andre Laperle - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.alltests.swtbot;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * Master test suite for all SWTBot Linux Tools LTTng unit tests.
- *
- * Note that the SWTBot tests need to be executed in a non-UI thread
- * which is why they are separated in a different test suite.
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- org.eclipse.tracecompass.tmf.ui.swtbot.tests.AllTmfUISWTBotTests.class,
- org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests.AllTests.class,
- org.eclipse.tracecompass.tmf.pcap.ui.swtbot.tests.AllTests.class,
- org.eclipse.tracecompass.lttng2.kernel.ui.swtbot.tests.AllTests.class
-})
-public class RunAllSWTBotTests {
-
-}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Marc-Andre Laperle - Initial implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.alltests;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle. No more than one such
+ * plug-in can exist at any time.
+ * <p>
+ * It also provides the plug-in's general logging facility and manages the
+ * internal tracer.
+ */
+public class Activator extends Plugin {
+
+ /**
+ * The plug-in ID
+ */
+ public static final String PLUGIN_ID = "org.eclipse.linuxtools.lttng.alltests"; //$NON-NLS-1$
+
+ /**
+ * The shared instance
+ */
+ private static Activator fPlugin;
+
+ /**
+ * Constructor
+ */
+ public Activator() {
+ setDefault(this);
+ }
+
+ // ------------------------------------------------------------------------
+ // Accessors
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns the AllTests plug-in instance.
+ *
+ * @return the AllTests plug-in instance.
+ */
+ public static Activator getDefault() {
+ return fPlugin;
+ }
+
+ // Sets plug-in instance
+ private static void setDefault(Activator plugin) {
+ fPlugin = plugin;
+ }
+
+ // ------------------------------------------------------------------------
+ // Plugin
+ // ------------------------------------------------------------------------
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ setDefault(this);
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ setDefault(null);
+ super.stop(context);
+ }
+
+
+ /**
+ * Log an IStatus object directly
+ *
+ * @param status
+ * The status to log
+ */
+ public static void log(IStatus status) {
+ fPlugin.getLog().log(status);
+ }
+
+ // ------------------------------------------------------------------------
+ // Log INFO
+ // ------------------------------------------------------------------------
+
+ /**
+ * Logs a message with severity INFO in the runtime log of the plug-in.
+ *
+ * @param message
+ * A message to log
+ */
+ public static void logInfo(String message) {
+ fPlugin.getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
+ }
+
+ /**
+ * Logs a message and exception with severity INFO in the runtime log of the
+ * plug-in.
+ *
+ * @param message
+ * A message to log
+ * @param exception
+ * The corresponding exception
+ */
+ public static void logInfo(String message, Throwable exception) {
+ fPlugin.getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message, exception));
+ }
+
+ // ------------------------------------------------------------------------
+ // Log WARNING
+ // ------------------------------------------------------------------------
+
+ /**
+ * Logs a message and exception with severity WARNING in the runtime log of
+ * the plug-in.
+ *
+ * @param message
+ * A message to log
+ */
+ public static void logWarning(String message) {
+ fPlugin.getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message));
+ }
+
+ /**
+ * Logs a message and exception with severity WARNING in the runtime log of
+ * the plug-in.
+ *
+ * @param message
+ * A message to log
+ * @param exception
+ * The corresponding exception
+ */
+ public static void logWarning(String message, Throwable exception) {
+ fPlugin.getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message, exception));
+ }
+
+ // ------------------------------------------------------------------------
+ // Log ERROR
+ // ------------------------------------------------------------------------
+
+ /**
+ * Logs a message and exception with severity ERROR in the runtime log of
+ * the plug-in.
+ *
+ * @param message
+ * A message to log
+ */
+ public static void logError(String message) {
+ fPlugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
+ }
+
+ /**
+ * Logs a message and exception with severity ERROR in the runtime log of
+ * the plug-in.
+ *
+ * @param message
+ * A message to log
+ * @param exception
+ * The corresponding exception
+ */
+ public static void logError(String message, Throwable exception) {
+ fPlugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 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
+ *
+ * Contributors:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.alltests;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Master test suite for all Linux Tools LTTng unit tests.
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ org.eclipse.tracecompass.btf.core.tests.AllTests.class,
+ org.eclipse.tracecompass.ctf.core.tests.AllCtfCoreTests.class,
+ org.eclipse.tracecompass.ctf.parser.tests.AllCtfParserTests.class,
+ org.eclipse.tracecompass.gdbtrace.core.tests.AllGdbTraceCoreTests.class,
+ org.eclipse.tracecompass.lttng2.control.core.tests.AllTests.class,
+ org.eclipse.tracecompass.lttng2.kernel.core.tests.AllTests.class,
+ org.eclipse.tracecompass.lttng2.ust.core.tests.AllTests.class,
+ org.eclipse.tracecompass.pcap.core.tests.AllPcapCoreTests.class,
+ org.eclipse.tracecompass.statesystem.core.tests.AllTests.class,
+ org.eclipse.tracecompass.tmf.analysis.xml.core.tests.AllAnalysisXmlCoreTests.class,
+ org.eclipse.tracecompass.tmf.core.tests.AllTmfCoreTests.class,
+ org.eclipse.tracecompass.tmf.ctf.core.tests.AllTests.class,
+ org.eclipse.tracecompass.tmf.pcap.core.tests.AllTmfPcapCoreTests.class,
+ org.eclipse.tracecompass.tmf.analysis.xml.core.tests.AllAnalysisXmlCoreTests.class,
+ org.eclipse.tracecompass.tmf.ctf.core.tests.AllTests.class,
+ org.eclipse.tracecompass.tmf.pcap.core.tests.AllTmfPcapCoreTests.class
+})
+public class RunAllCoreTests {
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 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
+ *
+ * Contributors:
+ * Alexandre Montplaisir - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.alltests;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Master test suite for all Linux Tools LTTng unit tests.
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ org.eclipse.tracecompass.gdbtrace.ui.tests.AllGdbTraceUITests.class,
+ org.eclipse.tracecompass.lttng2.control.ui.tests.AllTests.class,
+ org.eclipse.tracecompass.lttng2.kernel.ui.tests.AllTests.class,
+ org.eclipse.tracecompass.lttng2.ust.ui.tests.AllTests.class,
+ org.eclipse.tracecompass.tmf.analysis.xml.ui.tests.AllAnalysisXmlUiTests.class,
+ org.eclipse.tracecompass.tmf.ui.tests.AllTmfUITests.class,
+})
+public class RunAllUITests {
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Marc-Andre Laperle - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.alltests.perf;
+
+import java.io.FileWriter;
+import java.io.IOException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.test.internal.performance.PerformanceTestPlugin;
+import org.eclipse.test.internal.performance.data.Dim;
+import org.eclipse.test.internal.performance.db.DB;
+import org.eclipse.test.internal.performance.db.Scenario;
+import org.eclipse.test.internal.performance.db.SummaryEntry;
+import org.eclipse.test.internal.performance.db.TimeSeries;
+import org.eclipse.test.internal.performance.db.Variations;
+import org.eclipse.tracecompass.alltests.Activator;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.junit.Test;
+
+/**
+ * Convert results from the database to JSON suitable for display.
+ *
+ * Normal charts:
+ *
+ * Individual charts are generated into JSON files in the form chart#.json where
+ * # is incremented for each new chart. A chart contains data points consisting
+ * of X and Y values suitable for a line chart. Each point can also have
+ * additional data, for example the commit id. This format is compatible with
+ * nvd3. For example:
+ *
+ * <pre>
+ * <code>
+ * [{
+ * "key": "Experiment Benchmark:84 traces",
+ * "values": [{
+ * "label": {"commit": "fe3c142"},
+ * "x": 1405024320000,
+ * "y": 17592
+ * }]
+ * }]
+ * </code>
+ * </pre>
+ *
+ * Normal charts metadata:
+ *
+ * Each chart has an entry in the metada.js file which organizes the charts per
+ * component and contains additional information to augment the format expected
+ * by nvd3. Each entry contains the combination of OS and JVM, the filename (in
+ * JSON format), the title of the chart, the unit (seconds, etc) and the
+ * dimension (CPU time, used heap, etc).
+ *
+ * <pre>
+ * <code>
+ * var MetaData = {
+ * "applicationComponents": {
+ * "Experiment benchmark": {
+ * "name": "Experiment benchmark",
+ * "tests": [
+ * {
+ * "dimension": "CPU Time",
+ * "file": "chart12",
+ * "jvm": "1.7",
+ * "os": "linux",
+ * "title": "Experiment Benchmark:84 traces",
+ * "unit": "s"
+ * },
+ * {
+ * "dimension": "CPU Time",
+ * "file": "chart11",
+ * "jvm": "1.7",
+ * "os": "linux",
+ * "title": "Experiment Benchmark:6 traces",
+ * "unit": "s"
+ * },
+ * ...
+ * </code>
+ * </pre>
+ *
+ * Overview charts:
+ *
+ * In addition to the normal charts, overview charts are generated. An overview
+ * chart presents a summary of the scenarios ran for a given OS and JVM
+ * combination. Only scenarios marked as "global" are added to the overview
+ * because of space concerns. Overview charts are generated under the
+ * chart_overview#.json name and look similar in structure to the normal charts
+ * except that they contain more than one series.
+ *
+ * <pre>
+ * <code>
+ * [
+ * {
+ * "key": "CTF Read & Seek Benchmark (500 seeks):tr",
+ * "values": [
+ * {
+ * "label": {"commit": "4d34345"},
+ * "x": 1405436820000,
+ * "y": 5382.5
+ * },
+ * ...
+ * ]
+ * },
+ * {
+ * "key": "CTF Read Benchmark:trace-kernel",
+ * "values": [
+ * {
+ * "label": {"commit": "4d34345"},
+ * "x": 1405436820000,
+ * "y": 1311.5
+ * },
+ * ...
+ * ]
+ * },
+ * ...
+ * </code>
+ * </pre>
+ *
+ * Overview charts metadata:
+ *
+ * Overview charts also have similar metadata entries to normal charts except
+ * they are not organized by component.
+ *
+ * <pre>
+ * <code>
+ * var MetaData = {
+ * ...
+ * "overviews": {
+ * "1": {
+ * "dimension": "",
+ * "file": "chart_overview0",
+ * "jvm": "1.7",
+ * "os": "linux",
+ * "title": "linux / 1.7",
+ * "unit": ""
+ * },
+ * "2": {
+ * "dimension": "",
+ * "file": "chart_overview1",
+ * "jvm": "1.7",
+ * "os": "windows",
+ * "title": "windows / 1.7",
+ * "unit": ""
+ * },
+ * ...
+ * </code>
+ * </pre>
+ *
+ * Finally, since we want to be able to filter all the charts by OS/JVM
+ * combination, there is a section in the metadata that lists all the
+ * combinations:
+ *
+ * <pre>
+ * <code>
+ * "osjvm": {
+ * "1": {
+ * "description": "linux / 1.7",
+ * "jvm": "1.7",
+ * "os": "linux"
+ * },
+ * "2": {
+ * "description": "windows / 1.7",
+ * "jvm": "1.7",
+ * "os": "windows"
+ * },
+ * "3": {
+ * "description": "mac / 1.7",
+ * "jvm": "1.7",
+ * "os": "mac"
+ * }
+ * },
+ * </code>
+ * </pre>
+ *
+ * All of this data is meant to be view on a website. Specifically, the source
+ * code for our implementation is available on GitHub at
+ * https://github.com/PSRCode/ITCFYWebsite
+ *
+ * It makes use of the NVD3 project to display the charts based on the data
+ * generated by this class.
+ */
+public class PerfResultsToJSon {
+
+ /*
+ * Labels
+ */
+ private static final String APPLICATION_COMPONENTS_LABEL = "applicationComponents";
+ private static final String BUILD_LABEL = "build";
+ private static final String COMMIT_LABEL = "commit";
+ private static final String CONFIG_LABEL = "config";
+ private static final String DESCRIPTION_LABEL = "description";
+ private static final String DIMENSION_LABEL = "dimension";
+ private static final String FILE_LABEL = "file";
+ private static final String HOST_LABEL = "host";
+ private static final String JVM_LABEL = "jvm";
+ private static final String KEY_LABEL = "key";
+ private static final String LABEL_LABEL = "label";
+ private static final String NAME_LABEL = "name";
+ private static final String OS_LABEL = "os";
+ private static final String OSJVM_LABEL = "osjvm";
+ private static final String OVERVIEWS_LABEL = "overviews";
+ private static final String TESTS_LABEL = "tests";
+ private static final String TITLE_LABEL = "title";
+ private static final String UNIT_LABEL = "unit";
+ private static final String VALUES_LABEL = "values";
+ private static final String X_LABEL = "x";
+ private static final String Y_LABEL = "y";
+
+ private static final String BUILD_DATE_FORMAT = "yyyyMMdd-HHmm";
+ private static final String OVERVIEW_CHART_FILE_NAME = "chart_overview";
+ private static final String METADATA_FILE_NAME = "meta";
+ private static final String METADATA_FILE_NAME_EXTENSION = ".js";
+ private static final String CHART_FILE_NAME = "chart";
+ private static final String CHART_FILE_NAME_EXTENSION = ".json";
+ private static final String WILDCARD_PATTERN = "%";
+ private static final String COMPONENT_SEPARATOR = "#";
+ private static final String META_DATA_JAVASCRIPT_START = "var MetaData = ";
+
+ private static Pattern BUILD_DATE_PATTERN = Pattern.compile("(\\w+-\\w+)(-\\w+)?");
+ private static Pattern COMMIT_PATTERN = Pattern.compile(".*-.*-(.*)");
+
+ private JSONObject fApplicationComponents = new JSONObject();
+ private JSONObject fOverviews = new JSONObject();
+
+ private int fNumChart = 0;
+ private int fNumOverviewChart = 0;
+
+ /**
+ * Convert results from the database to JSON suitable for display
+ *
+ * <pre>
+ * For each variant (os/jvm combination)
+ * - For each summary entry (scenario)
+ * - Generate a chart
+ * - Add it to global summary (if needed)
+ * - Create the metadata for this test
+ * - Create an overview chart for this os/jvm
+ * </pre>
+ *
+ * @throws JSONException
+ * JSON error
+ * @throws IOException
+ * IO error
+ */
+ @Test
+ public void parseResults() throws JSONException, IOException {
+ Variations configVariations = PerformanceTestPlugin.getVariations();
+ JSONObject osJvmVariants = createOsJvm();
+
+ Iterator<?> keysIt = osJvmVariants.keys();
+ while (keysIt.hasNext()) {
+ JSONArray overviewSummarySeries = new JSONArray();
+
+ JSONObject variant = osJvmVariants.getJSONObject((String) keysIt.next());
+ String seriesKey = PerformanceTestPlugin.BUILD;
+
+ // Clone the variations from the environment because it might have
+ // extra parameters like host=, etc.
+ Variations buildVariations = (Variations) configVariations.clone();
+ buildVariations.setProperty(JVM_LABEL, variant.getString(JVM_LABEL));
+ buildVariations.setProperty(CONFIG_LABEL, variant.getString(OS_LABEL));
+ buildVariations.setProperty(BUILD_LABEL, WILDCARD_PATTERN);
+
+ Scenario[] scenarios = DB.queryScenarios(buildVariations, WILDCARD_PATTERN, seriesKey, null);
+ SummaryEntry[] summaryEntries = DB.querySummaries(buildVariations, WILDCARD_PATTERN);
+ for (SummaryEntry entry : summaryEntries) {
+ Scenario scenario = getScenario(entry.scenarioName, scenarios);
+ JSONObject scenarioSeries = createScenarioChart(scenario, entry, buildVariations);
+ // Add to global summary
+ if (scenarioSeries != null && entry.isGlobal) {
+ overviewSummarySeries.put(scenarioSeries);
+ }
+ }
+
+ JSONObject overviewMetadata = createOverviewChart(overviewSummarySeries, buildVariations);
+ fOverviews.put(Integer.toString(fNumOverviewChart), overviewMetadata);
+ }
+
+ // Create the matadata javascript file that includes OS/JVM combinations
+ // (for filtering), application components and overviews (one of OS/JVM
+ // combination)
+ JSONObject rootMetadata = new JSONObject();
+ rootMetadata.put(OSJVM_LABEL, osJvmVariants);
+ rootMetadata.put(APPLICATION_COMPONENTS_LABEL, fApplicationComponents);
+ rootMetadata.put(OVERVIEWS_LABEL, fOverviews);
+ try (FileWriter fw1 = new FileWriter(METADATA_FILE_NAME + METADATA_FILE_NAME_EXTENSION)) {
+ fw1.write(META_DATA_JAVASCRIPT_START + rootMetadata.toString(4));
+ }
+ }
+
+ /**
+ * Create chart for a scenario instance and add it to the relevant metadatas
+ *
+ * @param scenario
+ * the scenario. For example,
+ * "CTF Read & Seek Benchmark (500 seeks)".
+ * @param entry
+ * an entry from the summary. Only scenarios that are part of the
+ * summary are processed.
+ * @param variations
+ * all variations to consider to create the scenario chart. For
+ * example build=%;jvm=1.7;config=linux will generate a chart for
+ * all builds on Linux / JVM 1.7
+ *
+ * @return
+ * @throws JSONException
+ * JSON error
+ * @throws IOException
+ * IO error
+ */
+ private JSONObject createScenarioChart(Scenario scenario, SummaryEntry entry, Variations variations) throws JSONException, IOException {
+ if (scenario == null) {
+ return null;
+ }
+ String[] split = entry.scenarioName.split(COMPONENT_SEPARATOR);
+ if (split.length < 3) {
+ Activator.logError("Invalid scenario name \"" + entry.scenarioName + "\", it must be in format: org.package.foo#component#test");
+ return null;
+ }
+
+ // Generate individual chart
+ JSONArray rootScenario = new JSONArray();
+ JSONObject series = createSerie(scenario, variations, entry.shortName, entry.dimension);
+ rootScenario.put(series);
+ int numChart = fNumChart++;
+ try (FileWriter fw = new FileWriter(CHART_FILE_NAME + numChart + CHART_FILE_NAME_EXTENSION)) {
+ fw.write(rootScenario.toString(4));
+ }
+
+ // Create the metadata
+ JSONObject testMetadata = new JSONObject();
+ testMetadata.put(TITLE_LABEL, entry.shortName);
+ testMetadata.put(FILE_LABEL, CHART_FILE_NAME + numChart);
+ testMetadata.put(OS_LABEL, variations.getProperty(CONFIG_LABEL));
+ testMetadata.put(JVM_LABEL, variations.getProperty(JVM_LABEL));
+ testMetadata.put(DIMENSION_LABEL, entry.dimension.getName());
+ testMetadata.put(UNIT_LABEL, entry.dimension.getUnit().getShortName());
+
+ // Add the scenario to the metadata, under the correct component
+ String componentName = split[1];
+ JSONObject componentObject = null;
+ if (fApplicationComponents.has(componentName)) {
+ componentObject = fApplicationComponents.getJSONObject(componentName);
+ } else {
+ componentObject = new JSONObject();
+ componentObject.put(NAME_LABEL, componentName);
+ componentObject.put(TESTS_LABEL, new JSONArray());
+ fApplicationComponents.put(componentName, componentObject);
+ }
+ JSONArray tests = componentObject.getJSONArray(TESTS_LABEL);
+ tests.put(testMetadata);
+
+ return series;
+ }
+
+ /**
+ * Create an overview chart for this OS / JVM combination. The chart is made
+ * of multiple series (scenarios) that were marked as global.
+ *
+ * @param overviewSummarySeries
+ * an array of series to include in the chart (multiple
+ * scenarios)
+ * @param variations
+ * the variations used to generate the series to be included in
+ * this overview chart. For example build=%;jvm=1.7;config=linux
+ * will generate an overview chart for Linux / JVM 1.7
+ * @return the overview metadata JSON object
+ * @throws JSONException
+ * JSON error
+ * @throws IOException
+ * io error
+ */
+ private JSONObject createOverviewChart(JSONArray overviewSummarySeries, Variations variations) throws IOException, JSONException {
+ int numOverviewChart = fNumOverviewChart++;
+ try (FileWriter fw = new FileWriter(OVERVIEW_CHART_FILE_NAME + numOverviewChart + CHART_FILE_NAME_EXTENSION)) {
+ fw.write(overviewSummarySeries.toString(4));
+ }
+
+ String os = variations.getProperty(CONFIG_LABEL);
+ String jvm = variations.getProperty(JVM_LABEL);
+
+ // Create the overview metadata
+ JSONObject overviewMetadata = new JSONObject();
+ overviewMetadata.put(TITLE_LABEL, os + " / " + jvm);
+ overviewMetadata.put(FILE_LABEL, OVERVIEW_CHART_FILE_NAME + numOverviewChart);
+ overviewMetadata.put(OS_LABEL, os);
+ overviewMetadata.put(JVM_LABEL, jvm);
+ overviewMetadata.put(DIMENSION_LABEL, "");
+ overviewMetadata.put(UNIT_LABEL, "");
+
+ return overviewMetadata;
+ }
+
+ private static Scenario getScenario(String scenarioName, Scenario[] scenarios) {
+ for (int i = 0; i < scenarios.length; i++) {
+ Scenario s = scenarios[i];
+ if (s.getScenarioName().equals(scenarioName)) {
+ return s;
+ }
+
+ }
+ return null;
+ }
+
+ /**
+ * Get all combinations of OS / JVM. This will be used for filtering.
+ *
+ * @return the JSON object containing all the combinations
+ * @throws JSONException
+ * JSON error
+ */
+ private static JSONObject createOsJvm() throws JSONException {
+ JSONObject osjvm = new JSONObject();
+ List<String> oses = getDistinctOses();
+
+ int osJvmIndex = 1;
+ for (String os : oses) {
+ String key = JVM_LABEL;
+ Variations v = new Variations();
+
+ v.setProperty(BUILD_LABEL, WILDCARD_PATTERN);
+ v.setProperty(HOST_LABEL, WILDCARD_PATTERN);
+ v.setProperty(CONFIG_LABEL, os);
+ v.setProperty(JVM_LABEL, WILDCARD_PATTERN);
+
+ List<String> jvms = new ArrayList<>();
+ DB.queryDistinctValues(jvms, key, v, WILDCARD_PATTERN);
+ for (String jvm : jvms) {
+ JSONObject osjvmItem = new JSONObject();
+ osjvmItem.put(OS_LABEL, os);
+ osjvmItem.put(JVM_LABEL, jvm);
+ osjvmItem.put(DESCRIPTION_LABEL, os + " / " + jvm);
+ osjvm.put(Integer.toString(osJvmIndex), osjvmItem);
+ osJvmIndex++;
+ }
+ }
+
+ return osjvm;
+ }
+
+ /**
+ * Get all the distinct OS values
+ *
+ * @return the distinct OS values
+ */
+ private static List<String> getDistinctOses() {
+ List<String> configs = new ArrayList<>();
+ String key = PerformanceTestPlugin.CONFIG;
+ Variations v = new Variations();
+ v.setProperty(WILDCARD_PATTERN, WILDCARD_PATTERN);
+ DB.queryDistinctValues(configs, key, v, WILDCARD_PATTERN);
+ return configs;
+ }
+
+ /**
+ * This main can be run from within Eclipse provided everything is on the
+ * class path.
+ *
+ * @param args
+ * the arguments
+ * @throws JSONException
+ * JSON error
+ * @throws IOException
+ * io error
+ */
+ public static void main(String[] args) throws JSONException, IOException {
+ new PerfResultsToJSon().parseResults();
+ }
+
+ /**
+ * Create a series of data points for a given scenario through variations
+ *
+ * @param scenario
+ * the scenario. For example,
+ * "CTF Read & Seek Benchmark (500 seeks)".
+ * @param variations
+ * all variations to consider to create the series. For example
+ * build=%;jvm=1.7;config=linux will generate the series for all
+ * builds on Linux / JVM 1.7
+ * @param shortName
+ * the short name of the scenario
+ * @param dimension
+ * the dimension of interest (CPU time, used java heap, etc).
+ * @return the generated JSON object representing a series of data points
+ * for this scenario
+ * @throws JSONException
+ */
+ private static JSONObject createSerie(Scenario scenario, Variations variations, String shortName, Dim dimension) throws JSONException {
+ JSONObject o = new JSONObject();
+ o.putOpt(KEY_LABEL, shortName);
+ o.putOpt(VALUES_LABEL, createDataPoints(scenario, variations, dimension));
+ return o;
+ }
+
+ /**
+ * Create data points for a given scenario and variations.
+ *
+ * @param s
+ * the scenario. For example,
+ * "CTF Read & Seek Benchmark (500 seeks)".
+ * @param variations
+ * all variations to consider to create the data points. For
+ * example build=%;jvm=1.7;config=linux will generate the data
+ * points for all builds on Linux / JVM 1.7
+ * @param dimension
+ * the dimension of interest (CPU time, used java heap, etc).
+ *
+ * @return the generated JSON array of points
+ * @throws JSONException
+ * JSON error
+ */
+ private static JSONArray createDataPoints(Scenario s, Variations variations, Dim dimension) throws JSONException {
+ // Can be uncommented to see raw dump
+ //s.dump(System.out, PerformanceTestPlugin.BUILD);
+
+ String[] builds = DB.querySeriesValues(s.getScenarioName(), variations, PerformanceTestPlugin.BUILD);
+ Date[] dates = new Date[builds.length];
+ String[] commits = new String[builds.length];
+ for (int i = 0; i < builds.length; i++) {
+ dates[i] = parseBuildDate(builds[i]);
+ commits[i] = parseCommit(builds[i]);
+ }
+
+ TimeSeries timeSeries = s.getTimeSeries(dimension);
+ JSONArray dataPoints = new JSONArray();
+ int length = timeSeries.getLength();
+ for (int i = 0; i < length; i++) {
+ JSONObject point = new JSONObject();
+ if (dates[i] == null) {
+ continue;
+ }
+ point.put(X_LABEL, dates[i].getTime());
+ double value = 0;
+ if (timeSeries.getCount(i) > 0) {
+ value = timeSeries.getValue(i);
+ if (Double.isNaN(value)) {
+ value = 0;
+ }
+ }
+ point.put(Y_LABEL, value);
+ dataPoints.put(point);
+ point.put(LABEL_LABEL, createLabel(commits[i]));
+ }
+ return dataPoints;
+ }
+
+ /**
+ * Create a label JSONObject which is used to attach more information to a
+ * data point.
+ *
+ * @param commit
+ * the commit id for this data point
+ * @return the resulting JSON object
+ * @throws JSONException
+ * JSON error
+ */
+ private static JSONObject createLabel(String commit) throws JSONException {
+ /*
+ * Here we could add more information about this specific data point
+ * like the commit author, the commit message, etc.
+ */
+ JSONObject label = new JSONObject();
+ if (commit != null && !commit.isEmpty()) {
+ label.put(COMMIT_LABEL, commit);
+ }
+ return label;
+ }
+
+ /**
+ * Get the commit id out of the build= string
+ *
+ * @param build
+ * the build string
+ * @return the parsed commit id
+ */
+ private static String parseCommit(String build) {
+ Matcher matcher = COMMIT_PATTERN.matcher(build);
+ if (matcher.matches()) {
+ return matcher.group(1);
+ }
+ return null;
+ }
+
+ /**
+ * Get the Date out of the build= string
+ *
+ * @param build
+ * the build string
+ * @return the parsed Date
+ */
+ private static Date parseBuildDate(String build) {
+ Matcher matcher = BUILD_DATE_PATTERN.matcher(build);
+ Date date = null;
+ if (matcher.matches()) {
+ String dateStr = matcher.group(1);
+ SimpleDateFormat f = new SimpleDateFormat(BUILD_DATE_FORMAT);
+ try {
+ date = dateStr.length() > BUILD_DATE_FORMAT.length() ?
+ f.parse(dateStr.substring(dateStr.length() - BUILD_DATE_FORMAT.length())) :
+ f.parse(dateStr);
+ } catch (ParseException e) {
+ return null;
+ }
+ }
+ return date;
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 É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 v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Geneviève Bastien - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.alltests.perf;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Master test suite for all Linux Tools LTTng performance tests.
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ org.eclipse.tracecompass.ctf.core.tests.perf.AllPerfTests.class,
+ org.eclipse.tracecompass.lttng2.kernel.core.tests.perf.AllPerfTests.class,
+ org.eclipse.tracecompass.pcap.core.tests.perf.AllPerfTests.class,
+ org.eclipse.tracecompass.tmf.core.tests.perf.AllPerfTests.class,
+ org.eclipse.tracecompass.tmf.ctf.core.tests.perf.AllPerfTests.class
+})
+public class RunAllPerfTests {
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2014 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
+ *
+ * Contributors:
+ * Marc-Andre Laperle - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.alltests.swtbot;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * Master test suite for all SWTBot Linux Tools LTTng unit tests.
+ *
+ * Note that the SWTBot tests need to be executed in a non-UI thread
+ * which is why they are separated in a different test suite.
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ org.eclipse.tracecompass.tmf.ui.swtbot.tests.AllTmfUISWTBotTests.class,
+ org.eclipse.tracecompass.tmf.ctf.ui.swtbot.tests.AllTests.class,
+ org.eclipse.tracecompass.tmf.pcap.ui.swtbot.tests.AllTests.class,
+ org.eclipse.tracecompass.lttng2.kernel.ui.swtbot.tests.AllTests.class
+})
+public class RunAllSWTBotTests {
+
+}
Bundle-SymbolicName: org.eclipse.tracecompass.examples;singleton:=true
Bundle-Version: 1.1.0.qualifier
Bundle-Localization: plugin
-Bundle-Activator: org.eclipse.linuxtools.tracing.examples.ui.Activator
+Bundle-Activator: org.eclipse.tracecompass.examples.ui.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.tracecompass.tmf.core;bundle-version="3.1.0",
org.eclipse.tracecompass.tmf.ui;bundle-version="3.1.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Export-Package: org.eclipse.linuxtools.tracing.examples.ui;x-internal:=true,
- org.eclipse.linuxtools.tracing.examples.ui.viewers.histogram;x-internal:=true,
- org.eclipse.linuxtools.tracing.examples.ui.views.histogram;x-internal:=true
+Export-Package: org.eclipse.tracecompass.examples.ui;x-internal:=true,
+ org.eclipse.tracecompass.examples.ui.viewers.histogram;x-internal:=true,
+ org.eclipse.tracecompass.examples.ui.views.histogram;x-internal:=true
Bundle-Vendor: %Bundle-Vendor
Import-Package: org.swtchart
point="org.eclipse.ui.views">
<view
category="org.eclipse.linuxtools.tmf.ui.views.category"
- class="org.eclipse.linuxtools.tracing.examples.ui.views.histogram.NewHistogramView"
+ class="org.eclipse.tracecompass.examples.ui.views.histogram.NewHistogramView"
id="org.eclipse.linuxtools.tracing.examples.ui.views.HistogramView"
name="%tracing.examples.histogram.view.name"
restorable="true">
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013 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
- *
- * Contributors:
- * Bernd Hufmann - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.tracing.examples.ui;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle.
- *
- * @author Bernd Hufmann
- */
-public class Activator extends AbstractUIPlugin {
-
- /** The plug-in ID */
- public static final String PLUGIN_ID = "org.eclipse.linuxtools.tracing.examples"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator fPlugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- fPlugin = this;
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- fPlugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return fPlugin;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 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
- *
- * Contributors:
- * Alexandre Montplaisir - Initial API and implementation
- * Bernd Hufmann - Updated to new TMF chart framework
- *******************************************************************************/
-package org.eclipse.linuxtools.tracing.examples.ui.viewers.histogram;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.tracecompass.tmf.core.statistics.ITmfStatistics;
-import org.eclipse.tracecompass.tmf.core.statistics.TmfStatisticsModule;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
-import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.barcharts.TmfBarChartViewer;
-import org.swtchart.Chart;
-import org.swtchart.IAxis;
-import org.swtchart.ISeries;
-import org.swtchart.LineStyle;
-
-/**
- * Histogram Viewer implementation based on TmfBarChartViewer.
- *
- * @author Alexandre Montplaisir
- * @author Bernd Hufmann
- */
-public class NewHistogramViewer extends TmfBarChartViewer {
-
- /**
- * Creates a Histogram Viewer instance.
- * @param parent
- * The parent composite to draw in.
- */
- public NewHistogramViewer(Composite parent) {
- super(parent, null, null, null, TmfBarChartViewer.MINIMUM_BAR_WIDTH);
-
- Chart swtChart = getSwtChart();
-
- IAxis xAxis = swtChart.getAxisSet().getXAxis(0);
- IAxis yAxis = swtChart.getAxisSet().getYAxis(0);
-
- /* Hide the grid */
- xAxis.getGrid().setStyle(LineStyle.NONE);
- yAxis.getGrid().setStyle(LineStyle.NONE);
-
- /* Hide the legend */
- swtChart.getLegend().setVisible(false);
-
- addSeries("Number of events", Display.getDefault().getSystemColor(SWT.COLOR_BLUE).getRGB()); //$NON-NLS-1$
- }
-
- @Override
- protected void readData(final ISeries series, final long start, final long end, final int nb) {
- if (getTrace() != null) {
- final double y[] = new double[nb];
-
- Thread thread = new Thread("Histogram viewer update") { //$NON-NLS-1$
- @Override
- public void run() {
- double x[] = getXAxis(start, end, nb);
- final long yLong[] = new long[nb];
- Arrays.fill(y, 0.0);
-
- /* Add the values for each trace */
- for (ITmfTrace trace : TmfTraceManager.getTraceSet(getTrace())) {
- /* Retrieve the statistics object */
- final TmfStatisticsModule statsMod =
- trace.getAnalysisModuleOfClass(TmfStatisticsModule.class, TmfStatisticsModule.ID);
- if (statsMod == null) {
- /* No statistics module available for this trace */
- continue;
- }
- statsMod.waitForInitialization();
- final ITmfStatistics stats = statsMod.getStatistics();
- if (stats == null) {
- /*
- * Should not be null after waitForInitialization()
- * is called.
- */
- throw new IllegalStateException();
- }
- List<Long> values = stats.histogramQuery(start, end, nb);
-
- for (int i = 0; i < nb; i++) {
- yLong[i] += values.get(i);
- }
- }
-
- for (int i = 0; i < nb; i++) {
- y[i] += yLong[i]; /* casting from long to double */
- }
-
- /* Update the viewer */
- drawChart(series, x, y);
- }
- };
- thread.start();
- }
- return;
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 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
- *
- * Contributors:
- * Bernd Hufmann - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.linuxtools.tracing.examples.ui.views.histogram;
-
-import org.eclipse.linuxtools.tracing.examples.ui.viewers.histogram.NewHistogramViewer;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.tracecompass.tmf.ui.views.TmfChartView;
-
-/**
- * Histogram View based on TmfChartView.
- *
- * @author Bernd Hufmann
- */
-public class NewHistogramView extends TmfChartView {
- /** The view ID. */
- public static final String ID = "org.eclipse.linuxtools.tracing.examples.ui.views.NewHistogramView"; //$NON-NLS-1$
-
- /**
- * Default Constructor
- */
- public NewHistogramView() {
- super(ID);
- }
-
- @Override
- public void createPartControl(Composite parent) {
- setChartViewer(new NewHistogramViewer(parent));
- super.createPartControl(parent);
- }
-
- @Override
- public void setFocus() {
- }
-}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013 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
+ *
+ * Contributors:
+ * Bernd Hufmann - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tracecompass.examples.ui;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle.
+ *
+ * @author Bernd Hufmann
+ */
+public class Activator extends AbstractUIPlugin {
+
+ /** The plug-in ID */
+ public static final String PLUGIN_ID = "org.eclipse.linuxtools.tracing.examples"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator fPlugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ fPlugin = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ fPlugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return fPlugin;
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 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
+ *
+ * Contributors:
+ * Alexandre Montplaisir - Initial API and implementation
+ * Bernd Hufmann - Updated to new TMF chart framework
+ *******************************************************************************/
+package org.eclipse.tracecompass.examples.ui.viewers.histogram;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.tracecompass.tmf.core.statistics.ITmfStatistics;
+import org.eclipse.tracecompass.tmf.core.statistics.TmfStatisticsModule;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
+import org.eclipse.tracecompass.tmf.ui.viewers.xycharts.barcharts.TmfBarChartViewer;
+import org.swtchart.Chart;
+import org.swtchart.IAxis;
+import org.swtchart.ISeries;
+import org.swtchart.LineStyle;
+
+/**
+ * Histogram Viewer implementation based on TmfBarChartViewer.
+ *
+ * @author Alexandre Montplaisir
+ * @author Bernd Hufmann
+ */
+public class NewHistogramViewer extends TmfBarChartViewer {
+
+ /**
+ * Creates a Histogram Viewer instance.
+ * @param parent
+ * The parent composite to draw in.
+ */
+ public NewHistogramViewer(Composite parent) {
+ super(parent, null, null, null, TmfBarChartViewer.MINIMUM_BAR_WIDTH);
+
+ Chart swtChart = getSwtChart();
+
+ IAxis xAxis = swtChart.getAxisSet().getXAxis(0);
+ IAxis yAxis = swtChart.getAxisSet().getYAxis(0);
+
+ /* Hide the grid */
+ xAxis.getGrid().setStyle(LineStyle.NONE);
+ yAxis.getGrid().setStyle(LineStyle.NONE);
+
+ /* Hide the legend */
+ swtChart.getLegend().setVisible(false);
+
+ addSeries("Number of events", Display.getDefault().getSystemColor(SWT.COLOR_BLUE).getRGB()); //$NON-NLS-1$
+ }
+
+ @Override
+ protected void readData(final ISeries series, final long start, final long end, final int nb) {
+ if (getTrace() != null) {
+ final double y[] = new double[nb];
+
+ Thread thread = new Thread("Histogram viewer update") { //$NON-NLS-1$
+ @Override
+ public void run() {
+ double x[] = getXAxis(start, end, nb);
+ final long yLong[] = new long[nb];
+ Arrays.fill(y, 0.0);
+
+ /* Add the values for each trace */
+ for (ITmfTrace trace : TmfTraceManager.getTraceSet(getTrace())) {
+ /* Retrieve the statistics object */
+ final TmfStatisticsModule statsMod =
+ trace.getAnalysisModuleOfClass(TmfStatisticsModule.class, TmfStatisticsModule.ID);
+ if (statsMod == null) {
+ /* No statistics module available for this trace */
+ continue;
+ }
+ statsMod.waitForInitialization();
+ final ITmfStatistics stats = statsMod.getStatistics();
+ if (stats == null) {
+ /*
+ * Should not be null after waitForInitialization()
+ * is called.
+ */
+ throw new IllegalStateException();
+ }
+ List<Long> values = stats.histogramQuery(start, end, nb);
+
+ for (int i = 0; i < nb; i++) {
+ yLong[i] += values.get(i);
+ }
+ }
+
+ for (int i = 0; i < nb; i++) {
+ y[i] += yLong[i]; /* casting from long to double */
+ }
+
+ /* Update the viewer */
+ drawChart(series, x, y);
+ }
+ };
+ thread.start();
+ }
+ return;
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2013, 2014 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
+ *
+ * Contributors:
+ * Bernd Hufmann - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tracecompass.examples.ui.views.histogram;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.tracecompass.examples.ui.viewers.histogram.NewHistogramViewer;
+import org.eclipse.tracecompass.tmf.ui.views.TmfChartView;
+
+/**
+ * Histogram View based on TmfChartView.
+ *
+ * @author Bernd Hufmann
+ */
+public class NewHistogramView extends TmfChartView {
+ /** The view ID. */
+ public static final String ID = "org.eclipse.linuxtools.tracing.examples.ui.views.NewHistogramView"; //$NON-NLS-1$
+
+ /**
+ * Default Constructor
+ */
+ public NewHistogramView() {
+ super(ID);
+ }
+
+ @Override
+ public void createPartControl(Composite parent) {
+ setChartViewer(new NewHistogramViewer(parent));
+ super.createPartControl(parent);
+ }
+
+ @Override
+ public void setFocus() {
+ }
+}
<!-- Where to put jacoco coverage report -->
<destFile>${sonar.jacoco.reportPath}</destFile>
<includes>
- <include>org.eclipse.linuxtools.*</include>
+ <include>org.eclipse.tracecompass.*</include>
</includes>
<append>true</append>
</configuration>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<configuration>
- <excludePackageNames>org.eclipse.linuxtools.internal.*:*.test*</excludePackageNames>
+ <excludePackageNames>org.eclipse.tracecompass.internal.*:*.test*</excludePackageNames>
</configuration>
</plugin>
</plugins>