use of org.apache.jmeter.report.processor.ListResultData in project jmeter by apache.
the class ResponseTimePerSampleGraphConsumer method initializeExtraResults.
/*
* (non-Javadoc)
*
* @see org.apache.jmeter.report.processor.graph.AbstractGraphConsumer#
* initializeExtraResults(org.apache.jmeter.report.processor.MapResultData)
*/
@Override
protected void initializeExtraResults(MapResultData parentResult) {
ListResultData samples = new ListResultData();
IndexedNameSelector indexedNameSelector = (IndexedNameSelector) getKeysSelector();
int size = indexedNameSelector.getNames().size();
for (int i = 0; i < size; i++) {
samples.addResult(new ValueResultData(indexedNameSelector.getNames().get(i)));
}
parentResult.setResult("sampleNames", samples);
}
use of org.apache.jmeter.report.processor.ListResultData in project jmeter by apache.
the class SyntheticResponseTimeDistributionGraphConsumer method initializeExtraResults.
@Override
protected void initializeExtraResults(MapResultData parentResult) {
ListResultData listResultData = new ListResultData();
String[] seriesLabels = new String[] { SATISFIED_LABEL.format(new Object[] { getSatisfiedThreshold() }), TOLERATED_LABEL.format(new Object[] { getSatisfiedThreshold(), getToleratedThreshold() }), UNTOLERATED_LABEL.format(new Object[] { getToleratedThreshold() }), FAILED_LABEL };
String[] colors = new String[] { SATISFIED_COLOR, TOLERATED_COLOR, UNTOLERATED_COLOR, FAILED_COLOR };
for (int i = 0; i < seriesLabels.length; i++) {
ListResultData array = new ListResultData();
array.addResult(new ValueResultData(i));
array.addResult(new ValueResultData(seriesLabels[i]));
listResultData.addResult(array);
}
parentResult.setResult("ticks", listResultData);
initializeSeries(parentResult, seriesLabels, colors);
}
use of org.apache.jmeter.report.processor.ListResultData in project jmeter by apache.
the class AbstractGraphConsumer method addKeyData.
/**
* Adds a value map build from specified parameters to the result map.
*
* @param result {@link MapResultData}
* @param group
* @param series
* @param seriesData
* @param aggregated
*/
private void addKeyData(MapResultData result, @SuppressWarnings("unused") String group, String series, SeriesData seriesData, boolean aggregated) {
// Override series name when aggregated
if (aggregated) {
series = String.format(aggregatedKeysSeriesFormat, series);
}
// Add to the result map
ListResultData seriesList = (ListResultData) result.getResult(RESULT_SERIES);
// Looks for series result using its name
MapResultData seriesResult = null;
int index = 0;
int size = seriesList.getSize();
while (seriesResult == null && index < size) {
MapResultData currSeries = (MapResultData) seriesList.get(index);
String name = String.valueOf(((ValueResultData) currSeries.getResult(RESULT_SERIES_NAME)).getValue());
if (Objects.equals(name, series)) {
seriesResult = currSeries;
}
index++;
}
// Create series result if not found
if (seriesResult == null) {
seriesResult = createSerieResult(series, seriesData);
seriesList.addResult(seriesResult);
}
ListResultData dataResult = (ListResultData) seriesResult.getResult(RESULT_SERIES_DATA);
// Populate it with data from groupData
Map<Double, Aggregator> aggInfo;
if (aggregated) {
aggInfo = new HashMap<>();
aggInfo.put(seriesData.getKeysAggregator().getResult(), seriesData.getValuesAggregator());
} else {
aggInfo = seriesData.getAggregatorInfo();
}
if (!renderPercentiles) {
for (Map.Entry<Double, Aggregator> entry : aggInfo.entrySet()) {
// Init key and value depending on invertKeysAndValues property
Double key = entry.getKey();
Double value = entry.getValue().getResult();
if (invertKeysAndValues) {
key = entry.getValue().getResult();
value = entry.getKey();
}
// Create result storage for coordinates
ListResultData coordResult = new ListResultData();
coordResult.addResult(new ValueResultData(key));
coordResult.addResult(new ValueResultData(value));
dataResult.addResult(coordResult);
setMinResult(result, RESULT_MIN_X, key);
setMaxResult(result, RESULT_MAX_X, key);
setMinResult(result, RESULT_MIN_Y, value);
setMaxResult(result, RESULT_MAX_Y, value);
}
} else {
long count = seriesData.getCount();
int rank = 0;
double percent = 0;
TreeMap<Double, Aggregator> sortedInfo = new TreeMap<>(aggInfo);
if (!invertKeysAndValues) {
for (Map.Entry<Double, Aggregator> entry : sortedInfo.entrySet()) {
Double value = entry.getKey();
percent += (double) 100 * entry.getValue().getCount() / count;
double percentile = (double) rank / 10;
while (percentile < percent) {
ListResultData coordResult = new ListResultData();
coordResult.addResult(new ValueResultData(percentile));
coordResult.addResult(new ValueResultData(value));
dataResult.addResult(coordResult);
percentile = (double) ++rank / 10;
}
setMinResult(result, RESULT_MIN_Y, value);
setMaxResult(result, RESULT_MAX_Y, value);
}
setMinResult(result, RESULT_MIN_X, 0d);
setMaxResult(result, RESULT_MAX_X, 100d);
} else {
for (Map.Entry<Double, Aggregator> entry : sortedInfo.entrySet()) {
Double value = entry.getKey();
percent += (double) 100 * entry.getValue().getCount() / count;
double percentile = (double) rank / 10;
while (percentile < percent) {
ListResultData coordResult = new ListResultData();
coordResult.addResult(new ValueResultData(value));
coordResult.addResult(new ValueResultData(percentile));
dataResult.addResult(coordResult);
percentile = (double) ++rank / 10;
}
setMinResult(result, RESULT_MIN_X, value);
setMaxResult(result, RESULT_MAX_X, value);
}
setMinResult(result, RESULT_MIN_Y, 0d);
setMaxResult(result, RESULT_MAX_Y, 100d);
}
}
}
use of org.apache.jmeter.report.processor.ListResultData in project jmeter by apache.
the class AbstractGraphConsumer method createResult.
private MapResultData createResult() {
MapResultData result = new MapResultData();
result.setResult(RESULT_MIN_X, new ValueResultData(Double.MAX_VALUE));
result.setResult(RESULT_MAX_X, new ValueResultData(Double.MIN_VALUE));
result.setResult(RESULT_MIN_Y, new ValueResultData(Double.MAX_VALUE));
result.setResult(RESULT_MAX_Y, new ValueResultData(Double.MIN_VALUE));
result.setResult(RESULT_TITLE, new ValueResultData(getTitle()));
result.setResult(RESULT_SERIES, new ListResultData());
boolean supportsControllersDiscrimination = groupInfos.values().stream().map(GroupInfo::getSeriesSelector).allMatch(GraphSeriesSelector::allowsControllersDiscrimination);
result.setResult(RESULT_SUPPORTS_CONTROLLERS_DISCRIMINATION, new ValueResultData(supportsControllersDiscrimination));
initializeExtraResults(result);
return result;
}
use of org.apache.jmeter.report.processor.ListResultData in project jmeter by apache.
the class JsonExporter method createStatistic.
private void createStatistic(Map<String, SamplingStatistic> statistics, MapResultData resultData) {
LOGGER.debug("Creating statistics for result data:{}", resultData);
SamplingStatistic statistic = new SamplingStatistic();
ListResultData listResultData = (ListResultData) resultData.getResult("data");
statistic.setTransaction((String) ((ValueResultData) listResultData.get(0)).getValue());
statistic.setSampleCount((Long) ((ValueResultData) listResultData.get(1)).getValue());
statistic.setErrorCount((Long) ((ValueResultData) listResultData.get(2)).getValue());
statistic.setErrorPct(((Double) ((ValueResultData) listResultData.get(3)).getValue()).floatValue());
statistic.setMeanResTime((Double) ((ValueResultData) listResultData.get(4)).getValue());
statistic.setMinResTime((Long) ((ValueResultData) listResultData.get(5)).getValue());
statistic.setMaxResTime((Long) ((ValueResultData) listResultData.get(6)).getValue());
statistic.setMedianResTime((Double) ((ValueResultData) listResultData.get(7)).getValue());
statistic.setPct1ResTime((Double) ((ValueResultData) listResultData.get(8)).getValue());
statistic.setPct2ResTime((Double) ((ValueResultData) listResultData.get(9)).getValue());
statistic.setPct3ResTime((Double) ((ValueResultData) listResultData.get(10)).getValue());
statistic.setThroughput((Double) ((ValueResultData) listResultData.get(11)).getValue());
statistic.setReceivedKBytesPerSec((Double) ((ValueResultData) listResultData.get(12)).getValue());
statistic.setSentKBytesPerSec((Double) ((ValueResultData) listResultData.get(13)).getValue());
statistics.put(statistic.getTransaction(), statistic);
}
Aggregations