Class StringDeduplicationRule
- java.lang.Object
-
- org.openjdk.jmc.flightrecorder.rules.AbstractRule
-
- org.openjdk.jmc.flightrecorder.rules.jdk.memory.StringDeduplicationRule
-
- All Implemented Interfaces:
IRule
public class StringDeduplicationRule extends AbstractRule
Intent of this rule is to find out if it would be worth enabling string deduplication. String deduplication is available together with the G1 GC, see JEP 192. Rule looks at how much memory is used by the char/byte arrays used internally in strings, it also check the heap usage.The rule can only give guidance, it is up to the user to measure changes memory consumption after enabling string deduplication. It can still be that the amount of memory used to hold metadata of the deduplicated strings is more than the saved heap space.
Rule uses the ObjectCount event if available, otherwise the TLAB events. Uncertainties in the calculations comes both from the statistical issues that the AllocationInNewTLAB event provides, and also from the fact that it is hard to know which of the char/byte arrays that actually are the internal string arrays. Looking at the allocation stack trace can help a bit, but allocations can be missed. If using the ObjectCount event, the statistics are better, but it is impossible to know which arrays to count.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
NEW_LINE
private static TypedPreference<java.lang.String>
STRING_ARRAY_ALLOCATION_FRAMES
private static TypedPreference<IQuantity>
STRING_ARRAY_ALLOCATION_RATIO_AND_HEAP_USAGE_LIMIT
private static TypedPreference<IQuantity>
STRING_ARRAY_LIVESET_RATIO_AND_HEAP_USAGE_LIMIT
private static IItemFilter
STRING_FILTER
-
Fields inherited from class org.openjdk.jmc.flightrecorder.rules.AbstractRule
evaluationTask
-
-
Constructor Summary
Constructors Constructor Description StringDeduplicationRule()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private IItemFilter
getAllocationFramesFilter(java.lang.String allocationFramesString)
private Result
getAllocationRatioResult(IItemCollection items, java.lang.String stringInternalArrayType, IItemFilter stringInternalArrayTypeFilter, IQuantity stringAllocationRatioLimit, java.lang.String allocationFramesString, java.lang.String heapInfo, double heapUsedRatio, java.lang.String extraGcInfo)
private Result
getLivesetRatioResult(IItemCollection items, java.lang.String stringInternalArrayType, IItemFilter stringInternalArrayTypeFilter, IQuantity averageStringSize, IQuantity stringLivesetRatioAndHeapUsageLimit, java.lang.String objectCountEventType, java.lang.String heapInfo, double heapUsedRatio, java.lang.String extraGcInfo)
protected Result
getResult(IItemCollection items, IPreferenceValueProvider vp)
-
Methods inherited from class org.openjdk.jmc.flightrecorder.rules.AbstractRule
evaluate, getConfigurationAttributes, getId, getName, getTopic
-
-
-
-
Field Detail
-
NEW_LINE
private static final java.lang.String NEW_LINE
- See Also:
- Constant Field Values
-
STRING_FILTER
private static final IItemFilter STRING_FILTER
-
STRING_ARRAY_ALLOCATION_FRAMES
private static final TypedPreference<java.lang.String> STRING_ARRAY_ALLOCATION_FRAMES
-
STRING_ARRAY_LIVESET_RATIO_AND_HEAP_USAGE_LIMIT
private static final TypedPreference<IQuantity> STRING_ARRAY_LIVESET_RATIO_AND_HEAP_USAGE_LIMIT
-
STRING_ARRAY_ALLOCATION_RATIO_AND_HEAP_USAGE_LIMIT
private static final TypedPreference<IQuantity> STRING_ARRAY_ALLOCATION_RATIO_AND_HEAP_USAGE_LIMIT
-
-
Method Detail
-
getResult
protected Result getResult(IItemCollection items, IPreferenceValueProvider vp)
- Specified by:
getResult
in classAbstractRule
-
getLivesetRatioResult
private Result getLivesetRatioResult(IItemCollection items, java.lang.String stringInternalArrayType, IItemFilter stringInternalArrayTypeFilter, IQuantity averageStringSize, IQuantity stringLivesetRatioAndHeapUsageLimit, java.lang.String objectCountEventType, java.lang.String heapInfo, double heapUsedRatio, java.lang.String extraGcInfo)
-
getAllocationRatioResult
private Result getAllocationRatioResult(IItemCollection items, java.lang.String stringInternalArrayType, IItemFilter stringInternalArrayTypeFilter, IQuantity stringAllocationRatioLimit, java.lang.String allocationFramesString, java.lang.String heapInfo, double heapUsedRatio, java.lang.String extraGcInfo)
-
getAllocationFramesFilter
private IItemFilter getAllocationFramesFilter(java.lang.String allocationFramesString)
-
-