< prev index next >

application/org.openjdk.jmc.flightrecorder.ui/src/main/java/org/openjdk/jmc/flightrecorder/ui/pages/SocketIOPage.java

Print this page

        

*** 67,76 **** --- 67,77 ---- import org.openjdk.jmc.common.item.IItemCollection; import org.openjdk.jmc.common.item.IItemFilter; import org.openjdk.jmc.common.item.ItemFilters; import org.openjdk.jmc.common.unit.IQuantity; import org.openjdk.jmc.common.unit.IRange; + import org.openjdk.jmc.common.unit.QuantitiesToolkit; import org.openjdk.jmc.common.unit.UnitLookup; import org.openjdk.jmc.common.util.ColorToolkit; import org.openjdk.jmc.common.util.StateToolkit; import org.openjdk.jmc.flightrecorder.JfrAttributes; import org.openjdk.jmc.flightrecorder.jdk.JdkAggregators;
*** 199,208 **** --- 200,210 ---- private static final String SECONDARY_SOCKETIO_TABLE_ELEMENT = "secondarySocketTable"; //$NON-NLS-1$ private static final String HISTGRAM_TYPE = "histogramType"; //$NON-NLS-1$ private final ChartCanvas timelineCanvas; private final ChartCanvas durationCanvas; + private final ChartCanvas sizeCanvas; private final ItemList itemList; private final SashForm sash; private final IPageContainer pageContainer; private final Composite histogramParent;
*** 216,225 **** --- 218,228 ---- private FilterComponent eventFilter; private IRange<IQuantity> timeRange; private IItemCollection selectionItems; private XYChart timelineChart; private XYChart durationChart; + private XYChart sizeChart; private CTabFolder tabFolder; private FlavorSelector flavorSelector; IOPageUi(Composite parent, FormToolkit toolkit, IPageContainer pageContainer, IState state) { this.pageContainer = pageContainer;
*** 262,292 **** DataPageToolkit.setChart(durationCanvas, durationChart, JfrAttributes.DURATION, pageContainer::showSelection); SelectionStoreActionToolkit.addSelectionStoreActions(pageContainer.getSelectionStore(), durationChart, JfrAttributes.DURATION, Messages.SocketIOPage_DURATION_SELECTION, durationCanvas.getContextMenu()); CTabItem t3 = new CTabItem(tabFolder, SWT.NONE); ! t3.setToolTipText(Messages.IO_PAGE_EVENT_LOG_DESCRIPTION); itemList = LIST.buildWithoutBorder(tabFolder, getTableSettings(state.getChild(LIST_ELEMENT))); MCContextMenuManager itemListMm = MCContextMenuManager .create(itemList.getManager().getViewer().getControl()); ColumnMenusFactory.addDefaultMenus(itemList.getManager(), itemListMm); SelectionStoreActionToolkit.addSelectionStoreActions(pageContainer.getSelectionStore(), itemList, Messages.SocketIOPage_LOG_SELECTION, itemListMm); itemList.getManager().getViewer().addSelectionChangedListener( e -> pageContainer.showSelection(ItemCollectionToolkit.build(itemList.getSelection().get()))); ! t3.setText(Messages.PAGES_EVENT_LOG); eventFilter = FilterComponent.createFilterComponent(itemList, itemListFilter, getDataSource().getItems().apply(TABLE_ITEMS), pageContainer.getSelectionStore()::getSelections, this::onEventFilterChange); itemListMm.add(eventFilter.getShowFilterAction()); itemListMm.add(eventFilter.getShowSearchAction()); ! t3.setControl(eventFilter.getComponent()); eventFilter.loadState(state.getChild(EVENT_FILTER)); onEventFilterChange(itemListFilter); itemList.getManager().setSelectionState(itemListSelection); tabFolder.setSelection(tabFolderIndex); PersistableSashForm.loadState(sash, state.getChild(SASH_ELEMENT)); flavorSelector = FlavorSelector.itemsWithTimerange(form, TABLE_ITEMS, getDataSource().getItems(), --- 265,316 ---- DataPageToolkit.setChart(durationCanvas, durationChart, JfrAttributes.DURATION, pageContainer::showSelection); SelectionStoreActionToolkit.addSelectionStoreActions(pageContainer.getSelectionStore(), durationChart, JfrAttributes.DURATION, Messages.SocketIOPage_DURATION_SELECTION, durationCanvas.getContextMenu()); + IQuantity sizeMax = QuantitiesToolkit.maxPresent(socketItems.getAggregate(JdkAggregators.SOCKET_READ_LARGEST), + socketItems.getAggregate(JdkAggregators.SOCKET_WRITE_LARGEST)); + // FIXME: Workaround to make max value included + sizeMax = sizeMax == null ? UnitLookup.BYTE.quantity(64): sizeMax.add(UnitLookup.BYTE.quantity(64)); + sizeChart = new XYChart(UnitLookup.BYTE.quantity(0), sizeMax, RendererToolkit.empty(), 180); + sizeChart.setVisibleRange(sizeRange.getStart(), sizeMax); + sizeChart.addVisibleRangeListener(range -> sizeRange = range); + CTabItem t3 = new CTabItem(tabFolder, SWT.NONE); ! t3.setToolTipText(Messages.IO_PAGE_SIZE_DESCRIPTION); ! sizeCanvas = new ChartCanvas(tabFolder); ! t3.setText(Messages.PAGES_SIZE); ! t3.setControl(sizeCanvas); ! DataPageToolkit.createChartTooltip(sizeCanvas); ! DataPageToolkit.setChart(sizeCanvas, sizeChart, JdkAttributes.IO_SIZE, ! pageContainer::showSelection); ! SelectionStoreActionToolkit.addSelectionStoreActions(pageContainer.getSelectionStore(), sizeChart, ! JdkAttributes.IO_SIZE, Messages.SocketIOPage_SIZE_SELECTION, sizeCanvas.getContextMenu()); ! ! CTabItem t4 = new CTabItem(tabFolder, SWT.NONE); ! t4.setToolTipText(Messages.IO_PAGE_EVENT_LOG_DESCRIPTION); itemList = LIST.buildWithoutBorder(tabFolder, getTableSettings(state.getChild(LIST_ELEMENT))); MCContextMenuManager itemListMm = MCContextMenuManager .create(itemList.getManager().getViewer().getControl()); ColumnMenusFactory.addDefaultMenus(itemList.getManager(), itemListMm); SelectionStoreActionToolkit.addSelectionStoreActions(pageContainer.getSelectionStore(), itemList, Messages.SocketIOPage_LOG_SELECTION, itemListMm); itemList.getManager().getViewer().addSelectionChangedListener( e -> pageContainer.showSelection(ItemCollectionToolkit.build(itemList.getSelection().get()))); ! t4.setText(Messages.PAGES_EVENT_LOG); eventFilter = FilterComponent.createFilterComponent(itemList, itemListFilter, getDataSource().getItems().apply(TABLE_ITEMS), pageContainer.getSelectionStore()::getSelections, this::onEventFilterChange); itemListMm.add(eventFilter.getShowFilterAction()); itemListMm.add(eventFilter.getShowSearchAction()); ! t4.setControl(eventFilter.getComponent()); eventFilter.loadState(state.getChild(EVENT_FILTER)); onEventFilterChange(itemListFilter); itemList.getManager().setSelectionState(itemListSelection); + + tabFolder.setSelection(tabFolderIndex); PersistableSashForm.loadState(sash, state.getChild(SASH_ELEMENT)); flavorSelector = FlavorSelector.itemsWithTimerange(form, TABLE_ITEMS, getDataSource().getItems(),
*** 457,489 **** --- 481,523 ---- private void updateChartAndListDetails(IItemCollection selectedItems) { String hostCount = hostPortCount(); List<IXDataRenderer> timelineRows = new ArrayList<>(); List<IXDataRenderer> durationRows = new ArrayList<>(); + List<IXDataRenderer> sizeRows = new ArrayList<>(); + IItemCollection readItems = selectedItems.apply(JdkFilters.SOCKET_READ); if (readItems.hasItems()) { timelineRows.add(DataPageToolkit.buildSizeRow(Messages.SocketIOPage_ROW_SOCKET_READ + hostCount, JdkAggregators.SOCKET_READ_SIZE.getDescription(), readItems, JdkAggregators.SOCKET_READ_SIZE, READ_COLOR, SocketIOPage::getColor)); durationRows .add(DataPageToolkit.buildDurationHistogram(Messages.SocketIOPage_ROW_SOCKET_READ + hostCount, JdkAggregators.SOCKET_READ_COUNT.getDescription(), readItems, JdkAggregators.SOCKET_READ_COUNT, READ_COLOR)); + sizeRows.add(DataPageToolkit.buildSizeHistogram(Messages.SocketIOPage_ROW_SOCKET_READ + hostCount, + JdkAggregators.SOCKET_READ_COUNT.getDescription(), readItems, + JdkAggregators.SOCKET_READ_COUNT, READ_COLOR, JdkAttributes.IO_SOCKET_BYTES_READ)); } IItemCollection writeItems = selectedItems.apply(JdkFilters.SOCKET_WRITE); if (writeItems.hasItems()) { timelineRows.add(DataPageToolkit.buildSizeRow(Messages.SocketIOPage_ROW_SOCKET_WRITE + hostCount, JdkAggregators.SOCKET_WRITE_SIZE.getDescription(), writeItems, JdkAggregators.SOCKET_WRITE_SIZE, WRITE_COLOR, SocketIOPage::getColor)); durationRows .add(DataPageToolkit.buildDurationHistogram(Messages.SocketIOPage_ROW_SOCKET_WRITE + hostCount, JdkAggregators.SOCKET_WRITE_COUNT.getDescription(), writeItems, JdkAggregators.SOCKET_WRITE_COUNT, WRITE_COLOR)); + sizeRows.add(DataPageToolkit.buildSizeHistogram(Messages.SocketIOPage_ROW_SOCKET_WRITE + hostCount, + JdkAggregators.SOCKET_WRITE_COUNT.getDescription(), writeItems, + JdkAggregators.SOCKET_WRITE_COUNT, WRITE_COLOR, JdkAttributes.IO_SOCKET_BYTES_WRITTEN)); } if (timelineCanvas != null) { timelineCanvas.replaceRenderer(RendererToolkit.uniformRows(timelineRows)); durationCanvas.replaceRenderer(RendererToolkit.uniformRows(durationRows)); + sizeCanvas.replaceRenderer(RendererToolkit.uniformRows(sizeRows)); + itemList.show(selectedItems); pageContainer.showSelection(selectedItems); } }
*** 566,575 **** --- 600,610 ---- private Map<HistogramType, IItemFilter> primaryTableFilter; private Map<HistogramType, IItemFilter> secondaryTableFilter; private IItemFilter itemListFilter; private IRange<IQuantity> timelineRange; private IRange<IQuantity> durationRange; + private IRange<IQuantity> sizeRange; private int tabFolderIndex = 0; public FlavorSelectorState flavorSelectorState; public SocketIOPage(IPageDefinition dpd, StreamModel items, IPageContainer editor) { super(dpd, items, editor);
*** 577,586 **** --- 612,623 ---- secondaryTableSelection = new HashMap<>(); primaryTableFilter = new HashMap<>(); secondaryTableFilter = new HashMap<>(); timelineRange = editor.getRecordingRange(); durationRange = editor.getRecordingRange(); + sizeRange = DataPageToolkit.buildSizeRange(items.getItems(), true); + } @Override public IItemFilter getDefaultSelectionFilter() { return TABLE_ITEMS;
< prev index next >