Search in sources :

Example 1 with ValueResultData

use of org.apache.jmeter.report.processor.ValueResultData 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);
}
Also used : IndexedNameSelector(org.apache.jmeter.report.processor.graph.IndexedNameSelector) ListResultData(org.apache.jmeter.report.processor.ListResultData) ValueResultData(org.apache.jmeter.report.processor.ValueResultData)

Example 2 with ValueResultData

use of org.apache.jmeter.report.processor.ValueResultData 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);
}
Also used : ListResultData(org.apache.jmeter.report.processor.ListResultData) ValueResultData(org.apache.jmeter.report.processor.ValueResultData)

Example 3 with ValueResultData

use of org.apache.jmeter.report.processor.ValueResultData in project jmeter by apache.

the class CustomGraphConsumer method initializeExtraResults.

@Override
protected void initializeExtraResults(MapResultData parentResult) {
    parentResult.setResult(RESULT_CTX_GRANULARITY, new ValueResultData(getGranularity()));
    parentResult.setResult(RESULT_Y_AXIS, new ValueResultData(getYAxis()));
    parentResult.setResult(RESULT_X_AXIS, new ValueResultData(getXAxis()));
    parentResult.setResult(RESULT_SAMPLE_VARIABLE_NAME, new ValueResultData(getSampleVariableName()));
    parentResult.setResult(RESULT_CONTENT_MESSAGE, new ValueResultData(getContentMessage()));
}
Also used : ValueResultData(org.apache.jmeter.report.processor.ValueResultData)

Example 4 with ValueResultData

use of org.apache.jmeter.report.processor.ValueResultData 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);
        }
    }
}
Also used : Aggregator(org.apache.jmeter.report.processor.Aggregator) TreeMap(java.util.TreeMap) MapResultData(org.apache.jmeter.report.processor.MapResultData) ListResultData(org.apache.jmeter.report.processor.ListResultData) TreeMap(java.util.TreeMap) Map(java.util.Map) HashMap(java.util.HashMap) ValueResultData(org.apache.jmeter.report.processor.ValueResultData)

Example 5 with ValueResultData

use of org.apache.jmeter.report.processor.ValueResultData in project jmeter by apache.

the class AbstractGraphConsumer method setMaxResult.

private void setMaxResult(MapResultData result, String name, Double value) {
    ValueResultData valueResult = (ValueResultData) result.getResult(name);
    valueResult.setValue(Math.max((Double) valueResult.getValue(), value));
}
Also used : ValueResultData(org.apache.jmeter.report.processor.ValueResultData)

Aggregations

ValueResultData (org.apache.jmeter.report.processor.ValueResultData)11 ListResultData (org.apache.jmeter.report.processor.ListResultData)6 MapResultData (org.apache.jmeter.report.processor.MapResultData)5 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 Aggregator (org.apache.jmeter.report.processor.Aggregator)1 ResultData (org.apache.jmeter.report.processor.ResultData)1 GroupInfo (org.apache.jmeter.report.processor.graph.GroupInfo)1 IndexedNameSelector (org.apache.jmeter.report.processor.graph.IndexedNameSelector)1 SeriesData (org.apache.jmeter.report.processor.graph.SeriesData)1