use of org.eclipse.test.internal.performance.data.DataPoint in project eclipse.platform.releng by eclipse.
the class StatisticsSession method computeStats.
private Statistics computeStats(Dim dimension) {
Statistics stats;
Set<Integer> steps = new HashSet<>();
for (int j = 0; j < fDataPoints.length; j++) {
DataPoint dp = fDataPoints[j];
steps.add(Integer.valueOf(dp.getStep()));
}
if (steps.contains(Integer.valueOf(InternalPerformanceMeter.AVERAGE))) {
// an already aggregated set of data points from the DB
stats = computeStatsFromAggregates(dimension);
} else if (steps.contains(Integer.valueOf(InternalPerformanceMeter.AFTER))) {
// raw values from measurement
stats = computeStatsFromMeasurements(dimension, steps);
} else {
// $NON-NLS-1$
Assert.fail("illegal data set: contains neither AVERAGE nor AFTER values.");
// dummy
stats = null;
}
return stats;
}
use of org.eclipse.test.internal.performance.data.DataPoint in project eclipse.platform.releng by eclipse.
the class StatisticsSession method computeStatsFromMeasurements.
private Statistics computeStatsFromMeasurements(Dim dimension, Set<Integer> steps) {
Statistics stats = new Statistics();
long[] mags;
switch(steps.size()) {
case 1:
// if there is only one Step, we don't calculate the delta. happens for startup tests
mags = new long[fDataPoints.length];
for (int i = 0; i < fDataPoints.length; i++) {
Scalar sc = fDataPoints[i].getScalar(dimension);
mags[i] = sc == null ? 0 : sc.getMagnitude();
}
break;
case 2:
int count = fDataPoints.length / 2;
mags = new long[count];
for (int i = 0; i < count; i++) {
DataPoint before = fDataPoints[2 * i];
// $NON-NLS-1$
Assert.assertTrue("wrong order of steps", before.getStep() == InternalPerformanceMeter.BEFORE);
DataPoint after = fDataPoints[2 * i + 1];
// $NON-NLS-1$
Assert.assertTrue("wrong order of steps", after.getStep() == InternalPerformanceMeter.AFTER);
Scalar delta = getDelta(before, after, dimension);
long magnitude = delta.getMagnitude();
mags[i] = magnitude;
}
break;
default:
// $NON-NLS-1$
Assert.fail("cannot handle more than two steps in measurement mode");
// dummy
return null;
}
for (int i = 0; i < mags.length; i++) {
stats.sum += mags[i];
stats.count++;
}
if (stats.count > 0) {
stats.average = (double) stats.sum / stats.count;
if (stats.count == 1) {
stats.stddev = 0;
} else {
double squaredDeviations = 0;
for (int i = 0; i < mags.length; i++) {
double deviation = stats.average - mags[i];
squaredDeviations += deviation * deviation;
}
// unbiased sample stdev
stats.stddev = Math.sqrt(squaredDeviations / (stats.count - 1));
}
} else {
stats.average = 0;
stats.stddev = 0;
}
return stats;
}
use of org.eclipse.test.internal.performance.data.DataPoint in project eclipse.platform.releng by eclipse.
the class InternalPerformanceMeter method printSample.
private void printSample(PrintStream ps, Sample sample) {
// $NON-NLS-1$ //$NON-NLS-2$
ps.print("Scenario '" + getScenarioName() + "' ");
DataPoint[] dataPoints = sample.getDataPoints();
if (dataPoints.length > 0) {
StatisticsSession s = new StatisticsSession(dataPoints);
Dim[] dimensions = dataPoints[0].getDimensions();
Arrays.sort(dimensions, new DimensionComparator());
if (dimensions.length > 0) {
List<Dim> badDimensions = new ArrayList<>();
long n = s.getCount(dimensions[0]);
// $NON-NLS-1$
MessageFormat format = new MessageFormat("({0,number,percent} in [{1}, {2}])");
// $NON-NLS-1$
String spaces = " ";
// $NON-NLS-1$ //$NON-NLS-2$
ps.println("(average over " + n + " samples):");
for (Dim dimension : dimensions) {
double mean = s.getAverage(dimension);
// $NON-NLS-1$ //$NON-NLS-2$
String nameString = " " + dimension.getName() + ":";
String meanString = dimension.getDisplayValue(mean);
int align = firstNonDigit(meanString);
int endIndex = 30 - align - nameString.length();
if (endIndex > 0)
meanString = spaces.substring(0, endIndex) + meanString;
align = nameString.length() + meanString.length();
Percentile percentile = StatisticsUtil.T95;
double[] confidenceInterval = s.getConfidenceInterval(dimension, percentile);
StringBuffer printBuffer;
if (n <= 2) {
// $NON-NLS-1$
printBuffer = new StringBuffer(" (no confidence)");
} else {
printBuffer = new StringBuffer();
int ns = align;
while (ns++ < 40) printBuffer.append(' ');
printBuffer.append(format.format(new Object[] { Double.valueOf(percentile.inside()), dimension.getDisplayValue(confidenceInterval[0]), dimension.getDisplayValue(confidenceInterval[1]) }));
}
align += printBuffer.length();
try {
while (align++ < 70) printBuffer.append(' ');
printBuffer.append(checkSampleSize(s, sample, dimension));
} catch (CoreException x) {
badDimensions.add(dimension);
continue;
}
ps.print(nameString);
ps.print(meanString);
ps.println(printBuffer);
}
if (!badDimensions.isEmpty()) {
// $NON-NLS-1$
ps.print(" Dimensions with unusable statistical properties: ");
for (Iterator<Dim> iter = badDimensions.iterator(); iter.hasNext(); ) {
Dim dimension = iter.next();
ps.print(dimension.getName());
if (iter.hasNext())
// $NON-NLS-1$
ps.print(", ");
}
ps.println();
}
}
}
ps.println();
}
use of org.eclipse.test.internal.performance.data.DataPoint in project eclipse.platform.releng by eclipse.
the class OSPerformanceMeter method getSample.
@Override
public Sample getSample() {
if (fDataPoints != null) {
HashMap runProperties = new HashMap();
collectRunInfo(runProperties);
return new Sample(getScenarioName(), fStartTime, runProperties, fDataPoints.toArray(new DataPoint[fDataPoints.size()]));
}
return null;
}
use of org.eclipse.test.internal.performance.data.DataPoint in project eclipse.platform.releng by eclipse.
the class SystemTimePerformanceMeter method getSample.
@Override
public Sample getSample() {
Assert.isTrue(fStartTime.size() == fStopTime.size());
Map properties = new HashMap();
/*
* properties.put(DRIVER_PROPERTY, PerformanceTestPlugin.getBuildId()); properties.put(HOSTNAME_PROPERTY, getHostName());
*/
DataPoint[] data = new DataPoint[2 * fStartTime.size()];
for (int i = 0; i < fStartTime.size(); i++) {
data[2 * i] = createDataPoint(BEFORE, InternalDimensions.SYSTEM_TIME, fStartTime.get(i).longValue());
data[2 * i + 1] = createDataPoint(AFTER, InternalDimensions.SYSTEM_TIME, fStopTime.get(i).longValue());
}
return new Sample(getScenarioName(), fStartDate, properties, data);
}
Aggregations