Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 43 additions & 2 deletions config/reportgenerator.properties
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,49 @@ com.xceptance.xlt.reportgenerator.charts.height = 300

#com.xceptance.xlt.reportgenerator.charts.cappingMode = always

## The percentage of values taken when calculating the moving average series.
com.xceptance.xlt.reportgenerator.charts.movingAverage.percentageOfValues = 5
###############################################################################
#
# Moving Average Configuration
#
# This describes the configuration of the common moving average series. It is also possible to configure up to 5
# additional moving averages that will be displayed in the average charts.
#
# Format:
#
# com.xceptance.xlt.reportgenerator.charts.commonAverage.type = <type>
# com.xceptance.xlt.reportgenerator.charts.commonAverage.value = <value>
#
# com.xceptance.xlt.reportgenerator.charts.averages.<index>.type = <type>
# com.xceptance.xlt.reportgenerator.charts.averages.<index>.value = <value>
#
#
# type ......... The type of moving average to calculate (allowed values are "percentage" and "time").
#
# value ........ The value for calculating the moving average. Value format must match the selected type. Percentage
# values can be provided as integer values (optionally ending with "%"). Time values can be provided
# in the usual allowed time formats (see examples below). Values must be greater than "0" and
# percentage values must not exceed 100%.
# Allowed percentage values are for example: 5%, 12
# Allowed time values are for example: 30s, 1m15s, 2:30, 45
#
# index ........ Numeric index for the additional moving averages (allowed values are "1" to "5").
#
# Example configuration:
# com.xceptance.xlt.reportgenerator.charts.commonAverage.type = percentage
# com.xceptance.xlt.reportgenerator.charts.commonAverage.value = 5%
# com.xceptance.xlt.reportgenerator.charts.averages.1.type = time
# com.xceptance.xlt.reportgenerator.charts.averages.1.value = 1m30s
#
###############################################################################

com.xceptance.xlt.reportgenerator.charts.commonAverage.type = percentage
com.xceptance.xlt.reportgenerator.charts.commonAverage.value = 5%

com.xceptance.xlt.reportgenerator.charts.averages.1.type = percentage
com.xceptance.xlt.reportgenerator.charts.averages.1.value = 2%

com.xceptance.xlt.reportgenerator.charts.averages.2.type = percentage
com.xceptance.xlt.reportgenerator.charts.averages.2.value = 10%

## Whether dynamic/interactive charts are enabled in addition to the regular
## WEBP image charts (default: true).
Expand Down
52 changes: 50 additions & 2 deletions doc/internal-doc/api.sig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Signature file v4.1
#Version 9.2.0-SNAPSHOT
#Version 9.2.0

CLSS public abstract com.xceptance.xlt.api.actions.AbstractAction
cons protected init(com.xceptance.xlt.api.actions.AbstractAction,java.lang.String)
Expand Down Expand Up @@ -1640,6 +1640,29 @@ meth public void unlock()
supr java.lang.Object
hfds configuration,lock

CLSS public com.xceptance.xlt.api.report.MovingAverageConfiguration
innr public final static !enum MovingAverageType
meth public com.xceptance.xlt.api.report.MovingAverageConfiguration$MovingAverageType getType()
meth public int getValue()
meth public java.lang.String getName()
meth public java.lang.String toString()
meth public static com.xceptance.xlt.api.report.MovingAverageConfiguration createPercentageConfig(int)
meth public static com.xceptance.xlt.api.report.MovingAverageConfiguration createTimeConfig(int)
meth public static com.xceptance.xlt.api.report.MovingAverageConfiguration createTimeConfig(int,java.lang.String)
supr java.lang.Object
hfds name,type,value

CLSS public final static !enum com.xceptance.xlt.api.report.MovingAverageConfiguration$MovingAverageType
outer com.xceptance.xlt.api.report.MovingAverageConfiguration
fld public final static com.xceptance.xlt.api.report.MovingAverageConfiguration$MovingAverageType PERCENTAGE
fld public final static com.xceptance.xlt.api.report.MovingAverageConfiguration$MovingAverageType TIME
meth public java.lang.String getName()
meth public static com.xceptance.xlt.api.report.MovingAverageConfiguration$MovingAverageType valueOf(java.lang.String)
meth public static com.xceptance.xlt.api.report.MovingAverageConfiguration$MovingAverageType[] values()
meth public static java.util.List<java.lang.String> getNames()
supr java.lang.Enum<com.xceptance.xlt.api.report.MovingAverageConfiguration$MovingAverageType>
hfds name

