Skip to content

Commit

Permalink
7096: Bring back Object statistics table for heap.
Browse files Browse the repository at this point in the history
Reviewed-by: hirt
  • Loading branch information
vpurnam authored and Suchita Chaturvedi committed Sep 1, 2022
1 parent f573b72 commit c03822b
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 2 deletions.
Expand Up @@ -264,6 +264,8 @@ public class Messages extends NLS {
public static String HeapPage_SELECTED_CLASSES;
public static String HeapPage_ALLOCATION_TOTAL_PERCENTAGE;
public static String HeapPage_ALLOCATION_TOTAL_PERCENTAGE_DESC;
public static String HeapPage_SIZE_TOTAL_PERCENTAGE;
public static String HeapPage_SIZE_TOTAL_PERCENTAGE_DESC;
public static String INFORMATION_COMPONENT_NOT_AVAILABLE;
public static String IO_PAGE_DURATIONS_DESCRIPTION;
public static String IO_PAGE_EVENT_LOG_DESCRIPTION;
Expand Down
Expand Up @@ -131,6 +131,10 @@ public IDisplayablePage createPage(IPageDefinition dpd, StreamModel items, IPage
private static final String INSIDE_TLAB_COL = "insideTlabSize"; //$NON-NLS-1$
private static final String OUTSIDE_TLAB_COL = "outsideTlabSize"; //$NON-NLS-1$
private static final String GC_PAUSE_ID = "gcPause"; //$NON-NLS-1$
private static final String AVG_SIZE_COL = "avgSize"; //$NON-NLS-1$
private static final String AVG_INSTANCES_COL = "avgInstances"; //$NON-NLS-1$
private static final String INSTANCES_INCREASE_COL = "instancesIncrease"; //$NON-NLS-1$
private static final String HEAP_PERCENT_COL = "heapPercent"; //$NON-NLS-1$

private class ObjectStatisticsUi extends ChartAndTableUI {

Expand Down Expand Up @@ -176,6 +180,11 @@ protected ItemHistogram buildHistogram(Composite parent, IState state, IAttribut
Messages.HeapPage_ALLOCATION_TOTAL_PERCENTAGE, Messages.HeapPage_ALLOCATION_TOTAL_PERCENTAGE_DESC);
HISTOGRAM.addColumn(INSIDE_TLAB_COL, JdkAggregators.ALLOC_INSIDE_TLAB_SUM);
HISTOGRAM.addColumn(OUTSIDE_TLAB_COL, JdkAggregators.ALLOC_OUTSIDE_TLAB_SUM);
HISTOGRAM.addColumn(AVG_INSTANCES_COL, JdkAggregators.OBJECT_COUNT_AVG_INSTANCES);
HISTOGRAM.addColumn(AVG_SIZE_COL, JdkAggregators.OBJECT_COUNT_AVG_SIZE);
HISTOGRAM.addColumn(INSTANCES_INCREASE_COL, ObjectStatisticsDataProvider.getIncreaseInstancesAggregator());
HISTOGRAM.addPercentageColumn(HEAP_PERCENT_COL, JdkAggregators.OBJECT_COUNT_TOTAL_SIZE,
Messages.HeapPage_SIZE_TOTAL_PERCENTAGE, Messages.HeapPage_SIZE_TOTAL_PERCENTAGE_DESC);
return HISTOGRAM.buildWithoutBorder(parent, classifier, getTableSettings(state));
}

Expand Down
Expand Up @@ -376,6 +376,8 @@ HeapPage_SELECTED_CLASS=1 class
HeapPage_SELECTED_CLASSES={0} classes
HeapPage_ALLOCATION_TOTAL_PERCENTAGE=Total Allocation (%)
HeapPage_ALLOCATION_TOTAL_PERCENTAGE_DESC=An estimate of the total allocation as a percentage of all allocations. This is not an exact value.
HeapPage_SIZE_TOTAL_PERCENTAGE=Percentage of Heap
HeapPage_SIZE_TOTAL_PERCENTAGE_DESC=Total size of all objects of the class as a percentage.

INFORMATION_COMPONENT_NOT_AVAILABLE=N/A

Expand Down
Expand Up @@ -102,8 +102,8 @@ public IncreaseCalculator combineWith(IncreaseCalculator other) {
}

/**
* @return an aggregator for the increase in the live set between the first and last garbage
* collections
* @return an aggregator for the increase in the live set size between the first and last
* garbage collections
*/
public static IAggregator<IQuantity, ?> getIncreaseAggregator() {
return new Aggregators.MergingAggregator<IQuantity, IncreaseCalculator>(
Expand All @@ -130,4 +130,35 @@ public IQuantity getValue(IncreaseCalculator consumer) {
}
};
}

/**
* @return an aggregator for the increase in the live set instances between the first and last
* garbage collections
*/
public static IAggregator<IQuantity, ?> getIncreaseInstancesAggregator() {
return new Aggregators.MergingAggregator<IQuantity, IncreaseCalculator>(
Messages.getString(Messages.ObjectStatisticsDataProvider_AGGR_LIVE_INSTANCES_INCREASE),
Messages.getString(Messages.ObjectStatisticsDataProvider_AGGR_LIVE_INSTANCES_INCREASE_DESC),
UnitLookup.MEMORY) {

@Override
public boolean acceptType(IType<IItem> type) {
return JdkTypeIDs.OBJECT_COUNT.equals(type.getIdentifier());
}

@Override
public IncreaseCalculator newItemConsumer(IType<IItem> type) {
IType<IItem> iType = type;
return new IncreaseCalculator(JfrAttributes.END_TIME.getAccessor(iType),
JdkAttributes.COUNT.getAccessor(iType));
}

@Override
public IQuantity getValue(IncreaseCalculator consumer) {
return consumer == null || consumer.maxX == null ? null : consumer.yAtMaxX.subtract(consumer.yAtMinX);

}
};
}

}
Expand Up @@ -457,6 +457,8 @@ public class Messages {
public static final String NumberOfGcThreadsRuleFactory_TEXT_INFO_LONG = "NumberOfGcThreadsRuleFactory_TEXT_INFO_LONG"; //$NON-NLS-1$
public static final String ObjectStatisticsDataProvider_AGGR_LIVE_SIZE_INCREASE = "ObjectStatisticsDataProvider_AGGR_LIVE_SIZE_INCREASE"; //$NON-NLS-1$
public static final String ObjectStatisticsDataProvider_AGGR_LIVE_SIZE_INCREASE_DESC = "ObjectStatisticsDataProvider_AGGR_LIVE_SIZE_INCREASE_DESC"; //$NON-NLS-1$
public static final String ObjectStatisticsDataProvider_AGGR_LIVE_INSTANCES_INCREASE = "ObjectStatisticsDataProvider_AGGR_LIVE_INSTANCES_INCREASE"; //$NON-NLS-1$
public static final String ObjectStatisticsDataProvider_AGGR_LIVE_INSTANCES_INCREASE_DESC = "ObjectStatisticsDataProvider_AGGR_LIVE_INSTANCES_INCREASE_DESC"; //$NON-NLS-1$
public static final String OptionsCheckRule_CONFIG_ACCEPTED_OPTIONS = "OptionsCheckRule_CONFIG_ACCEPTED_OPTIONS"; //$NON-NLS-1$
public static final String OptionsCheckRule_CONFIG_ACCEPTED_OPTIONS_LONG = "OptionsCheckRule_CONFIG_ACCEPTED_OPTIONS_LONG"; //$NON-NLS-1$
public static final String OptionsCheckRule_RULE_NAME = "OptionsCheckRule_RULE_NAME"; //$NON-NLS-1$
Expand Down
Expand Up @@ -498,6 +498,8 @@ NumberOfGcThreadsRuleFactory_TEXT_INFO=The runtime used {parallelGcThreads} GC t
NumberOfGcThreadsRuleFactory_TEXT_INFO_LONG=It's suboptimal to use more GC threads than available cores. Removing the '-XX:ParallelGCThreads' flag will allow the JVM to set the number of GC threads automatically.
ObjectStatisticsDataProvider_AGGR_LIVE_SIZE_INCREASE=Live Size Increase
ObjectStatisticsDataProvider_AGGR_LIVE_SIZE_INCREASE_DESC=The difference in total size from after the first garbage collection to after the last
ObjectStatisticsDataProvider_AGGR_LIVE_INSTANCES_INCREASE=Live Instances Increase
ObjectStatisticsDataProvider_AGGR_LIVE_INSTANCES_INCREASE_DESC=The difference in total instances from after the first garbage collection to after the last
OptionsCheckRule_CONFIG_ACCEPTED_OPTIONS=Accepted Options
OptionsCheckRule_CONFIG_ACCEPTED_OPTIONS_LONG=The -XX (non validated) JVM option names in this comma separated list will not be checked by the rule
OptionsCheckRule_RULE_NAME=Command Line Options Check
Expand Down
Expand Up @@ -204,9 +204,18 @@ public final class JdkAggregators {
public static final IAggregator<IQuantity, ?> OBJECT_COUNT_MAX_SIZE = max(
Messages.getString(Messages.AGGR_OBJECT_COUNT_MAX_SIZE),
Messages.getString(Messages.AGGR_OBJECT_COUNT_MAX_SIZE_DESC), OBJECT_COUNT, HEAP_TOTAL);
public static final IAggregator<IQuantity, ?> OBJECT_COUNT_AVG_SIZE = avg(
Messages.getString(Messages.AGGR_OBJECT_COUNT_AVG_SIZE),
Messages.getString(Messages.AGGR_OBJECT_COUNT_AVG_SIZE_DESC), OBJECT_COUNT, HEAP_TOTAL);
public static final IAggregator<IQuantity, ?> OBJECT_COUNT_TOTAL_SIZE = sum(
Messages.getString(Messages.AGGR_OBJECT_COUNT_TOTAL_SIZE),
Messages.getString(Messages.AGGR_OBJECT_COUNT_TOTAL_SIZE_DESC), OBJECT_COUNT, HEAP_TOTAL);
public static final IAggregator<IQuantity, ?> OBJECT_COUNT_MAX_INSTANCES = max(
Messages.getString(Messages.AGGR_OBJECT_COUNT_MAX_INSTANCES),
Messages.getString(Messages.AGGR_OBJECT_COUNT_MAX_INSTANCES_DESC), OBJECT_COUNT, JdkAttributes.COUNT);
public static final IAggregator<IQuantity, ?> OBJECT_COUNT_AVG_INSTANCES = avg(
Messages.getString(Messages.AGGR_OBJECT_COUNT_AVG_INSTANCES),
Messages.getString(Messages.AGGR_OBJECT_COUNT_AVG_INSTANCES_DESC), OBJECT_COUNT, JdkAttributes.COUNT);
public static final IAggregator<Boolean, ?> UNLOCK_EXPERIMENTAL_VM_OPTIONS = filter(
Messages.getString(Messages.AGGR_UNLOCK_EXPERIMENTAL_VM_OPTIONS), null,
or(BOOLEAN_FLAG, FLAG_VALUE_BOOLEAN), ItemFilters.equals(FLAG_NAME, "UnlockExperimentalVMOptions")); //$NON-NLS-1$
Expand Down
Expand Up @@ -152,8 +152,14 @@ public class Messages {
public static final String AGGR_OBJ_ALLOC_SUM_DESC = "AGGR_OBJ_ALLOC_SUM_DESC"; //$NON-NLS-1$
public static final String AGGR_OBJECT_COUNT_MAX_INSTANCES = "AGGR_OBJECT_COUNT_MAX_INSTANCES"; //$NON-NLS-1$
public static final String AGGR_OBJECT_COUNT_MAX_INSTANCES_DESC = "AGGR_OBJECT_COUNT_MAX_INSTANCES_DESC"; //$NON-NLS-1$
public static final String AGGR_OBJECT_COUNT_AVG_INSTANCES = "AGGR_OBJECT_COUNT_AVG_INSTANCES"; //$NON-NLS-1$
public static final String AGGR_OBJECT_COUNT_AVG_INSTANCES_DESC = "AGGR_OBJECT_COUNT_AVG_INSTANCES_DESC"; //$NON-NLS-1$
public static final String AGGR_OBJECT_COUNT_MAX_SIZE = "AGGR_OBJECT_COUNT_MAX_SIZE"; //$NON-NLS-1$
public static final String AGGR_OBJECT_COUNT_MAX_SIZE_DESC = "AGGR_OBJECT_COUNT_MAX_SIZE_DESC"; //$NON-NLS-1$
public static final String AGGR_OBJECT_COUNT_AVG_SIZE = "AGGR_OBJECT_COUNT_AVG_SIZE"; //$NON-NLS-1$
public static final String AGGR_OBJECT_COUNT_AVG_SIZE_DESC = "AGGR_OBJECT_COUNT_AVG_SIZE_DESC"; //$NON-NLS-1$
public static final String AGGR_OBJECT_COUNT_TOTAL_SIZE = "AGGR_OBJECT_COUNT_TOTAL_SIZE"; //$NON-NLS-1$
public static final String AGGR_OBJECT_COUNT_TOTAL_SIZE_DESC = "AGGR_OBJECT_COUNT_TOTAL_SIZE_DESC"; //$NON-NLS-1$
public static final String AGGR_OUTSIDE_TLAB_COUNT = "AGGR_OUTSIDE_TLAB_COUNT"; //$NON-NLS-1$
public static final String AGGR_OUTSIDE_TLAB_COUNT_DESC = "AGGR_OUTSIDE_TLAB_COUNT_DESC"; //$NON-NLS-1$
public static final String AGGR_SOCKET_READ_COUNT = "AGGR_SOCKET_READ_COUNT"; //$NON-NLS-1$
Expand Down
Expand Up @@ -352,8 +352,14 @@ AGGR_OBJ_ALLOC_SUM=Alloc Total
AGGR_OBJ_ALLOC_SUM_DESC=The estimated total of allocation size
AGGR_OBJECT_COUNT_MAX_SIZE=Max Live Size
AGGR_OBJECT_COUNT_MAX_SIZE_DESC=An estimate of the maximum size of all instances after garbage collection
AGGR_OBJECT_COUNT_AVG_SIZE=Avg Live Size
AGGR_OBJECT_COUNT_AVG_SIZE_DESC=An estimate of the average size of all instances after garbage collection
AGGR_OBJECT_COUNT_MAX_INSTANCES=Max Live Count
AGGR_OBJECT_COUNT_MAX_INSTANCES_DESC=An estimate of the maximum number of instances after garbage collection
AGGR_OBJECT_COUNT_AVG_INSTANCES=Avg Live Count
AGGR_OBJECT_COUNT_AVG_INSTANCES_DESC=An estimate of the average number of instances after garbage collection
AGGR_OBJECT_COUNT_TOTAL_SIZE=Total Size
AGGR_OBJECT_COUNT_TOTAL_SIZE_DESC=An estimate of the total size.
AGGR_UNLOCK_EXPERIMENTAL_VM_OPTIONS=Unlock Experimental VM Options
AGGR_IGNORE_UNRECOGNIZED_VM_OPTIONS=Ignore Unrecognized VM Options
AGGR_ITEM_COUNT=Event Count
Expand Down

0 comments on commit c03822b

Please sign in to comment.