From af325edb4507fd030e9dc883bec2e682175a803b Mon Sep 17 00:00:00 2001 From: TV Date: Thu, 2 Feb 2023 08:49:28 +0100 Subject: [PATCH] #309 adjustementes for more user friendly handling. --- config/reportgenerator.properties | 2 +- .../report/providers/BasicTimerDataProcessor.java | 2 +- .../xceptance/xlt/report/util/JFreeChartUtils.java | 14 ++++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/config/reportgenerator.properties b/config/reportgenerator.properties index 712711cce..9cecc1f2d 100644 --- a/config/reportgenerator.properties +++ b/config/reportgenerator.properties @@ -101,7 +101,7 @@ com.xceptance.xlt.reportgenerator.charts.movingAverage.percentageOfValues = 5 # # percentile ... The percentage of values taken when calculating the moving average series. # -# time ......... Time until the end of the report. If the time is larger than the actual runtime, +# time ......... Time value to create the moving average. If the time is larger than the actual runtime, # the value will not be shown in the charts. # Allowed values are for example: # example: 30m diff --git a/src/main/java/com/xceptance/xlt/report/providers/BasicTimerDataProcessor.java b/src/main/java/com/xceptance/xlt/report/providers/BasicTimerDataProcessor.java index f8eaef754..2fc44e5b1 100644 --- a/src/main/java/com/xceptance/xlt/report/providers/BasicTimerDataProcessor.java +++ b/src/main/java/com/xceptance/xlt/report/providers/BasicTimerDataProcessor.java @@ -152,7 +152,7 @@ public TimerReport createTimerReport(final boolean generateHistogram) break; case TIME_TO_USE: // check if chart creation is valid - if ((getEndTime() - element.getLongValue()) > getStartTime()) + if ((getStartTime() + element.getLongValue()) < getEndTime()) { runTimeAverageTimeSeriesList.add(JFreeChartUtils.createMovingAverageTimeSeriesAdditonalTime(runTimeTimeSeries, element.getLongValue(), diff --git a/src/main/java/com/xceptance/xlt/report/util/JFreeChartUtils.java b/src/main/java/com/xceptance/xlt/report/util/JFreeChartUtils.java index 0ad7cb334..62eeee3bb 100644 --- a/src/main/java/com/xceptance/xlt/report/util/JFreeChartUtils.java +++ b/src/main/java/com/xceptance/xlt/report/util/JFreeChartUtils.java @@ -26,6 +26,7 @@ import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; +import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; @@ -1038,16 +1039,16 @@ public static TimeSeries createMovingAverageTimeSeriesAdditonalPercentage(final public static TimeSeries createMovingAverageTimeSeriesAdditonalTime(final TimeSeries series, final long value, String name) { // derive the name from the source series - final String avgSeriesName = series.getKey() + " (Moving Average Last ("+ name +"))"; + final String avgSeriesName = series.getKey() + " (Moving Average Time ("+ name +"))"; int samples = 0; // check if we have items if (series.getItemCount() > 0) { - final TimeSeriesDataItem lastItem = series.getDataItem(series.getItemCount() - 1); + TimeSeriesDataItem firstItem = series.getDataItem(0); - long firstMillisecond = lastItem.getPeriod().getFirstMillisecond(); - long time = firstMillisecond - value; + long firstMillisecond = firstItem.getPeriod().getFirstMillisecond(); + long time = firstMillisecond + value; for (int index = 0; index < series.getItemCount(); index++) { @@ -1077,10 +1078,11 @@ public static TimeSeries createMovingAverageTimeSeriesAdditonalRequests(final Ti // percentage value from overall requests int percentage = (int) Math.floor((value / requestCount) * 100); // samples for chart data items - final int samples = Math.max(2, series.getItemCount() * (100 - percentage) / 100); + final int samples = Math.max(2, series.getItemCount() * percentage / 100); + DecimalFormat decimalFormat = new DecimalFormat("0.##E0"); // derive the name from the source series - final String avgSeriesName = series.getKey() + " (Moving Average Last Requests ("+ value +"))"; + final String avgSeriesName = series.getKey() + " (Moving Average Requests ("+ (value < 1000 ? value : decimalFormat.format(value)) +"))"; return MovingAverage.createPointMovingAverage(series, avgSeriesName, samples); }