CLSS public com.xceptance.xlt.api.report.PostProcessedDataContainer
cons public init(int,int)
fld public final int sampleFactor
Expand All @@ -1666,12 +1689,13 @@ meth public boolean wantsDataRecords()

CLSS public abstract interface com.xceptance.xlt.api.report.ReportProviderConfiguration
meth public abstract boolean shouldChartsGenerated()
meth public abstract com.xceptance.xlt.api.report.MovingAverageConfiguration getCommonMovingAverageConfig()
meth public abstract int getChartHeight()
meth public abstract int getChartWidth()
meth public abstract int getMovingAveragePercentage()
meth public abstract java.io.File getChartDirectory()
meth public abstract java.io.File getCsvDirectory()
meth public abstract java.io.File getReportDirectory()
meth public abstract java.util.List<com.xceptance.xlt.api.report.MovingAverageConfiguration> getAdditionalMovingAverageConfigs()
meth public abstract java.util.Properties getProperties()
meth public abstract long getChartEndTime()
meth public abstract long getChartStartTime()
Expand Down Expand Up @@ -2197,6 +2221,27 @@ intf java.lang.annotation.Annotation
meth public abstract !hasdefault boolean forRemoval()
meth public abstract !hasdefault java.lang.String since()

CLSS public abstract java.lang.Enum<%0 extends java.lang.Enum<{java.lang.Enum%0}>>
cons protected init(java.lang.String,int)
innr public final static EnumDesc
intf java.io.Serializable
intf java.lang.Comparable<{java.lang.Enum%0}>
intf java.lang.constant.Constable
meth protected final java.lang.Object clone() throws java.lang.CloneNotSupportedException
meth protected final void finalize()
anno 0 java.lang.Deprecated(boolean forRemoval=true, java.lang.String since="18")
meth public final boolean equals(java.lang.Object)
meth public final int compareTo({java.lang.Enum%0})
meth public final int hashCode()
meth public final int ordinal()
meth public final java.lang.Class<{java.lang.Enum%0}> getDeclaringClass()
meth public final java.lang.String name()
meth public final java.util.Optional<java.lang.Enum$EnumDesc<{java.lang.Enum%0}>> describeConstable()
meth public java.lang.String toString()
meth public static <%0 extends java.lang.Enum<{%%0}>> {%%0} valueOf(java.lang.Class<{%%0}>,java.lang.String)
supr java.lang.Object
hfds hash,name,ordinal

CLSS public java.lang.Exception
cons protected init(java.lang.String,java.lang.Throwable,boolean,boolean)
cons public init()
Expand Down Expand Up @@ -2299,6 +2344,9 @@ CLSS public abstract interface !annotation java.lang.annotation.Target
intf java.lang.annotation.Annotation
meth public abstract java.lang.annotation.ElementType[] value()

CLSS public abstract interface java.lang.constant.Constable
meth public abstract java.util.Optional<? extends java.lang.constant.ConstantDesc> describeConstable()

CLSS public abstract interface java.util.Collection<%0 extends java.lang.Object>
intf java.lang.Iterable<{java.util.Collection%0}>
meth public <%0 extends java.lang.Object> {%%0}[] toArray(java.util.function.IntFunction<{%%0}[]>)
Expand Down
77 changes: 74 additions & 3 deletions src/main/java/com/xceptance/common/util/AbstractConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@
import java.net.URI;
import java.net.URL;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import java.util.TreeSet;

import org.apache.commons.lang3.StringUtils;

Expand All @@ -39,6 +42,10 @@ public class AbstractConfiguration
*/
private static final String PROPERTY_PARSING_ERROR_FORMAT = "The value '%s' of property '%s' cannot be resolved to a %s.";

