本文整理匯總了Java中org.spotter.shared.result.model.SpotterResult類的典型用法代碼示例。如果您正苦於以下問題:Java SpotterResult類的具體用法?Java SpotterResult怎麽用?Java SpotterResult使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SpotterResult類屬於org.spotter.shared.result.model包,在下文中一共展示了SpotterResult類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: analyze
import org.spotter.shared.result.model.SpotterResult; //導入依賴的package包/類
@Override
protected SpotterResult analyze(DatasetCollection data) {
SpotterResult result = new SpotterResult();
String message = "Detected a test bottleneck!";
String methodA = "methodA()";
ProblemOccurrence occurrenceA = new ProblemOccurrence(methodA, message);
String methodB = "methodB()";
ProblemOccurrence occurrenceB = new ProblemOccurrence(methodB, message);
String methodC = "methodC()";
ProblemOccurrence occurrenceC = new ProblemOccurrence(methodC, message);
result.addProblemOccurrence(occurrenceA);
result.addProblemOccurrence(occurrenceB);
result.addProblemOccurrence(occurrenceC);
result.setDetected(true);
result.addMessage("Test detection run finished successfully!");
return result;
}
示例2: createTimeSeriesChart
import org.spotter.shared.result.model.SpotterResult; //導入依賴的package包/類
private void createTimeSeriesChart(String servlet, String query, long numMaxUsers,
NumericPairList<Long, Long> multiUserServletRTs, NumericPairList<Long, Long> multiUserQueryRTs,
NumericPairList<Long, Long> singleUserServletRTs, NumericPairList<Long, Long> singleUserQueryRTs,
SpotterResult result) {
AnalysisChartBuilder chartBuilder = AnalysisChartBuilder.getChartBuilder();
String servletName = LpeStringUtils.shortenOperationName(servlet);
String queryName = query;
if (queryName.length() > 15) {
queryName = queryName.substring(0, 13) + "...";
}
chartBuilder.startChart("Response Times", "Experiment Time [ms]", "Response Time [ms]");
chartBuilder.addScatterSeries(multiUserServletRTs, servletName + " with " + numMaxUsers + " users");
chartBuilder.addScatterSeries(multiUserQueryRTs, queryName + " with " + numMaxUsers + " users");
chartBuilder.addScatterSeries(singleUserServletRTs, servletName + " with 1 user");
chartBuilder.addScatterSeries(singleUserQueryRTs, queryName + " with 1 user");
chartBuilder.addHorizontalLine(perfReqThreshold, "Performance Requirement");
controller.getResultManager().storeImageChartResource(chartBuilder, "Response Times", result);
}
示例3: analyze
import org.spotter.shared.result.model.SpotterResult; //導入依賴的package包/類
@Override
public SpotterResult analyze(DatasetCollection data) {
SpotterResult result = new SpotterResult();
Dataset rtDataset = data.getDataSets(ResponseTimeRecord.class).get(0);
if (rtDataset == null || rtDataset.size() == 0) {
result.setDetected(false);
result.addMessage("Instrumentation achieved no results for the given scope!");
return result;
}
for (String operation : rtDataset.getValueSet(ResponseTimeRecord.PAR_OPERATION, String.class)) {
boolean operationDetected = analyseOperationResponseTimes(rtDataset, operation, result);
if (operationDetected) {
result.setDetected(true);
result.addMessage("Ramp detected in operation: " + operation);
}
}
return result;
}
示例4: createChart
import org.spotter.shared.result.model.SpotterResult; //導入依賴的package包/類
private void createChart(SpotterResult result, String operation, NumericPairList<Long, Double> responseTimeSeries,
long minTimestamp, long diff, List<Double> sums1, List<Double> sums2, double firstMean, double secondMean) {
double firstStdDev = LpeNumericUtils.stdDev(sums1);
double firstCIWidth = LpeNumericUtils.getConfidenceIntervalWidth(sums1.size(), firstStdDev,
requiredSignificanceLevel);
double secondStdDev = LpeNumericUtils.stdDev(sums2);
double secondCIWidth = LpeNumericUtils.getConfidenceIntervalWidth(sums2.size(), secondStdDev,
requiredSignificanceLevel);
AnalysisChartBuilder chartBuilder = AnalysisChartBuilder.getChartBuilder();
chartBuilder.startChart(operation, "Experiment Time [ms]", "Response Time [ms]");
// chartBuilder.addTimeSeries(responseTimeSeries, "Response Times");
NumericPairList<Long, Double> means = new NumericPairList<>();
List<Number> ci = new ArrayList<>();
means.add(minTimestamp + diff / 4L, firstMean);
ci.add(firstCIWidth / 2.0);
means.add(minTimestamp + (3L * diff) / 4L, secondMean);
ci.add(secondCIWidth / 2.0);
chartBuilder.addTimeSeriesWithErrorBars(means, ci, "Confidence Intervals");
mainDetectionController.getResultManager().storeImageChartResource(chartBuilder, "Ramp Detection (DG)",
result);
}
示例5: createChart
import org.spotter.shared.result.model.SpotterResult; //導入依賴的package包/類
private void createChart(SpotterResult result, String operation, NumericPairList<Long, Double> responseTimeSeries,
SimpleRegression regression) {
NumericPairList<Long, Double> linRegressionPoints = new NumericPairList<>();
NumericPairList<Long, Double> thresholdPoints = new NumericPairList<>();
long minTimestamp = responseTimeSeries.getKeyMin();
long maxTimestamp = responseTimeSeries.getKeyMax();
double intercept = regression.predict(minTimestamp);
linRegressionPoints.add(minTimestamp, intercept);
linRegressionPoints.add(maxTimestamp, regression.predict(maxTimestamp));
thresholdPoints.add(minTimestamp, intercept);
thresholdPoints.add(maxTimestamp, slopeThreshold * (double) (maxTimestamp - minTimestamp) + intercept);
AnalysisChartBuilder chartBuilder = AnalysisChartBuilder.getChartBuilder();
chartBuilder.startChart(operation, "Experiment Time [ms]", "Response Time [ms]");
// chartBuilder.addTimeSeries(responseTimeSeries, "Response Times");
chartBuilder.addTimeSeriesWithLine(thresholdPoints, "Threshold Slope");
chartBuilder.addTimeSeriesWithLine(linRegressionPoints, "Regression Slope");
mainDetectionController.getResultManager().storeImageChartResource(chartBuilder,
"Ramp Detection (Lin)", result);
}
示例6: createChart
import org.spotter.shared.result.model.SpotterResult; //導入依賴的package包/類
private void createChart(SpotterResult result, String operation, NumericPairList<Long, Double> responseTimeSeries,
List<Hiccup> hiccups, long perfReqThreshold) {
AnalysisChartBuilder chartBuilder = AnalysisChartBuilder.getChartBuilder();
String operationName = operation.contains("(")?operation.substring(0, operation.indexOf("(")):operation;
chartBuilder.startChart(operationName, "Experiment Time [ms]", "Response Time [ms]");
chartBuilder.addTimeSeries(responseTimeSeries, "Response Times");
chartBuilder.addHorizontalLine(perfReqThreshold, "Perf. Requirement");
long minTimestamp = responseTimeSeries.getKeyMin();
long maxTimestamp = responseTimeSeries.getKeyMax();
double minRT = responseTimeSeries.getValueMin().doubleValue();
NumericPairList<Long, Double> hiccupSeries = new NumericPairList<>();
hiccupSeries.add(minTimestamp, minRT);
for (Hiccup hiccup : hiccups) {
hiccupSeries.add(hiccup.getStartTimestamp(), minRT);
hiccupSeries.add(hiccup.getStartTimestamp(), hiccup.getMaxHiccupResponseTime());
hiccupSeries.add(hiccup.getEndTimestamp(), hiccup.getMaxHiccupResponseTime());
hiccupSeries.add(hiccup.getEndTimestamp(), minRT);
}
hiccupSeries.add(maxTimestamp, minRT);
chartBuilder.addTimeSeriesWithLine(hiccupSeries, "Hiccups");
getResultManager().storeImageChartResource(chartBuilder, "Hiccups", result);
}
示例7: getCPUUtilizations
import org.spotter.shared.result.model.SpotterResult; //導入依賴的package包/類
private Map<String, NumericPairList<Integer, Double>> getCPUUtilizations(Dataset cpuUtilDataset,
SpotterResult result, final List<Integer> numUsersList) {
Map<String, NumericPairList<Integer, Double>> resultMap = new HashMap<>();
for (String processID : cpuUtilDataset.getValueSet(CPUUtilizationRecord.PAR_PROCESS_ID, String.class)) {
NumericPairList<Integer, Double> cpuUtilPairList = new NumericPairList<>();
for (Integer numUsers : numUsersList) {
ParameterSelection selection = new ParameterSelection()
.select(AbstractDetectionController.NUMBER_OF_USERS_KEY, numUsers)
.select(CPUUtilizationRecord.PAR_PROCESS_ID, processID)
.select(CPUUtilizationRecord.PAR_CPU_ID, CPUUtilizationRecord.RES_CPU_AGGREGATED);
Dataset tmpCPUUtilDataset = selection.applyTo(cpuUtilDataset);
List<Double> cpuUtils = tmpCPUUtilDataset.getValues(CPUUtilizationRecord.PAR_UTILIZATION, Double.class);
double meanCPUUtil = LpeNumericUtils.average(cpuUtils);
cpuUtilPairList.add(numUsers, meanCPUUtil);
}
resultMap.put(processID + " - " + CPUUtilizationRecord.RES_CPU_AGGREGATED, cpuUtilPairList);
}
return resultMap;
}
示例8: analyze
import org.spotter.shared.result.model.SpotterResult; //導入依賴的package包/類
@Override
public SpotterResult analyze(DatasetCollection data) {
SpotterResult result = new SpotterResult();
Dataset cpuUtilDataset = data.getDataSet(CPUUtilizationRecord.class);
if (cpuUtilDataset == null) {
result.addMessage("Unable to analyze CPU utilization: CPU utilization data has not been gathered.");
result.setDetected(false);
return result;
} else {
for (String processId : cpuUtilDataset.getValueSet(CPUUtilizationRecord.PAR_PROCESS_ID, String.class)) {
boolean cpuUtilized = cpuUtilized(cpuUtilDataset, processId, result);
if (cpuUtilized) {
result.addMessage("CPU Utilization is quite high. The CPU is probably a bottleneck!");
result.setDetected(false);
return result;
}
}
}
result.setDetected(true);
result.addMessage("None of the hardware resources is utilized to capacity!");
return result;
}
示例9: createChart
import org.spotter.shared.result.model.SpotterResult; //導入依賴的package包/類
private void createChart(double perfReqThreshold, double perfReqConfidence, SpotterResult result, String operation,
List<Double> responseTimes, NumericPairList<Long, Double> responseTimeSeries, boolean detected) {
String prefix = "";
if (detected) {
prefix = "DETECTED-";
}
AnalysisChartBuilder chartBuilder = AnalysisChartBuilder.getChartBuilder();
String operationName = operation.contains("(") ? operation.substring(0, operation.indexOf("(")) : operation;
chartBuilder.startChart("CDF - " + operationName, "response time [ms]", "cummulative probability [%]");
chartBuilder.addCDFSeries(responseTimes, "CDF");
chartBuilder.addHorizontalLine(perfReqConfidence * _100_PERCENT, "requirements confidence");
chartBuilder.addVerticalLine(perfReqThreshold, "requirements threshold");
getResultManager().storeImageChartResource(chartBuilder, prefix + "cummulativeDistribution", result);
chartBuilder = AnalysisChartBuilder.getChartBuilder();
chartBuilder.startChart(operationName, "experiment time [ms]", "response time [ms]");
chartBuilder.addTimeSeries(responseTimeSeries, "response times");
chartBuilder.addHorizontalLine(perfReqThreshold, "requirements threshold");
getResultManager().storeImageChartResource(chartBuilder, prefix + "Response Times", result);
}
示例10: getImage
import org.spotter.shared.result.model.SpotterResult; //導入依賴的package包/類
@Override
public Image getImage(IExtensionItem item) {
Object xmlModel = item.getModelWrapper().getXMLModel();
if (resultsContainer == null || !(xmlModel instanceof XPerformanceProblem)) {
return null;
}
XPerformanceProblem problem = (XPerformanceProblem) xmlModel;
String id = problem.getUniqueId();
SpotterResult spotterResult = resultsContainer.getResultsMap().get(id);
if (spotterResult == null) {
return IMG_NO_LOOKUP;
} else {
return spotterResult.isDetected() ? IMG_DETECTED : IMG_NOT_DETECTED;
}
}
示例11: storeImageChartResource
import org.spotter.shared.result.model.SpotterResult; //導入依賴的package包/類
/**
* Stores a xChart image.
*
* @param chartchartBuilder
* chart to store
* @param fileName
* file name of the image
* @param spotterResult
* corresponding result object
*/
public void storeImageChartResource(AnalysisChartBuilder chartBuilder, String fileName, SpotterResult spotterResult) {
additionalResourceCount++;
fileName = fileName.replace("<", "_");
fileName = fileName.replace(">", "_");
String resourceName = additionalResourceCount + "-" + fileName;
if (chartBuilder instanceof XChartBuilder) {
resourceName = resourceName + ".png";
} else if (chartBuilder instanceof RChartBuilder) {
resourceName = resourceName + ".pdf";
}
String filePath = getAdditionalResourcesPath() + resourceName;
chartBuilder.build(filePath);
spotterResult.addResourceFile(resourceName);
}
示例12: testChartStorage
import org.spotter.shared.result.model.SpotterResult; //導入依賴的package包/類
@Test
public void testChartStorage() throws IOException {
XChartBuilder chartBuilder = new XChartBuilder();
chartBuilder.startChart("a", "b", "c");
NumericPairList<Double, Double> pairList = new NumericPairList<>();
pairList.add(1.0,2.0);
pairList.add(2.0,5.0);
pairList.add(3.0,7.0);
chartBuilder.addScatterSeries(pairList, "test");
DetectionResultManager drManager = new DetectionResultManager(CONTROLLER_NAME);
drManager.setProblemId(CONTROLLER_NAME);
String fileName = "chart";
SpotterResult result = new SpotterResult();
result.setDetected(true);
drManager.storeImageChartResource(chartBuilder, fileName, result);
Assert.assertEquals(1, result.getResourceFiles().size());
String file = "1-" + fileName + ".png";
Assert.assertEquals(file, result.getResourceFiles().get(0));
File pngFile = new File(baseDir + RESOURCES_DIR + file);
Assert.assertTrue(pngFile.isFile());
Assert.assertTrue(pngFile.exists());
}
示例13: testWithoutExperiments
import org.spotter.shared.result.model.SpotterResult; //導入依賴的package包/類
@Test
public void testWithoutExperiments() throws InstrumentationException, MeasurementException, WorkloadException,
IOException {
String dataDir = tempDir.getAbsolutePath() + System.getProperty("file.separator") + "data"
+ System.getProperty("file.separator");
final DummyMeasurement dMeasurement = new DummyMeasurement(null);
GlobalConfiguration.getInstance().putProperty(ConfigKeys.OMIT_EXPERIMENTS, "true");
GlobalConfiguration.getInstance().putProperty(ConfigKeys.DUMMY_EXPERIMENT_DATA, dataDir);
Assert.assertEquals("MockDetection", detectionController.getProvider().getName());
Assert.assertEquals("test.value", detectionController.getProblemDetectionConfiguration().get("test.key"));
preGenerateData(dataDir, dMeasurement, "MockDetection-" + detectionController.getProblemId().hashCode());
SpotterResult result = detectionController.analyzeProblem();
Assert.assertTrue(result.isDetected());
Assert.assertEquals(0, DummyWorkload.numExperiments);
GlobalConfiguration.getInstance().putProperty(ConfigKeys.OMIT_EXPERIMENTS, "false");
}
示例14: initProblems
import org.spotter.shared.result.model.SpotterResult; //導入依賴的package包/類
@BeforeClass
public static void initProblems() {
problemA = new PerformanceProblem("problemA");
problemA.setProblemName("problemA");
resultA = new SpotterResult();
resultA.setDetected(true);
problemB = new PerformanceProblem("problemB");
problemB.setProblemName("problemB");
resultB = new SpotterResult();
resultB.setDetected(true);
problemC = new PerformanceProblem("problemC");
problemC.setProblemName("problemC");
resultC = new SpotterResult();
resultC.setDetected(false);
}
示例15: createChart
import org.spotter.shared.result.model.SpotterResult; //導入依賴的package包/類
private void createChart(double perfReqThreshold, SpotterResult result, String operation,
NumericPairList<Long, Double> responseTimeSeries) {
AnalysisChartBuilder chartBuilder = AnalysisChartBuilder.getChartBuilder();
String operationName = operation.contains("(")?operation.substring(0, operation.indexOf("(")):operation;
chartBuilder.startChart(operationName, "experiment time [ms]", "response time [ms]");
chartBuilder.addTimeSeries(responseTimeSeries, "response times");
chartBuilder.addHorizontalLine(perfReqThreshold, "requirements threshold");
getResultManager().storeImageChartResource(chartBuilder, "Response Times", result);
}