Skip to content

Commit

Permalink
Xceptance#309 adjustementes for more user friendly handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
TV committed Feb 2, 2023
1 parent 5f0f2c5 commit af325ed
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion config/reportgenerator.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
14 changes: 8 additions & 6 deletions src/main/java/com/xceptance/xlt/report/util/JFreeChartUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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++)
{
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit af325ed

Please sign in to comment.