Skip to content

Commit

Permalink
7042: Bring back summary screen for Statistics on Object Allocation o…
Browse files Browse the repository at this point in the history
…utside TLAB.

Reviewed-by: aptmac, hirt
  • Loading branch information
Suchita Chaturvedi committed Jul 5, 2021
1 parent e838a74 commit 81344ce
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,10 @@ public class Messages extends NLS {
public static String TlabPage_PAGE_NAME;
public static String TlabPage_THREADS_TAB_NAME;
public static String TlabPage_METHODS_TAB_NAME;
public static String TlabPage_CLASS_TAB_NAME;
public static String TlabPage_SUMMARY_TAB_NAME;
public static String TlabPage_SUMMARY_TAB_INSIDE_ALLOCATION;
public static String TlabPage_SUMMARY_TAB_OUTSIDE_ALLOCATION;
public static String TlabPage_ROW_TLAB_ALLOCATIONS;
public static String TlabPage_ROW_TLAB_ALLOCATIONS_DESC;
public static String TlabPage_SELECTED_ONE;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2021 Oracle and/or its affiliates. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -41,9 +41,11 @@
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.Form;
import org.eclipse.ui.forms.widgets.FormToolkit;

import org.eclipse.ui.forms.widgets.Section;
import org.openjdk.jmc.common.IState;
import org.openjdk.jmc.common.IWritableState;
import org.openjdk.jmc.common.item.IAttribute;
Expand All @@ -69,15 +71,18 @@
import org.openjdk.jmc.flightrecorder.ui.common.DataPageToolkit;
import org.openjdk.jmc.flightrecorder.ui.common.FlavorSelector.FlavorSelectorState;
import org.openjdk.jmc.flightrecorder.ui.common.ImageConstants;
import org.openjdk.jmc.flightrecorder.ui.common.ItemAggregateViewer;
import org.openjdk.jmc.flightrecorder.ui.common.ItemHistogram;
import org.openjdk.jmc.flightrecorder.ui.common.ItemHistogram.HistogramSelection;
import org.openjdk.jmc.flightrecorder.ui.common.ItemHistogram.ItemHistogramBuilder;
import org.openjdk.jmc.flightrecorder.ui.common.ItemRow;
import org.openjdk.jmc.flightrecorder.ui.messages.internal.Messages;
import org.openjdk.jmc.ui.accessibility.SimpleTraverseListener;
import org.openjdk.jmc.ui.charts.AWTChartToolkit;
import org.openjdk.jmc.ui.charts.IXDataRenderer;
import org.openjdk.jmc.ui.charts.XYDataRenderer;
import org.openjdk.jmc.ui.column.ColumnManager.SelectionState;
import org.openjdk.jmc.ui.misc.CompositeToolkit;
import org.openjdk.jmc.ui.column.TableSettings;

public class TlabPage extends AbstractDataPage {
Expand Down Expand Up @@ -136,11 +141,61 @@ public IDisplayablePage createPage(IPageDefinition dpd, StreamModel items, IPage
Messages.TlabPage_OUTSIDE_TLAB_SUM_PERCENTAGE, Messages.TlabPage_OUTSIDE_TLAB_SUM_PERCENTAGE_DESC);
}

private class TlabSummaryUI implements IPageUI {

protected Form form;

TlabSummaryUI(Composite parent, FormToolkit toolkit, IPageContainer pageContainer, IState state) {
display(parent, toolkit, pageContainer, state);
}

public void display(Composite parent, FormToolkit toolkit, IPageContainer pageContainer, IState state) {
form = DataPageToolkit.createForm(parent, toolkit, getName(), getIcon());
SashForm container = new SashForm(form.getBody(), SWT.HORIZONTAL);
container.addTraverseListener(new SimpleTraverseListener());

Section insideSummarySection = CompositeToolkit.createSection(container, toolkit,
Messages.TlabPage_SUMMARY_TAB_INSIDE_ALLOCATION);
ItemAggregateViewer insideSummary = new ItemAggregateViewer(insideSummarySection, toolkit);
insideSummary.addAggregate(JdkAggregators.INSIDE_TLAB_COUNT);
insideSummary.addAggregate(JdkAggregators.ALLOC_INSIDE_TLAB_MAX);
insideSummary.addAggregate(JdkAggregators.ALLOC_INSIDE_TLAB_MIN);
insideSummary.addAggregate(JdkAggregators.ALLOC_TLAB_AVG);
insideSummary.addAggregate(JdkAggregators.ALLOC_INSIDE_TLAB_SUM);
insideSummarySection.setClient(insideSummary.getControl());

Section outsideSummarySection = CompositeToolkit.createSection(container, toolkit,
Messages.TlabPage_SUMMARY_TAB_OUTSIDE_ALLOCATION);
ItemAggregateViewer outsideSummary = new ItemAggregateViewer(outsideSummarySection, toolkit);
outsideSummary.addAggregate(JdkAggregators.OUTSIDE_TLAB_COUNT);
outsideSummary.addAggregate(JdkAggregators.ALLOC_OUTSIDE_TLAB_MAX);
outsideSummary.addAggregate(JdkAggregators.ALLOC_OUTSIDE_TLAB_MIN);
outsideSummary.addAggregate(JdkAggregators.ALLOC_OUTSIDE_TLAB_AVG);
outsideSummary.addAggregate(JdkAggregators.ALLOC_OUTSIDE_TLAB_SUM);
outsideSummarySection.setClient(outsideSummary.getControl());

insideSummary.setValues(getDataSource().getItems());
outsideSummary.setValues(getDataSource().getItems());

addResultActions(form);
}

public Form getComponent() {
return this.form;
}

@Override
public void saveTo(IWritableState state) {
}
}

private class TlabUI implements IPageUI {

private CTabFolder tabFolder;
private TlabChartTable threadsCT;
private TlabChartTable methodsCT;
private TlabChartTable classCT;
private TlabSummaryUI summaryCT;

private int tabFolderIndex = 0;

Expand All @@ -153,14 +208,21 @@ public TlabUI(Composite parent, FormToolkit toolkit, IPageContainer editor, ISta
methodsCT = new TlabChartTable(tabFolder, toolkit, editor, state, JdkAttributes.STACK_TRACE_TOP_METHOD);
DataPageToolkit.addTabItem(tabFolder, methodsCT.getComponent(), Messages.TlabPage_METHODS_TAB_NAME);

classCT = new TlabChartTable(tabFolder, toolkit, editor, state, JdkAttributes.ALLOCATION_CLASS);
DataPageToolkit.addTabItem(tabFolder, classCT.getComponent(), Messages.TlabPage_CLASS_TAB_NAME);

summaryCT = new TlabSummaryUI(tabFolder, toolkit, editor, state);
DataPageToolkit.addTabItem(tabFolder, summaryCT.getComponent(), Messages.TlabPage_SUMMARY_TAB_NAME);

tabFolder.setSelection(tabFolderIndex);
}

@Override
public void saveTo(IWritableState state) {
threadsCT.saveTo(state);
methodsCT.saveTo(state);

classCT.saveTo(state);
summaryCT.saveTo(state);
this.saveToLocal();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,10 @@ ThreadsPage_TABLE_POPUP_TITLE=Thread Details
TlabPage_PAGE_NAME=TLAB Allocations
TlabPage_THREADS_TAB_NAME=By Threads
TlabPage_METHODS_TAB_NAME=By Top Methods
TlabPage_CLASS_TAB_NAME=By Class
TlabPage_SUMMARY_TAB_NAME=Summary
TlabPage_SUMMARY_TAB_INSIDE_ALLOCATION=Thread Local Allocation Buffer (TLAB) Statistics
TlabPage_SUMMARY_TAB_OUTSIDE_ALLOCATION=Statistics for Object Allocations (Outside TLABs)
TlabPage_ROW_TLAB_ALLOCATIONS=TLAB Allocations
TlabPage_ROW_TLAB_ALLOCATIONS_DESC=Data generated from allocation samples. The samples are collected either when acquiring a new thread local allocation buffer (TLAB) or when allocating outside of such buffers.
TlabPage_SELECTED_ONE=1 item
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ public final class JdkAggregators {
public static final IAggregator<Boolean, ?> USES_TLABS = or(GC_CONF_TLAB, JdkAttributes.USES_TLABS);
public static final IAggregator<IQuantity, ?> TLAB_MIN_SIZE = min(JdkAttributes.TLAB_MIN_SIZE.getName(), null,
GC_CONF_TLAB, JdkAttributes.TLAB_MIN_SIZE);
public static final IAggregator<IQuantity, ?> TLAB_MAX_SIZE = max(JdkAttributes.TLAB_MAX_SIZE.getName(), null,
GC_CONF_TLAB, JdkAttributes.TLAB_MAX_SIZE);
public static final IAggregator<IQuantity, ?> TLAB_REFILL_WASTE_LIMIT_MIN = min(TLAB_REFILL_WASTE_LIMIT.getName(),
null, GC_CONF_TLAB, TLAB_REFILL_WASTE_LIMIT);
// Other
Expand Down Expand Up @@ -323,10 +325,29 @@ public final class JdkAggregators {
Messages.getString(Messages.AGGR_ALLOC_INSIDE_TLAB_AVG),
Messages.getString(Messages.AGGR_ALLOC_INSIDE_TLAB_AVG_DESC), JdkTypeIDs.ALLOC_INSIDE_TLAB,
JdkAttributes.ALLOCATION_SIZE);
public static final IAggregator<IQuantity, ?> ALLOC_TLAB_AVG = Aggregators.avg(
Messages.getString(Messages.AGGR_ALLOC_TLAB_AVG), Messages.getString(Messages.AGGR_ALLOC_TLAB_AVG_DESC),
JdkTypeIDs.ALLOC_INSIDE_TLAB, JdkAttributes.TLAB_SIZE);
public static final IAggregator<IQuantity, ?> ALLOC_OUTSIDE_TLAB_AVG = Aggregators.avg(
Messages.getString(Messages.AGGR_ALLOC_OUTSIDE_TLAB_AVG),
Messages.getString(Messages.AGGR_ALLOC_OUTSIDE_TLAB_AVG_DESC), JdkTypeIDs.ALLOC_OUTSIDE_TLAB,
JdkAttributes.ALLOCATION_SIZE);
public static final IAggregator<IQuantity, ?> ALLOC_INSIDE_TLAB_MAX = Aggregators.max(
Messages.getString(Messages.AGGR_ALLOC_INSIDE_TLAB_MAX),
Messages.getString(Messages.AGGR_ALLOC_INSIDE_TLAB_MAX_DESC), JdkTypeIDs.ALLOC_INSIDE_TLAB,
JdkAttributes.TLAB_SIZE);
public static final IAggregator<IQuantity, ?> ALLOC_OUTSIDE_TLAB_MAX = Aggregators.max(
Messages.getString(Messages.AGGR_ALLOC_OUTSIDE_TLAB_MAX),
Messages.getString(Messages.AGGR_ALLOC_OUTSIDE_TLAB_MAX_DESC), JdkTypeIDs.ALLOC_OUTSIDE_TLAB,
JdkAttributes.ALLOCATION_SIZE);
public static final IAggregator<IQuantity, ?> ALLOC_INSIDE_TLAB_MIN = Aggregators.min(
Messages.getString(Messages.AGGR_ALLOC_INSIDE_TLAB_MIN),
Messages.getString(Messages.AGGR_ALLOC_INSIDE_TLAB_MIN_DESC), JdkTypeIDs.ALLOC_INSIDE_TLAB,
JdkAttributes.TLAB_SIZE);
public static final IAggregator<IQuantity, ?> ALLOC_OUTSIDE_TLAB_MIN = Aggregators.min(
Messages.getString(Messages.AGGR_ALLOC_OUTSIDE_TLAB_MIN),
Messages.getString(Messages.AGGR_ALLOC_OUTSIDE_TLAB_MIN_DESC), JdkTypeIDs.ALLOC_OUTSIDE_TLAB,
JdkAttributes.ALLOCATION_SIZE);
public static final IAggregator<IQuantity, ?> ALLOC_INSIDE_TLAB_SUM = Aggregators.sum(
Messages.getString(Messages.AGGR_ALLOC_INSIDE_TLAB_SUM),
Messages.getString(Messages.AGGR_ALLOC_INSIDE_TLAB_SUM_DESC), JdkTypeIDs.ALLOC_INSIDE_TLAB,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,8 @@ public String getMember(U i) {
Messages.getString(Messages.ATTR_USES_TLABS_DESC), FLAG);
public static final IAttribute<IQuantity> TLAB_MIN_SIZE = attr("minTLABSize", //$NON-NLS-1$
Messages.getString(Messages.ATTR_TLAB_MIN_SIZE), MEMORY);
public static final IAttribute<IQuantity> TLAB_MAX_SIZE = attr("maxTLABSize", //$NON-NLS-1$
Messages.getString(Messages.ATTR_TLAB_MAX_SIZE), MEMORY);
public static final IAttribute<IQuantity> TLAB_REFILL_WASTE_LIMIT = attr("tlabRefillWasteLimit", //$NON-NLS-1$
Messages.getString(Messages.ATTR_TLAB_REFILL_WASTE_LIMIT), MEMORY);
public static final IAttribute<IQuantity> HEAP_TOTAL = attr("totalSize", //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,24 @@ public class Messages {
public static final String AGGR_ALLOCATION_TOTAL_DESC = "AGGR_ALLOCATION_TOTAL_DESC"; //$NON-NLS-1$
public static final String AGGR_ALLOC_INSIDE_TLAB_AVG = "AGGR_ALLOC_INSIDE_TLAB_AVG"; //$NON-NLS-1$
public static final String AGGR_ALLOC_INSIDE_TLAB_AVG_DESC = "AGGR_ALLOC_INSIDE_TLAB_AVG_DESC"; //$NON-NLS-1$
public static final String AGGR_ALLOC_TLAB_AVG = "AGGR_ALLOC_TLAB_AVG"; //$NON-NLS-1$
public static final String AGGR_ALLOC_TLAB_AVG_DESC = "AGGR_ALLOC_TLAB_AVG_DESC"; //$NON-NLS-1$
public static final String AGGR_ALLOC_TLAB_DURATION = "AGGR_ALLOC_TLAB_DURATION"; //$NON-NLS-1$
public static final String AGGR_ALLOC_TLAB_DURATION_DESC = "AGGR_ALLOC_TLAB_DURATION_DESC"; //$NON-NLS-1$
public static final String AGGR_ALLOC_TLAB_OUTSIDE_DURATION = "AGGR_ALLOC_TLAB_OUTSIDE_DURATION"; //$NON-NLS-1$
public static final String AGGR_ALLOC_TLAB_OUTSIDE_DURATION_DESC = "AGGR_ALLOC_TLAB_OUTSIDE_DURATION_DESC"; //$NON-NLS-1$
public static final String AGGR_ALLOC_INSIDE_TLAB_MAX = "AGGR_ALLOC_INSIDE_TLAB_MAX"; //$NON-NLS-1$
public static final String AGGR_ALLOC_INSIDE_TLAB_MAX_DESC = "AGGR_ALLOC_INSIDE_TLAB_MAX_DESC"; //$NON-NLS-1$
public static final String AGGR_ALLOC_INSIDE_TLAB_MIN = "AGGR_ALLOC_INSIDE_TLAB_MIN"; //$NON-NLS-1$
public static final String AGGR_ALLOC_INSIDE_TLAB_MIN_DESC = "AGGR_ALLOC_INSIDE_TLAB_MIN_DESC"; //$NON-NLS-1$
public static final String AGGR_ALLOC_INSIDE_TLAB_SUM = "AGGR_ALLOC_INSIDE_TLAB_SUM"; //$NON-NLS-1$
public static final String AGGR_ALLOC_INSIDE_TLAB_SUM_DESC = "AGGR_ALLOC_INSIDE_TLAB_SUM_DESC"; //$NON-NLS-1$
public static final String AGGR_ALLOC_OUTSIDE_TLAB_AVG = "AGGR_ALLOC_OUTSIDE_TLAB_AVG"; //$NON-NLS-1$
public static final String AGGR_ALLOC_OUTSIDE_TLAB_AVG_DESC = "AGGR_ALLOC_OUTSIDE_TLAB_AVG_DESC"; //$NON-NLS-1$
public static final String AGGR_ALLOC_OUTSIDE_TLAB_MAX = "AGGR_ALLOC_OUTSIDE_TLAB_MAX"; //$NON-NLS-1$
public static final String AGGR_ALLOC_OUTSIDE_TLAB_MAX_DESC = "AGGR_ALLOC_OUTSIDE_TLAB_MAX_DESC"; //$NON-NLS-1$
public static final String AGGR_ALLOC_OUTSIDE_TLAB_MIN = "AGGR_ALLOC_OUTSIDE_TLAB_MIN"; //$NON-NLS-1$
public static final String AGGR_ALLOC_OUTSIDE_TLAB_MIN_DESC = "AGGR_ALLOC_OUTSIDE_TLAB_MIN_DESC"; //$NON-NLS-1$
public static final String AGGR_ALLOC_OUTSIDE_TLAB_SUM = "AGGR_ALLOC_OUTSIDE_TLAB_SUM"; //$NON-NLS-1$
public static final String AGGR_ALLOC_OUTSIDE_TLAB_SUM_DESC = "AGGR_ALLOC_OUTSIDE_TLAB_SUM_DESC"; //$NON-NLS-1$
public static final String AGGR_AVG_BLOCKED_TIME = "AGGR_AVG_BLOCKED_TIME"; //$NON-NLS-1$
Expand Down Expand Up @@ -453,6 +467,7 @@ public class Messages {
public static final String ATTR_TENURING_THRESHOLD_MAXIMUM_DESC = "ATTR_TENURING_THRESHOLD_MAXIMUM_DESC"; //$NON-NLS-1$
public static final String ATTR_THREAD_DUMP_RESULT = "ATTR_THREAD_DUMP_RESULT"; //$NON-NLS-1$
public static final String ATTR_TLAB_MIN_SIZE = "ATTR_TLAB_MIN_SIZE"; //$NON-NLS-1$
public static final String ATTR_TLAB_MAX_SIZE = "ATTR_TLAB_MAX_SIZE"; //$NON-NLS-1$
public static final String ATTR_TLAB_REFILL_WASTE_LIMIT = "ATTR_TLAB_REFILL_WASTE_LIMIT"; //$NON-NLS-1$
public static final String ATTR_TLAB_SIZE = "ATTR_TLAB_SIZE"; //$NON-NLS-1$
public static final String ATTR_TOP_ADDRESS = "ATTR_TOP_ADDRESS"; //$NON-NLS-1$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ ATTR_TENURING_THRESHOLD_MAXIMUM_DESC=Upper limit for the age of how old objects
ATTR_USES_TLABS=TLABs Used
ATTR_USES_TLABS_DESC=If Thread Local Allocation Buffers (TLABs) are in use
ATTR_TLAB_MIN_SIZE=Minimum TLAB Size
ATTR_TLAB_MAX_SIZE=Maximum TLAB Size
ATTR_TLAB_REFILL_WASTE_LIMIT=TLAB Refill Waste Limit
ATTR_HEAP_TOTAL=Total Size
ATTR_HEAP_USED=Used Heap
Expand Down Expand Up @@ -363,7 +364,7 @@ AGGR_LAST_ATTRIBUTE_DESC=The last value of {0} encountered
AGGR_USING_COMPRESSED_OOPS=Using Compressed Oops
AGGR_OUTSIDE_TLAB_COUNT=Outside TLAB Count
AGGR_OUTSIDE_TLAB_COUNT_DESC=Amount of allocations that occurred outside TLABs
AGGR_INSIDE_TLAB_COUNT=New TLAB Count
AGGR_INSIDE_TLAB_COUNT=TLAB Count
AGGR_INSIDE_TLAB_COUNT_DESC=Amount of allocations that created new TLABs
AGGR_FILE_WRITE_SIZE=Bytes Written
AGGR_FILE_WRITE_SIZE_DESC=The total amount written to file
Expand Down Expand Up @@ -421,6 +422,16 @@ AGGR_ALLOC_INSIDE_TLAB_AVG=Avg Alloc in TLABs
AGGR_ALLOC_INSIDE_TLAB_AVG_DESC=An estimate of the average size of allocations inside TLABs
AGGR_ALLOC_OUTSIDE_TLAB_AVG=Avg Alloc Outside TLABs
AGGR_ALLOC_OUTSIDE_TLAB_AVG_DESC=The average size of allocations outside TLABs
AGGR_ALLOC_TLAB_AVG=Average TLAB Size
AGGR_ALLOC_TLAB_AVG_DESC=The average size of TLABs
AGGR_ALLOC_INSIDE_TLAB_MAX=Maximum TLAB Size
AGGR_ALLOC_INSIDE_TLAB_MAX_DESC=An estimate of the maximum size of allocations inside TLABs
AGGR_ALLOC_OUTSIDE_TLAB_MAX=Maximum Object Size
AGGR_ALLOC_OUTSIDE_TLAB_MAX_DESC=The maximum size of allocations outside TLABs
AGGR_ALLOC_INSIDE_TLAB_MIN=Minimum TLAB Size
AGGR_ALLOC_INSIDE_TLAB_MIN_DESC=An estimate of the minimum size of allocations inside TLABs
AGGR_ALLOC_OUTSIDE_TLAB_MIN=Minimum Object Size
AGGR_ALLOC_OUTSIDE_TLAB_MIN_DESC=The minimum size of allocations outside TLABs
AGGR_ALLOC_INSIDE_TLAB_SUM=Alloc in TLABs
AGGR_ALLOC_INSIDE_TLAB_SUM_DESC=The estimated allocation size in TLABs
AGGR_ALLOC_OUTSIDE_TLAB_SUM=Alloc Outside TLABs
Expand Down

0 comments on commit 81344ce

Please sign in to comment.