static final String PROPERTY_PARSING_ERROR_INVALID_INDEX_FORMAT = "Index '%s' in properties with prefix '%s' is not a valid integer.";

static final String PROPERTY_PARSING_ERROR_INDEX_OUT_OF_BOUNDS = "Index '%s' in properties with prefix '%s' is out of bounds. Index must be between '%d' and '%d'.";

/**
* The internal store of properties.
*/
Expand Down Expand Up @@ -253,7 +260,7 @@ public long getLongProperty(final String key, final long defaultValue)
* @return the property value
* @throws RuntimeException
* if the value cannot be found
* @see #getDoubleProperty(String, int)
* @see #getDoubleProperty(String, double)
*/
public double getDoubleProperty(final String key)
{
Expand Down Expand Up @@ -418,6 +425,72 @@ public Set<String> getPropertyKeysWithPrefix(final String prefix)
return set;
}

/**
* <p>
* Get a list of all integer indexes (in order) that are used in properties starting with the given prefix.
* </p>
* <p>
* For example, the properties contain:
* </p>
*
* <pre>{@code
* ...
* test.prop.1.type = typeA
* test.prop.1.value = valueA
* test.prop.3.type = typeB
* test.prop.3.value = valueB
* ...
* }
* </pre>
* <p>
* Calling this method with prefix "test.prop." will return a list containing [1,3].
* </p>
* <p>
* This method will validate that all matching indexes are no smaller than "minIndex" and no bigger than "maxIndex",
* and throw an exception if any index is outside of this range.
* </p>
*
* @param prefix
* the property prefix
* @param minIndex
* the smallest allowed index value
* @param maxIndex
* the biggest allowed index value
* @return a sorted list of all matching indexes
* @throws NumberFormatException
* if any of the indexes isn't a valid integer value
* @throws IndexOutOfBoundsException
* if any of the indexes is below the minIndex or above the maxIndex
*/
public List<Integer> getPropertyKeyIndexes(final String prefix, final int minIndex, final int maxIndex)
{
final TreeSet<Integer> sortedIndexes = new TreeSet<>();

for (final String indexString : getPropertyKeyFragment(prefix))
{
final int index;

try
{
index = ParseUtils.parseInt(indexString);
}
catch (final ParseException e)
{
throw new NumberFormatException(String.format(PROPERTY_PARSING_ERROR_INVALID_INDEX_FORMAT, indexString, prefix));
}

if (index < minIndex || index > maxIndex)
{
throw new IndexOutOfBoundsException(String.format(PROPERTY_PARSING_ERROR_INDEX_OUT_OF_BOUNDS, indexString, prefix, minIndex,
maxIndex));
}

sortedIndexes.add(index);
}

return new ArrayList<>(sortedIndexes);
}

/**
* Returns the value of the given property. If the property value cannot be found, an exception will be thrown.
*
Expand Down Expand Up @@ -512,8 +585,6 @@ public URL getUrlProperty(final String key, final URL defaultValue)
*
* @param key
* the property name
* @param defaultValue
* the default property value
* @return the property value
* @throws RuntimeException
* if there is no property configured for the argument key
Expand Down
23 changes: 23 additions & 0 deletions src/main/java/com/xceptance/common/util/ParseUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,29 @@ public static long parseLong(final String s, final long defaultValue)
}
}

/**
* Parses a given integer percentage into an int value. The input can optionally end with a "%" character. E.g. the
* inputs "25%" or "25" will both return the value "25".
*
* @param s
* string to parse
* @return parsed percentage as an int value
* @throws ParseException
* if the input (ignoring the "%" character) can't be parsed as an int value
*/
public static int parseIntPercentage(final String s) throws ParseException
{
try
{
final String trimmedInput = s.trim();
return parseInt(trimmedInput.endsWith("%") ? trimmedInput.substring(0, trimmedInput.length() - 1) : trimmedInput);
}
catch (ParseException e)
{
throw new ParseException(String.format("Failed to parse '%s' as int percentage value.", s), 0);
}
}

/**
* <p>
* Parses the given String as a relative (e.g. "-10" or "+10") or an absolute value (e.g. "10") and returns it. Use
Expand Down
Loading