Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Performance Results tables #77

Merged
merged 4 commits into from
Jul 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bundles/org.eclipse.test.performance/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Plugin.name
Bundle-SymbolicName: org.eclipse.test.performance
Bundle-SymbolicName: org.eclipse.test.performance; singleton:=true
Bundle-Version: 3.18.100.qualifier
Bundle-Activator: org.eclipse.test.internal.performance.PerformanceTestPlugin
Bundle-Vendor: %Plugin.providerName
Expand Down
1 change: 1 addition & 0 deletions bundles/org.eclipse.test.performance/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
bin.includes = .,\
plugin.properties,\
about.html,\
plugin.xml,\
META-INF/

source.. = src/
Expand Down
16 changes: 16 additions & 0 deletions bundles/org.eclipse.test.performance/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>

<!-- Applications -->
<extension
id="basicResultsTable"
point="org.eclipse.core.runtime.applications">
<application>
<run
class="org.eclipse.test.performance.BasicResultsTable">
</run>
</application>
</extension>

</plugin>
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
/*******************************************************************************
* Copyright (c) 2022 Samantha Dawley and others.
*
* This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which
* accompanies this distribution, and is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors: Samantha Dawley - initial API and implementation
*******************************************************************************/

package org.eclipse.test.internal.performance.data;

import java.io.EOFException;
//import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.nio.file.Files;
//import java.nio.file.Paths;
import java.nio.file.Path;
import java.util.Set;
import java.util.Map;
import java.util.HashMap;

import org.eclipse.test.internal.performance.data.Sample;
import org.eclipse.test.internal.performance.data.DataPoint;
import org.eclipse.test.internal.performance.data.Scalar;
import org.eclipse.test.internal.performance.data.Dim;
import org.eclipse.test.internal.performance.db.Variations;


public class ResultsData{
//Static because there shouldn't be different groups of results
private static Map<String, Sample> CURRENT_SCENARIO_DATA; //Map of scenarioID to Sample for the current build
private static Map<String, Sample> BASELINE_SCENARIO_DATA; //Map of scenarioID to Sample for the baseline build

private static String CURRENT_BUILD, BASELINE_BUILD = null;

private final static String[] ECLIPSE_COMPONENTS = {
"org.eclipse.ant",
"org.eclipse.compare",
"org.eclipse.core",
//"org.eclipse.help",
"org.eclipse.jdt.core",
"org.eclipse.jdt.debug",
"org.eclipse.jdt.text",
"org.eclipse.jdt.ui",
//"org.eclipse.jface",
//"org.eclipse.osgi",
"org.eclipse.pde.api.tools",
"org.eclipse.pde.ui",
"org.eclipse.swt",
//"org.eclipse.team",
"org.eclipse.ua",
"org.eclipse.ui"
};

public ResultsData(String current, String baseline) {
CURRENT_BUILD = current;
BASELINE_BUILD = baseline;
CURRENT_SCENARIO_DATA = new HashMap<String, Sample>();
BASELINE_SCENARIO_DATA = new HashMap<String, Sample>();
}

public void importData(Path inputFile) {
System.out.println("INFO: Reading data from " + inputFile);
Variations variations = null;
try (InputStream is = Files.newInputStream(inputFile)) {
while (true) { // loop will end on input stream EOF
ObjectInputStream ois = new ObjectInputStream(is);
String scenarioID = null;
Sample sample = null;
while (scenarioID == null || variations == null || sample == null) {
Object o = ois.readObject();
if (String.class.equals(o.getClass())) {
scenarioID = (String) o;
} else if (Variations.class.equals(o.getClass())) {
if (variations == null) { //variations only needs to be captured once
variations = (Variations) o;
}
} else if (Sample.class.equals(o.getClass())) {
sample = (Sample) o;
} else {
System.err.println("WARN: Input contains unexpected object of type " + o.getClass().getCanonicalName());
}
}

//System.out.println("DEBUG: Store data for scenario " + scenarioID);
String build = variations.getProperty("build");
if ((build.equals(CURRENT_BUILD)) && (!CURRENT_SCENARIO_DATA.containsKey(scenarioID))) {
CURRENT_SCENARIO_DATA.put(scenarioID, sample);
} else if ((build.equals(BASELINE_BUILD)) && (!BASELINE_SCENARIO_DATA.containsKey(scenarioID))) {
BASELINE_SCENARIO_DATA.put(scenarioID, sample);
} else {
System.err.println("WARN: Input contains Data from the wrong build or baseline");
}
}
} catch (EOFException ex) {
// EOFException is the intended way to end the loop
System.out.println("Finished reading data from " + inputFile);
}
catch (Exception ex) {
System.err.println("ERROR: IOException reading: " + inputFile);
System.exit(1);
}
}

public String[] getComponents() {
return ECLIPSE_COMPONENTS;
}

public Set<String> getCurrentScenarios() {
return CURRENT_SCENARIO_DATA.keySet();
}

public Set<String> getBaselineScenarios() {
return BASELINE_SCENARIO_DATA.keySet();
}

public double[] getData(String build, String scenarioID) {
Sample sample = null;

if (build == "current") {
sample = CURRENT_SCENARIO_DATA.get(scenarioID);
} else {
sample = BASELINE_SCENARIO_DATA.get(scenarioID);
}

DataPoint[] data = sample.getDataPoints();

double elapsedProcess = 0;
double cpuTime = 0;

for (DataPoint datum : data) {
Dim[] dimensions = datum.getDimensions();
for (Dim dim : dimensions) {
if (dim.getName().contains("Elapsed Process")) {
Scalar scalar = datum.getScalar(dim);
String value = dim.getDisplayValue(scalar);
//check for big values (1.21k etc)
if (value.substring(value.length() - 1).equals("K")){
value = value.substring(0, value.length()-1);
Double decimalValue = Double.parseDouble(value);
decimalValue = decimalValue * 1000;
elapsedProcess += decimalValue;
} else {
elapsedProcess += Double.parseDouble(value);
}
}
if (dim.getName().contains("CPU Time")) {
Scalar scalar = datum.getScalar(dim);
String value = dim.getDisplayValue(scalar);
//check for big values (1.21k etc)
if (value.substring(value.length() - 1).equals("K")){
value = value.substring(0, value.length()-1);
Double decimalValue = Double.parseDouble(value);
decimalValue = decimalValue * 1000;
cpuTime += decimalValue;
} else {
cpuTime += Double.parseDouble(value);
}
}
}
}

double[] currentData = {elapsedProcess, cpuTime};
return currentData;
}
}
Loading