From 0b9fd6f1d5c529aecc353d1f2bf0430d2cbbb194 Mon Sep 17 00:00:00 2001 From: Adel Belkhiri Date: Tue, 15 Oct 2024 11:59:37 -0400 Subject: [PATCH] dpdk: merging the ethdev packet throughput and packet rate analyses --- .../META-INF/MANIFEST.MF | 1 - .../plugin.xml | 16 +- .../core/analysis/DpdkEthdevEventLayout.java | 18 +- .../rate/analysis/DpdkEthdevRateAnalysis.java | 56 --- .../analysis/DpdkEthdevRateAttributes.java | 28 -- .../analysis/DpdkEthdevRateDataProvider.java | 375 ----------------- .../DpdkEthdevRateDataProviderFactory.java | 61 --- .../analysis/DpdkEthdevRateEventHandler.java | 129 ------ .../analysis/DpdkEthdevRateStateProvider.java | 79 ---- .../core/ethdev/rate/analysis/Messages.java | 37 -- .../ethdev/rate/analysis/messages.properties | 15 - .../ethdev/rate/analysis/package-info.java | 13 - ...tractDpdkEthdevThroughputDataProvider.java | 249 ++++++++++++ .../DpdkEthdevThroughputAnalysisModule.java | 14 +- .../DpdkEthdevThroughputAttributes.java | 14 +- .../DpdkEthdevThroughputBpsDataProvider.java | 196 +++++++++ .../DpdkEthdevThroughputBpsDataProvider3.java | 380 ------------------ ...thdevThroughputBpsDataProviderFactory.java | 26 +- .../DpdkEthdevThroughputEventHandler.java | 122 ++++-- .../DpdkEthdevThroughputPpsDataProvider.java | 319 ++++----------- ...thdevThroughputPpsDataProviderFactory.java | 22 +- .../DpdkEthdevThroughputStateProvider.java | 17 +- .../ethdev/throughput/analysis/Messages.java | 4 +- .../throughput/analysis/messages.properties | 5 +- .../throughput/analysis/package-info.java | 2 +- .../plugin.xml | 14 +- .../ui/ethdev/throughput/bps/Messages.java | 16 +- .../bps/NicQueueThroughputBpsView.java | 14 +- .../ethdev/throughput/bps/messages.properties | 10 +- .../ethdev/throughput/bps/package-info.java | 2 +- .../ui/ethdev/throughput/pps/Messages.java | 16 +- .../pps/NicQueueThroughputPpsView.java | 22 +- .../ethdev/throughput/pps/messages.properties | 10 +- .../ethdev/throughput/pps/package-info.java | 2 +- 34 files changed, 719 insertions(+), 1585 deletions(-) delete mode 100644 analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/DpdkEthdevRateAnalysis.java delete mode 100644 analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/DpdkEthdevRateAttributes.java delete mode 100644 analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/DpdkEthdevRateDataProvider.java delete mode 100644 analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/DpdkEthdevRateDataProviderFactory.java delete mode 100644 analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/DpdkEthdevRateEventHandler.java delete mode 100644 analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/DpdkEthdevRateStateProvider.java delete mode 100644 analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/Messages.java delete mode 100644 analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/messages.properties delete mode 100644 analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/package-info.java create mode 100644 analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/AbstractDpdkEthdevThroughputDataProvider.java create mode 100644 analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputBpsDataProvider.java delete mode 100644 analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputBpsDataProvider3.java diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/META-INF/MANIFEST.MF b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/META-INF/MANIFEST.MF index 3865ac92..3364eb8c 100644 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/META-INF/MANIFEST.MF +++ b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/META-INF/MANIFEST.MF @@ -19,7 +19,6 @@ Require-Bundle: org.eclipse.ui, org.eclipse.tracecompass.analysis.lami.core, com.google.guava Export-Package: org.eclipse.tracecompass.incubator.dpdk.core.trace, - org.eclipse.tracecompass.incubator.internal.dpdk.core.ethdev.rate.analysis, org.eclipse.tracecompass.incubator.internal.dpdk.core.ethdev.spin.analysis, org.eclipse.tracecompass.incubator.internal.dpdk.core.ethdev.throughput.analysis, org.eclipse.tracecompass.incubator.internal.dpdk.core.lcore.analysis;x-friends:="org.eclipse.tracecompass.incubator.dpdk.core.tests" diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/plugin.xml b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/plugin.xml index 6772e752..e55a4e71 100644 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/plugin.xml +++ b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/plugin.xml @@ -11,16 +11,6 @@ applies="true" class="org.eclipse.tracecompass.incubator.dpdk.core.trace.DpdkTrace"> - - - - - - diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/analysis/DpdkEthdevEventLayout.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/analysis/DpdkEthdevEventLayout.java index 5dbcb598..9e8b8a58 100644 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/analysis/DpdkEthdevEventLayout.java +++ b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/analysis/DpdkEthdevEventLayout.java @@ -44,9 +44,9 @@ public class DpdkEthdevEventLayout { /* Event names */ private static final String ETH_DEV_CONFIGURE = "lib.ethdev.configure"; //$NON-NLS-1$ - private static final String ETH_DEV_RXQ_BURST_EMPTY = "lib.ethdev.rx.burst.empty"; //$NON-NLS-1$ - private static final String ETH_DEV_RXQ_BURST_NON_EMPTY = "lib.ethdev.rx.burst.nonempty"; //$NON-NLS-1$ - private static final String ETH_DEV_TXQ_BURST = "lib.ethdev.tx.burst"; //$NON-NLS-1$ + private static final String ETH_DEV_RX_BURST_EMPTY = "lib.ethdev.rx.burst.empty"; //$NON-NLS-1$ + private static final String ETH_DEV_RX_BURST_NON_EMPTY = "lib.ethdev.rx.burst.nonempty"; //$NON-NLS-1$ + private static final String ETH_DEV_TX_BURST = "lib.ethdev.tx.burst"; //$NON-NLS-1$ private static final String PROFILE_ETH_DEV_RX_BURST = "lib.ethdev.rx.burst.extended"; //$NON-NLS-1$ private static final String PROFILE_ETH_DEV_TX_BURST = "lib.ethdev.tx.burst.extended"; //$NON-NLS-1$ @@ -82,8 +82,8 @@ public static String eventEthdevConfigure() { * * @return The event name */ - public static String eventEthdevRxqBurstEmpty() { - return ETH_DEV_RXQ_BURST_EMPTY; + public static String eventEthdevRxBurstEmpty() { + return ETH_DEV_RX_BURST_EMPTY; } /** @@ -91,8 +91,8 @@ public static String eventEthdevRxqBurstEmpty() { * * @return The event name */ - public static String eventEthdevRxqBurstNonEmpty() { - return ETH_DEV_RXQ_BURST_NON_EMPTY; + public static String eventEthdevRxBurstNonEmpty() { + return ETH_DEV_RX_BURST_NON_EMPTY; } /** @@ -100,8 +100,8 @@ public static String eventEthdevRxqBurstNonEmpty() { * * @return The event name */ - public static String eventEthdevTxqBurst() { - return ETH_DEV_TXQ_BURST; + public static String eventEthdevTxBurst() { + return ETH_DEV_TX_BURST; } /** diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/DpdkEthdevRateAnalysis.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/DpdkEthdevRateAnalysis.java deleted file mode 100644 index d1f1fa2d..00000000 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/DpdkEthdevRateAnalysis.java +++ /dev/null @@ -1,56 +0,0 @@ -/********************************************************************** - * Copyright (c) 2024 École Polytechnique de Montréal - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License 2.0 which - * accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - **********************************************************************/ -package org.eclipse.tracecompass.incubator.internal.dpdk.core.ethdev.rate.analysis; - -import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull; - -import java.util.Collections; - -import org.eclipse.tracecompass.incubator.dpdk.core.trace.DpdkTrace; -import org.eclipse.tracecompass.incubator.internal.dpdk.core.analysis.DpdkEthdevEventLayout; -import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement; -import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement.PriorityLevel; -import org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisEventRequirement; -import org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider; -import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule; -import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; -import com.google.common.collect.ImmutableList; - -/** - * This analysis calculates the speed at which packets are received or - * transmitted from Ethernet NICs queues. - * - * @author Adel Belkhiri - */ -public class DpdkEthdevRateAnalysis extends TmfStateSystemAnalysisModule { - - /** The ID of this analysis module */ - public static final String ID = "org.eclipse.tracecompass.incubator.dpdk.ethdev.rate.analysis"; //$NON-NLS-1$ - - private final TmfAbstractAnalysisRequirement REQUIREMENT = new TmfAnalysisEventRequirement(ImmutableList.of( - DpdkEthdevEventLayout.eventEthdevConfigure()), PriorityLevel.AT_LEAST_ONE); - - @Override - protected ITmfStateProvider createStateProvider() { - ITmfTrace trace = checkNotNull(getTrace()); - - if (trace instanceof DpdkTrace) { - return new DpdkEthdevRateStateProvider(trace, ID); - } - - throw new IllegalStateException(); - } - - @Override - public Iterable getAnalysisRequirements() { - return Collections.singleton(REQUIREMENT); - } -} diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/DpdkEthdevRateAttributes.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/DpdkEthdevRateAttributes.java deleted file mode 100644 index 45744f75..00000000 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/DpdkEthdevRateAttributes.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2024 École Polytechnique de Montréal - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License 2.0 which - * accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ - -package org.eclipse.tracecompass.incubator.internal.dpdk.core.ethdev.rate.analysis; - -/** - * This interface defines all the attribute names used in the state system. - * - * @author Adel Belkhiri - */ - -public interface DpdkEthdevRateAttributes { - - /** Root attributes for DPDK Ethdev NICs */ - String NICS = "NICs"; //$NON-NLS-1$ - /** Reception Queues */ - String RX_Q = "rx_qs"; //$NON-NLS-1$ - /** Transmission Queues */ - String TX_Q = "tx_qs"; //$NON-NLS-1$ -} diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/DpdkEthdevRateDataProvider.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/DpdkEthdevRateDataProvider.java deleted file mode 100644 index 13b5d0d7..00000000 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/DpdkEthdevRateDataProvider.java +++ /dev/null @@ -1,375 +0,0 @@ -/********************************************************************** - * Copyright (c) 2024 École Polytechnique de Montréal - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License 2.0 which - * accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - **********************************************************************/ - -package org.eclipse.tracecompass.incubator.internal.dpdk.core.ethdev.rate.analysis; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Objects; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.tracecompass.incubator.internal.dpdk.core.Activator; -import org.eclipse.tracecompass.incubator.internal.dpdk.core.analysis.DpdkEthdevEventLayout; -import org.eclipse.tracecompass.internal.analysis.os.linux.core.inputoutput.IODataPalette; -import org.eclipse.tracecompass.internal.tmf.core.model.filters.FetchParametersUtils; -import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem; -import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException; -import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException; -import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval; -import org.eclipse.tracecompass.tmf.core.dataprovider.DataType; -import org.eclipse.tracecompass.tmf.core.model.CommonStatusMessage; -import org.eclipse.tracecompass.tmf.core.model.IOutputStyleProvider; -import org.eclipse.tracecompass.tmf.core.model.OutputElementStyle; -import org.eclipse.tracecompass.tmf.core.model.OutputStyleModel; -import org.eclipse.tracecompass.tmf.core.model.StyleProperties; -import org.eclipse.tracecompass.tmf.core.model.YModel; -import org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter; -import org.eclipse.tracecompass.tmf.core.model.tree.TmfTreeDataModel; -import org.eclipse.tracecompass.tmf.core.model.tree.TmfTreeModel; -import org.eclipse.tracecompass.tmf.core.model.xy.AbstractTreeCommonXDataProvider; -import org.eclipse.tracecompass.tmf.core.model.xy.IYModel; -import org.eclipse.tracecompass.tmf.core.model.xy.TmfXYAxisDescription; -import org.eclipse.tracecompass.tmf.core.response.ITmfResponse; -import org.eclipse.tracecompass.tmf.core.response.TmfModelResponse; -import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; -import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils; -import org.eclipse.tracecompass.tmf.core.util.Pair; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Iterables; - -/** - * This data provider will return a XY model (model is wrapped in a response) - * based on a query filter. The model returned is related to the DPDK Ethernet - * throughput views - * - * @author Adel Belkhiri - */ -public class DpdkEthdevRateDataProvider extends AbstractTreeCommonXDataProvider - implements IOutputStyleProvider { - - /** - * Extension point ID. - */ - public static final String ID = "org.eclipse.tracecompass.incubator.dpdk.ethdev.rate.dataprovider"; //$NON-NLS-1$ - - /** - * Title used to create XY models for the {@link DpdkEthdevRateDataProvider}. - */ - protected static final String PROVIDER_TITLE = Objects.requireNonNull("Dpdk Ethernet Device Throughput"); //$NON-NLS-1$ - - private static final String BASE_STYLE = "base"; //$NON-NLS-1$ - private static final Map STATE_MAP; - private static final String BINARY_SPEED_UNIT = "/s"; //$NON-NLS-1$ - private static final String NICS_LABEL = Objects.requireNonNull(Messages.DpdkEthdev_RateDataProvider_NICs); - private static final String RX_QS_LABEL = Objects.requireNonNull(Messages.DpdkEthdev_RateDataProvider_NIC_RX); - private static final String TX_QS_LABEL = Objects.requireNonNull(Messages.DpdkEthdev_RateDataProvider_NIC_TX); - private static final List> COLOR_LIST = IODataPalette.getColors(); - private static final TmfXYAxisDescription Y_AXIS_DESCRIPTION = new TmfXYAxisDescription(Objects.requireNonNull(Messages.DpdkEthdev_RateDataProvider_YAxis), BINARY_SPEED_UNIT, DataType.NUMBER); - private static final List SUPPORTED_STYLES = ImmutableList.of( - StyleProperties.SeriesStyle.SOLID, - StyleProperties.SeriesStyle.DASH, - StyleProperties.SeriesStyle.DOT, - StyleProperties.SeriesStyle.DASHDOT, - StyleProperties.SeriesStyle.DASHDOTDOT); - - static { - // Create the base style - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - builder.put(BASE_STYLE, new OutputElementStyle(null, ImmutableMap.of(StyleProperties.SERIES_TYPE, StyleProperties.SeriesType.AREA, StyleProperties.WIDTH, 1.0f))); - STATE_MAP = builder.build(); - } - - /** - * Class for encapsulating all the values required to build a series. - */ - private static final class NicQueueBuilder { - - private static final double SECONDS_PER_NANOSECOND = 1E-9; - private final long fId; - /** - * This series' represent the number of packets received or transmitted - * by a NIC port queue - */ - public final int fQueueQuark; - private final String fName; - private final double[] fValues; - private double fPrevCount; - - /** - * Constructor - * - * @param id - * the series Id - * @param nicQueueQuark - * queue's quark - * @param name - * name of this series - * @param length - * desired length of the series - */ - private NicQueueBuilder(long id, int nicQueueQuark, String name, int length) { - fId = id; - fQueueQuark = nicQueueQuark; - fName = name; - fValues = new double[length]; - } - - private void setPrevCount(double prevCount) { - fPrevCount = prevCount; - } - - /** - * Update the value for the counter at the desired index. - * - * @param pos - * index to update - * @param newCount - * new number of read / written sectors - * @param deltaT - * time difference to the previous value for interpolation - */ - private void updateValue(int pos, double newCount, long deltaT) { - /** - * Linear interpolation to compute the queue throughput between time - * and the previous time, from the number of packets received or - * sent at each time. - */ - fValues[pos] = (newCount - fPrevCount) / (SECONDS_PER_NANOSECOND * deltaT); - fPrevCount = newCount; - } - - private IYModel build() { - return new YModel(fId, fName, fValues, Y_AXIS_DESCRIPTION); - } - } - - /** - * Create an instance of {@link DpdkEthdevRateDataProvider}. Returns a null - * instance if the analysis module is not found. - * - * @param trace - * A trace on which we are interested to fetch a model - * @return A {@link DpdkEthdevRateDataProvider} instance. If analysis module - * is not found, it returns null - */ - public static @Nullable DpdkEthdevRateDataProvider create(ITmfTrace trace) { - DpdkEthdevRateAnalysis module = TmfTraceUtils.getAnalysisModuleOfClass(trace, DpdkEthdevRateAnalysis.class, DpdkEthdevRateAnalysis.ID); - if (module != null) { - module.schedule(); - return new DpdkEthdevRateDataProvider(trace, module); - } - return null; - } - - /** - * Constructor - */ - private DpdkEthdevRateDataProvider(ITmfTrace trace, DpdkEthdevRateAnalysis module) { - super(trace, module); - } - - @Override - public String getId() { - return ID; - } - - /** - * Get parts of the XY tree that are related to the RX and TX queues - * - * @param ss - * State System - * @param qsQuark - * Queues list quark - * @param nicName - * Name of the NIC to which the queues belong - * @param nicId - * Id of the related NIC - * @return a list of {@link TmfTreeDataModel} - */ - List getQueuesTree(ITmfStateSystem ss, int qsQuark, String nicName, long nicId) { - int i = 0; - List nodes = new ArrayList<>(); - boolean isRxQueue = true; - - try { - if (ss.getAttributeName(qsQuark).equals(DpdkEthdevRateAttributes.TX_Q)) { - isRxQueue = false; - } - - long qsId = getId(qsQuark); - nodes.add(new TmfTreeDataModel(qsId, nicId, Collections.singletonList(isRxQueue ? RX_QS_LABEL : TX_QS_LABEL), false, null)); - for (Integer queueQuark : ss.getSubAttributes(qsQuark, false)) { - String queueName = ss.getAttributeName(queueQuark); - long queueId = getId(queueQuark); - - // get colors for this queue corresponding to their types - // (reception or transmission) - Pair pair = COLOR_LIST.get(i % COLOR_LIST.size()); - String seriesStyle = SUPPORTED_STYLES.get((i / COLOR_LIST.size()) % SUPPORTED_STYLES.size()); - - if (queueQuark != ITmfStateSystem.INVALID_ATTRIBUTE) { - nodes.add(new TmfTreeDataModel(queueId, qsId, Collections.singletonList(queueName), true, - new OutputElementStyle(BASE_STYLE, ImmutableMap.of( - StyleProperties.COLOR, isRxQueue ? pair.getFirst() : pair.getSecond(), - StyleProperties.SERIES_STYLE, seriesStyle, - StyleProperties.STYLE_NAME, - nicName + '/' + RX_QS_LABEL + '/' + queueName)))); - } - - i++; - } - } catch (IndexOutOfBoundsException e) { - Activator.getInstance().logError("Error fetching the name assigned to the quark " + qsQuark + "! Is the DPDK event (" + DpdkEthdevEventLayout.eventEthdevConfigure() + ") missing?"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - return nodes; - } - - @Override - protected TmfTreeModel getTree(ITmfStateSystem ss, Map parameters, @Nullable IProgressMonitor monitor) { - List nodes = new ArrayList<>(); - long rootId = getId(ITmfStateSystem.ROOT_ATTRIBUTE); - nodes.add(new TmfTreeDataModel(rootId, -1, Collections.singletonList(Objects.requireNonNull(getTrace().getName())), false, null)); - - try { - int nicsQuark = ss.getQuarkAbsolute(DpdkEthdevRateAttributes.NICS); - long nicsId = getId(nicsQuark); - nodes.add(new TmfTreeDataModel(nicsId, rootId, Collections.singletonList(NICS_LABEL), false, null)); - - for (Integer nicQuark : ss.getQuarks(DpdkEthdevRateAttributes.NICS, "*")) { //$NON-NLS-1$ - String nicName = ss.getAttributeName(nicQuark); - long nicId = getId(nicQuark); - nodes.add(new TmfTreeDataModel(nicId, nicsId, Collections.singletonList(nicName), false, null)); - - int rxQsQuark = ss.optQuarkRelative(nicQuark, DpdkEthdevRateAttributes.RX_Q); - int txQsQuark = ss.optQuarkRelative(nicQuark, DpdkEthdevRateAttributes.TX_Q); - if (rxQsQuark == ITmfStateSystem.INVALID_ATTRIBUTE && txQsQuark == ITmfStateSystem.INVALID_ATTRIBUTE) { - continue; - } - - nodes.addAll(getQueuesTree(ss, rxQsQuark, nicName, nicId)); - nodes.addAll(getQueuesTree(ss, txQsQuark, nicName, nicId)); - - } - } catch (AttributeNotFoundException e) { - Activator.getInstance().logError("Error getting the root attribute of " + DpdkEthdevRateAttributes.NICS); //$NON-NLS-1$ - } - return new TmfTreeModel<>(Collections.emptyList(), nodes); - } - - /** - * Extract a packets counts - * - * @param queueQuark - * quark of the NIC queue - * @param states - * states - * @return number of received or transmitted packets - */ - public static double extractCount(int queueQuark, List states) { - Object stateValue = states.get(queueQuark).getValue(); - double count = (stateValue instanceof Number) ? ((Number) stateValue).doubleValue() : 0.0; - return count; - } - - @Override - protected @Nullable Collection getYSeriesModels(ITmfStateSystem ss, Map fetchParameters, @Nullable IProgressMonitor monitor) throws StateSystemDisposedException { - SelectionTimeQueryFilter filter = FetchParametersUtils.createSelectionTimeQuery(fetchParameters); - if (filter == null) { - return null; - } - long[] xValues = filter.getTimesRequested(); - List builders = initBuilders(ss, filter); - if (builders.isEmpty()) { - return Collections.emptyList(); - } - - long currentEnd = ss.getCurrentEndTime(); - long prevTime = filter.getStart(); - if (prevTime >= ss.getStartTime() && prevTime <= currentEnd) { - // reuse the results from the full query - List states = ss.queryFullState(prevTime); - - for (NicQueueBuilder entry : builders) { - entry.setPrevCount(extractCount(entry.fQueueQuark, /* ss, */ states/* - * , - * prevTime - */)); - } - } - - for (int i = 1; i < xValues.length; i++) { - if (monitor != null && monitor.isCanceled()) { - return null; - } - long time = xValues[i]; - if (time > currentEnd) { - break; - } else if (time >= ss.getStartTime()) { - List states = ss.queryFullState(time); - - for (NicQueueBuilder entry : builders) { - double count = extractCount(entry.fQueueQuark, states); - entry.updateValue(i, count, time - prevTime); - } - } - prevTime = time; - } - return ImmutableList.copyOf(Iterables.transform(builders, NicQueueBuilder::build)); - } - - private List initBuilders(ITmfStateSystem ss, SelectionTimeQueryFilter filter) { - int length = filter.getTimesRequested().length; - List builders = new ArrayList<>(); - - for (Entry entry : getSelectedEntries(filter).entrySet()) { - long id = Objects.requireNonNull(entry.getKey()); - int quark = Objects.requireNonNull(entry.getValue()); - - if ((quark == ITmfStateSystem.ROOT_ATTRIBUTE) || - (ss.getParentAttributeQuark(quark) == ITmfStateSystem.ROOT_ATTRIBUTE)) { - continue; - } - - int parentQuark = ss.getParentAttributeQuark(quark); - if (parentQuark != ITmfStateSystem.INVALID_ATTRIBUTE && - ((ss.getAttributeName(parentQuark).equals(DpdkEthdevRateAttributes.RX_Q) || - ss.getAttributeName(parentQuark).equals(DpdkEthdevRateAttributes.TX_Q)))) { - int nicQuark = ss.getParentAttributeQuark(parentQuark); - String name = getTrace().getName() + '/' + ss.getAttributeName(nicQuark) + '/' + ss.getAttributeName(parentQuark) + '/' + ss.getAttributeName(quark); - builders.add(new NicQueueBuilder(id, quark, name, length)); - } - - } - return builders; - } - - @Override - protected boolean isCacheable() { - return true; - } - - @Override - protected String getTitle() { - return PROVIDER_TITLE; - } - - @Override - public TmfModelResponse fetchStyle(Map fetchParameters, @Nullable IProgressMonitor monitor) { - return new TmfModelResponse<>(new OutputStyleModel(STATE_MAP), ITmfResponse.Status.COMPLETED, CommonStatusMessage.COMPLETED); - } -} diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/DpdkEthdevRateDataProviderFactory.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/DpdkEthdevRateDataProviderFactory.java deleted file mode 100644 index 8482d0fa..00000000 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/DpdkEthdevRateDataProviderFactory.java +++ /dev/null @@ -1,61 +0,0 @@ -/********************************************************************** - * Copyright (c) 2024 École Polytechnique de Montréal - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License 2.0 which - * accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - **********************************************************************/ - -package org.eclipse.tracecompass.incubator.internal.dpdk.core.ethdev.rate.analysis; - -import java.util.Collection; -import java.util.Collections; - -import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.tracecompass.tmf.core.dataprovider.IDataProviderDescriptor; -import org.eclipse.tracecompass.tmf.core.dataprovider.IDataProviderDescriptor.ProviderType; -import org.eclipse.tracecompass.tmf.core.dataprovider.IDataProviderFactory; -import org.eclipse.tracecompass.tmf.core.model.DataProviderDescriptor; -import org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel; -import org.eclipse.tracecompass.tmf.core.model.xy.ITmfTreeXYDataProvider; -import org.eclipse.tracecompass.tmf.core.model.xy.TmfTreeXYCompositeDataProvider; -import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; -import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager; -import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils; - -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; - -/** - * Factory to create instances of the {@link DpdkEthdevRateDataProvider}. - * - * @author Adel Belkhiri - */ -public class DpdkEthdevRateDataProviderFactory implements IDataProviderFactory { - private static final Predicate PREDICATE = t -> TmfTraceUtils.getAnalysisModuleOfClass(t, DpdkEthdevRateAnalysis.class, DpdkEthdevRateAnalysis.ID) != null; - private static final IDataProviderDescriptor DESCRIPTOR = new DataProviderDescriptor.Builder() - .setId(DpdkEthdevRateDataProvider.ID) - .setName("Dpdk Ethernet Rate") //$NON-NLS-1$ - .setDescription("XY chart illustrating the speed rate of DPDK Ethernet NIC ports") //$NON-NLS-1$ - .setProviderType(ProviderType.TREE_TIME_XY) - .build(); - - @Override - public @Nullable ITmfTreeXYDataProvider createProvider(ITmfTrace trace) { - Collection traces = TmfTraceManager.getTraceSet(trace); - if (traces.size() == 1) { - return DpdkEthdevRateDataProvider.create(trace); - } - return TmfTreeXYCompositeDataProvider.create(traces, DpdkEthdevRateDataProvider.PROVIDER_TITLE, DpdkEthdevRateDataProvider.ID); - } - - @Override - public Collection getDescriptors(ITmfTrace trace) { - Collection traces = TmfTraceManager.getTraceSet(trace); - return Iterables.any(traces, PREDICATE) ? Collections.singletonList(DESCRIPTOR) : Collections.emptyList(); - } - -} diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/DpdkEthdevRateEventHandler.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/DpdkEthdevRateEventHandler.java deleted file mode 100644 index c54baa92..00000000 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/DpdkEthdevRateEventHandler.java +++ /dev/null @@ -1,129 +0,0 @@ -/********************************************************************** - * Copyright (c) 2024 École Polytechnique de Montréal - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License 2.0 which - * accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - **********************************************************************/ -package org.eclipse.tracecompass.incubator.internal.dpdk.core.ethdev.rate.analysis; - -import java.util.Objects; - -import org.eclipse.tracecompass.incubator.internal.dpdk.core.Activator; -import org.eclipse.tracecompass.incubator.internal.dpdk.core.analysis.DpdkEthdevEventLayout; -import org.eclipse.tracecompass.incubator.internal.dpdk.core.analysis.IDpdkEventHandler; -import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder; -import org.eclipse.tracecompass.statesystem.core.StateSystemBuilderUtils; -import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException; -import org.eclipse.tracecompass.tmf.core.event.ITmfEvent; - -/** - * Event handler to process the Ethdev events required by the - * {@link DpdkEthdevRateAnalysis} analysis - * - * @author Adel Belkhiri - */ -public class DpdkEthdevRateEventHandler implements IDpdkEventHandler { - - /* Attribute names */ - private static final String ETH_NICS = Objects.requireNonNull(DpdkEthdevRateAttributes.NICS); - private static final String RX_Q = Objects.requireNonNull(DpdkEthdevRateAttributes.RX_Q); - private static final String TX_Q = Objects.requireNonNull(DpdkEthdevRateAttributes.TX_Q); - - DpdkEthdevRateEventHandler() { - // Nothing here - } - - /** - * Create a set of receive or transmit queues on the state system - * - * @param ts - * time to use for the state change - */ - static private void createNicQueues(ITmfStateSystemBuilder ssb, int queueSetQuark, int nbQueues, long ts) { - if (nbQueues <= 0) { - return; - } - - for (int i = 0; i < nbQueues; i++) { - ssb.getQuarkRelativeAndAdd(queueSetQuark, String.valueOf(i)); - } - } - - /** - * Update the count of received or transmitted packets on the state system - * - * @param ssb - * State System builder - * @param portId - * Port identifier - * @param queueId - * Queue identifier - * @param queueCategory - * Category of the target queue (RX or TX) - * @param nbPkts - * Number of packets received or transmitted - * @param ts - * Time to use for the state change - */ - public void updateCounts(ITmfStateSystemBuilder ssb, Integer portId, Integer queueId, String queueCategory, Integer nbPkts, long ts) { - if (nbPkts <= 0) { - return; - } - - int portQuark = ssb.getQuarkAbsoluteAndAdd(ETH_NICS, String.valueOf(portId)); - int qsQuark = ssb.getQuarkRelativeAndAdd(portQuark, queueCategory); - int queueQuark = ssb.getQuarkRelativeAndAdd(qsQuark, queueId.toString()); - try { - StateSystemBuilderUtils.incrementAttributeLong(ssb, ts, queueQuark, nbPkts); - } catch (StateValueTypeException e) { - Activator.getInstance().logWarning("Problem accessing the state of a NIC queue (Quark =" + String.valueOf(queueQuark) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - @Override - public void handleEvent(ITmfStateSystemBuilder ssb, ITmfEvent event) { - Integer portId = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldPortId()); - long ts = event.getTimestamp().getValue(); - String eventName = event.getName(); - - if (eventName.equals(DpdkEthdevEventLayout.eventEthdevConfigure())) { - Integer rc = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldRc()); - Integer nbRxQueues = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldNbRxQ()); - Integer nbTxQueues = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldNbTxQ()); - - if (Objects.requireNonNull(rc) == 0) { - // create the new Ethernet device on the state system - int portQuark = ssb.getQuarkAbsoluteAndAdd(ETH_NICS, String.valueOf(portId)); - int rxQueueQark = ssb.getQuarkRelativeAndAdd(portQuark, RX_Q); - // create the receive and transmit queues on the state system - createNicQueues(ssb, rxQueueQark, Objects.requireNonNull(nbRxQueues), ts); - int txQueueQark = ssb.getQuarkRelativeAndAdd(portQuark, TX_Q); - createNicQueues(ssb, txQueueQark, Objects.requireNonNull(nbTxQueues), ts); - } else { - Activator.getInstance().logWarning("The event " + DpdkEthdevEventLayout.eventEthdevConfigure() + " presents a non-zero RC value"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - } else if (eventName.equals(DpdkEthdevEventLayout.eventEthdevRxqBurstNonEmpty())) { - Integer queueId = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldQueueId()); - Integer nbRxPkts = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldNbRxPkts()); - if(portId != null && queueId != null && nbRxPkts != null) { - updateCounts(ssb, portId, queueId, RX_Q, nbRxPkts, ts); - } else { - Activator.getInstance().logWarning("The event " + DpdkEthdevEventLayout.eventEthdevRxqBurstNonEmpty() + " has a null field value"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - } else if (eventName.equals(DpdkEthdevEventLayout.eventEthdevTxqBurst())) { - Integer queueId = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldQueueId()); - Integer nbTxPkts = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldNbPkts()); - if(portId != null && queueId != null && nbTxPkts != null) { - updateCounts(ssb, portId, queueId, TX_Q, nbTxPkts, ts); - } else { - Activator.getInstance().logWarning("The event " + DpdkEthdevEventLayout.eventEthdevTxqBurst() + " has a null field value"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - } -} diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/DpdkEthdevRateStateProvider.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/DpdkEthdevRateStateProvider.java deleted file mode 100644 index 42999a6d..00000000 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/DpdkEthdevRateStateProvider.java +++ /dev/null @@ -1,79 +0,0 @@ -/********************************************************************** - * Copyright (c) 2024 École Polytechnique de Montréal - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License 2.0 which - * accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - **********************************************************************/ -package org.eclipse.tracecompass.incubator.internal.dpdk.core.ethdev.rate.analysis; - -import java.util.Map; - -import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.tracecompass.incubator.internal.dpdk.core.analysis.AbstractDpdkStateProvider; -import org.eclipse.tracecompass.incubator.internal.dpdk.core.analysis.DpdkEthdevEventLayout; -import org.eclipse.tracecompass.incubator.internal.dpdk.core.analysis.IDpdkEventHandler; -import org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider; -import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; - -import com.google.common.collect.ImmutableMap; - -/** - * State provider for the Ethernet packet rate (or speed) analysis - * - * @author Adel Belkhiri - */ -public class DpdkEthdevRateStateProvider extends AbstractDpdkStateProvider { - - private static final int VERSION = 1; - - /** Map events needed for this analysis with their handler functions */ - private @Nullable Map fEventNames; - - /** - * State provider constructor - * - * @param trace - * trace - * @param id - * id - */ - protected DpdkEthdevRateStateProvider(ITmfTrace trace, String id) { - super(trace, id); - } - - /** - * Get the version of this state provider - */ - @Override - public int getVersion() { - return VERSION; - } - - /** - * Get a new instance - */ - @Override - public ITmfStateProvider getNewInstance() { - return new DpdkEthdevRateStateProvider(this.getTrace(), DpdkEthdevRateAnalysis.ID); - } - - @Override - protected @Nullable IDpdkEventHandler getEventHandler(String eventName) { - if (fEventNames == null) { - ImmutableMap.Builder builder = ImmutableMap.builder(); - IDpdkEventHandler ethdevEventHandler = new DpdkEthdevRateEventHandler(); - builder.put(DpdkEthdevEventLayout.eventEthdevConfigure(), ethdevEventHandler); - builder.put(DpdkEthdevEventLayout.eventEthdevRxqBurstNonEmpty(), ethdevEventHandler); - builder.put(DpdkEthdevEventLayout.eventEthdevTxqBurst(), ethdevEventHandler); - fEventNames = builder.build(); - } - if (fEventNames != null) { - return fEventNames.get(eventName); - } - return null; - } -} diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/Messages.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/Messages.java deleted file mode 100644 index 597c985e..00000000 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/Messages.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2024 École Polytechnique de Montréal - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License 2.0 which - * accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ - -package org.eclipse.tracecompass.incubator.internal.dpdk.core.ethdev.rate.analysis; - -import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.osgi.util.NLS; - -/** - * Messages for {@link DpdkEthdevRateDataProvider} - * - * @author Adel Belkhiri - */ -@SuppressWarnings("javadoc") -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.tracecompass.incubator.internal.dpdk.core.ethdev.rate.analysis.messages"; //$NON-NLS-1$ - public static @Nullable String DpdkEthdev_RateDataProvider_NICs; - public static @Nullable String DpdkEthdev_RateDataProvider_NIC_RX; - public static @Nullable String DpdkEthdev_RateDataProvider_NIC_TX; - public static @Nullable String DpdkEthdev_RateDataProvider_YAxis; - - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -} diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/messages.properties b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/messages.properties deleted file mode 100644 index 466a2a06..00000000 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/messages.properties +++ /dev/null @@ -1,15 +0,0 @@ -############################################################################### -# Copyright (c) 2024 École Polytechnique de Montréal -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License 2.0 -# which accompanies this distribution, and is available at -# https://www.eclipse.org/legal/epl-2.0 -# -# SPDX-License-Identifier: EPL-2.0 -############################################################################### - -DpdkEthdev_RateDataProvider_NICs=NIC Port -DpdkEthdev_RateDataProvider_NIC_RX=RX -DpdkEthdev_RateDataProvider_NIC_TX=TX -DpdkEthdev_RateDataProvider_YAxis=#/s diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/package-info.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/package-info.java deleted file mode 100644 index 5d9c6dab..00000000 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/rate/analysis/package-info.java +++ /dev/null @@ -1,13 +0,0 @@ -/********************************************************************** - * Copyright (c) 2024 École Polytechnique de Montréal - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License 2.0 which - * accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - **********************************************************************/ -@org.eclipse.jdt.annotation.NonNullByDefault -package org.eclipse.tracecompass.incubator.internal.dpdk.core.ethdev.rate.analysis; - diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/AbstractDpdkEthdevThroughputDataProvider.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/AbstractDpdkEthdevThroughputDataProvider.java new file mode 100644 index 00000000..24607a2b --- /dev/null +++ b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/AbstractDpdkEthdevThroughputDataProvider.java @@ -0,0 +1,249 @@ +/********************************************************************** + * Copyright (c) 2024 École Polytechnique de Montréal + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License 2.0 which + * accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + **********************************************************************/ +package org.eclipse.tracecompass.incubator.internal.dpdk.core.ethdev.throughput.analysis; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jdt.annotation.Nullable; +import org.eclipse.tracecompass.incubator.internal.dpdk.core.Activator; +import org.eclipse.tracecompass.incubator.internal.dpdk.core.analysis.DpdkEthdevEventLayout; +import org.eclipse.tracecompass.internal.analysis.os.linux.core.inputoutput.IODataPalette; +import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem; +import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException; +import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException; +import org.eclipse.tracecompass.tmf.core.model.CommonStatusMessage; +import org.eclipse.tracecompass.tmf.core.model.IOutputStyleProvider; +import org.eclipse.tracecompass.tmf.core.model.OutputElementStyle; +import org.eclipse.tracecompass.tmf.core.model.OutputStyleModel; +import org.eclipse.tracecompass.tmf.core.model.StyleProperties; +import org.eclipse.tracecompass.tmf.core.model.YModel; +import org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter; +import org.eclipse.tracecompass.tmf.core.model.tree.TmfTreeDataModel; +import org.eclipse.tracecompass.tmf.core.model.tree.TmfTreeModel; +import org.eclipse.tracecompass.tmf.core.model.xy.AbstractTreeCommonXDataProvider; +import org.eclipse.tracecompass.tmf.core.model.xy.IYModel; +import org.eclipse.tracecompass.tmf.core.model.xy.TmfXYAxisDescription; +import org.eclipse.tracecompass.tmf.core.response.ITmfResponse; +import org.eclipse.tracecompass.tmf.core.response.TmfModelResponse; +import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; +import org.eclipse.tracecompass.tmf.core.util.Pair; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; + +/** + * Abstract base class for DPDK Ethernet Device Throughput Data Providers + */ +public abstract class AbstractDpdkEthdevThroughputDataProvider extends AbstractTreeCommonXDataProvider + implements IOutputStyleProvider { + + protected static final String BASE_STYLE = "base"; //$NON-NLS-1$ + protected static final Map STATE_MAP; + protected static final List> COLOR_LIST = IODataPalette.getColors(); + protected static final List SUPPORTED_STYLES = ImmutableList.of( + StyleProperties.SeriesStyle.SOLID, + StyleProperties.SeriesStyle.DASH, + StyleProperties.SeriesStyle.DOT, + StyleProperties.SeriesStyle.DASHDOT, + StyleProperties.SeriesStyle.DASHDOTDOT); + + static { + // Create the base style + ImmutableMap.Builder builder = ImmutableMap.builder(); + builder.put(BASE_STYLE, new OutputElementStyle(null, ImmutableMap.of( + StyleProperties.SERIES_TYPE, StyleProperties.SeriesType.AREA, + StyleProperties.WIDTH, 1.0f))); + STATE_MAP = builder.build(); + } + + /** NIC queues label */ + protected static final String NICS_LABEL = Objects.requireNonNull(Messages.DpdkEthdev_ThroughputDataProvider_NICs); + /** Packets reception label */ + protected static final String RX_LABEL = Objects.requireNonNull(Messages.DpdkEthdev_ThroughputDataProvider_NIC_RX); + /** Packets transmission label */ + protected static final String TX_LABEL = Objects.requireNonNull(Messages.DpdkEthdev_ThroughputDataProvider_NIC_TX); + + /** + * Constructor + * + * @param trace + * Target trace + * @param module + * Analysis module + */ + protected AbstractDpdkEthdevThroughputDataProvider(ITmfTrace trace, DpdkEthdevThroughputAnalysisModule module) { + super(trace, module); + } + + @Override + protected boolean isCacheable() { + return true; + } + + @Override + public TmfModelResponse fetchStyle(Map fetchParameters, @Nullable IProgressMonitor monitor) { + return new TmfModelResponse<>(new OutputStyleModel(STATE_MAP), ITmfResponse.Status.COMPLETED, CommonStatusMessage.COMPLETED); + } + + @Override + protected TmfTreeModel getTree(ITmfStateSystem ss, Map parameters, @Nullable IProgressMonitor monitor) { + List nodes = new ArrayList<>(); + long rootId = getId(ITmfStateSystem.ROOT_ATTRIBUTE); + nodes.add(new TmfTreeDataModel(rootId, -1, Collections.singletonList(getTrace().getName()), false, null)); + + try { + int nicsQuark = ss.getQuarkAbsolute(DpdkEthdevThroughputAttributes.NICS); + long nicsId = getId(nicsQuark); + nodes.add(new TmfTreeDataModel(nicsId, rootId, Collections.singletonList(NICS_LABEL), false, null)); + + for (Integer nicQuark : ss.getQuarks(DpdkEthdevThroughputAttributes.NICS, "*")) { //$NON-NLS-1$ + String nicName = ss.getAttributeName(nicQuark); + long nicId = getId(nicQuark); + nodes.add(new TmfTreeDataModel(nicId, nicsId, Collections.singletonList(nicName), false, null)); + + int rxQsQuark = ss.optQuarkRelative(nicQuark, DpdkEthdevThroughputAttributes.RX_Q); + int txQsQuark = ss.optQuarkRelative(nicQuark, DpdkEthdevThroughputAttributes.TX_Q); + + nodes.addAll(getQueuesTree(ss, rxQsQuark, nicName, nicId)); + nodes.addAll(getQueuesTree(ss, txQsQuark, nicName, nicId)); + } + } catch (AttributeNotFoundException e) { + Activator.getInstance().logError("Error getting the root attribute of " + DpdkEthdevThroughputAttributes.NICS); //$NON-NLS-1$ + } + return new TmfTreeModel<>(Collections.emptyList(), nodes); + } + + /** + * Get parts of the XY tree that are related to the RX and TX queues + * + * @param ss + * The state system + * @param qsQuark + * The quark of the queues list + * @param nicName + * The name of the NIC to which the queues are attached + * @param nicId + * The id of the related port + * @return a list of {@link TmfTreeDataModel} + */ + protected List getQueuesTree(ITmfStateSystem ss, int qsQuark, String nicName, long nicId) { + int i = 0; + List nodes = new ArrayList<>(); + boolean isRxQueue = true; + + try { + if (DpdkEthdevThroughputAttributes.TX_Q.equals(ss.getAttributeName(qsQuark))) { + isRxQueue = false; + } + + long qsId = getId(qsQuark); + nodes.add(new TmfTreeDataModel(qsId, nicId, Collections.singletonList(isRxQueue ? RX_LABEL : TX_LABEL), false, null)); + + for (Integer queueQuark : ss.getSubAttributes(qsQuark, false)) { + String queueName = ss.getAttributeName(queueQuark); + long queueId = getId(queueQuark); + + // Get color and style for the queue + Pair colorPair = COLOR_LIST.get(i % COLOR_LIST.size()); + String seriesStyle = SUPPORTED_STYLES.get((i / COLOR_LIST.size()) % SUPPORTED_STYLES.size()); + + nodes.add(new TmfTreeDataModel(queueId, qsId, Collections.singletonList(queueName), true, + new OutputElementStyle(BASE_STYLE, ImmutableMap.of( + StyleProperties.COLOR, isRxQueue ? colorPair.getFirst() : colorPair.getSecond(), + StyleProperties.SERIES_STYLE, seriesStyle, + StyleProperties.STYLE_NAME, nicName + '/' + (isRxQueue ? RX_LABEL : TX_LABEL) + '/' + queueName)))); + + i++; + } + } catch (IndexOutOfBoundsException e) { + Activator.getInstance().logWarning("A DPDK event (" + DpdkEthdevEventLayout.eventEthdevConfigure() + ") is missing", e); //$NON-NLS-1$ //$NON-NLS-2$ + } + return nodes; + } + + @Override + protected abstract String getTitle(); + + @Override + public abstract String getId(); + + @Override + protected abstract @Nullable Collection getYSeriesModels(ITmfStateSystem ss, Map fetchParameters, + @Nullable IProgressMonitor monitor) throws StateSystemDisposedException; + + protected abstract List initBuilders(ITmfStateSystem ss, SelectionTimeQueryFilter filter); + + /** + * Abstract class for building data series illustrating DPDK NICs throughput. + */ + protected abstract class AbstractNicQueueBuilder { + protected final long fId; + protected final int fQueueQuark; + protected final String fName; + protected final double[] fValues; + protected double fPrevCount; + + protected static final double SECONDS_PER_NANOSECOND = 1E-9; + + /** + * Constructor + * + * @param id + * The series Id + * @param nicQueueQuark + * The queue's quark + * @param name + * The name of this series + * @param length + * The length of the series + */ + protected AbstractNicQueueBuilder(long id, int nicQueueQuark, String name, int length) { + fId = id; + fQueueQuark = nicQueueQuark; + fName = name; + fValues = new double[length]; + } + + protected void setPrevCount(double prevCount) { + fPrevCount = prevCount; + } + + /** + * Update the value for the counter at the desired index. + * + * @param pos + * The index to update + * @param newCount + * The new count of bytes received or transmitted + * @param deltaT + * The time difference to the previous value for + * interpolation + */ + protected abstract void updateValue(int pos, double newCount, long deltaT); + + /** + * Build a data series + * + * @param yAxisDescription + * Description for the Y axis + * @return an IYModel + */ + protected IYModel build(TmfXYAxisDescription yAxisDescription) { + return new YModel(fId, fName, fValues, yAxisDescription); + } + } +} diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputAnalysisModule.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputAnalysisModule.java index d4785add..7f3f9d84 100644 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputAnalysisModule.java +++ b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputAnalysisModule.java @@ -1,5 +1,5 @@ /********************************************************************** - * Copyright (c) 2023 École Polytechnique de Montréal + * Copyright (c) 2024 École Polytechnique de Montréal * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License 2.0 which @@ -29,11 +29,11 @@ * An analysis to calculate the traffic reception and transmission throughput * per Ethernet port queue. * - * Note: To capture the events required for this analysis, the DPDK profiling - * library must be pre-loaded. This custom library emits events that include the - * number of bytes representing the size of each burst. It achieves this by - * hooking into the RX and TX burst operations through the registration of - * appropriate callbacks, specifically via calls to rte_eth_add_rx_callback() + * Note: To enable the computing of RX and TX throughput in bps, the DPDK + * profiling library must be pre-loaded. This custom library emits events that + * include the number of bytes representing the size of each burst. It achieves + * this by hooking into the RX and TX burst operations through the registration + * of appropriate callbacks, specifically via calls to rte_eth_add_rx_callback() * and rte_eth_add_tx_callback(). * * @author Adel Belkhiri @@ -51,7 +51,7 @@ protected ITmfStateProvider createStateProvider() { ITmfTrace trace = checkNotNull(getTrace()); if (trace instanceof DpdkTrace) { - return new DpdkEthdevStateProvider(trace, ID); + return new DpdkEthdevThroughputStateProvider(trace, ID); } throw new IllegalStateException(); diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputAttributes.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputAttributes.java index 4f5f3620..a6bb6040 100644 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputAttributes.java +++ b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputAttributes.java @@ -20,13 +20,15 @@ public interface DpdkEthdevThroughputAttributes { /** Root attribute for DPDK Ethdev Nics */ String NICS = "NICs"; //$NON-NLS-1$ - /** Reception Queues */ + /** Reception queues */ String RX_Q = "rx_qs"; //$NON-NLS-1$ - /** Transmission Queues */ + /** Transmission queues */ String TX_Q = "tx_qs"; //$NON-NLS-1$ - /** Packet Number */ - String PKT_COUNT = "pkt_count"; //$NON-NLS-1$ - /** Packet Size */ - String PKT_SIZE = "pkt_size"; //$NON-NLS-1$ + /** Packets number */ + String PKT_COUNT = "pkt_cnt"; //$NON-NLS-1$ + /** Packets size */ + String PKT_SIZE_P = "pkt_size_p"; //$NON-NLS-1$ + /** Packets number provided by the profiling library events */ + String PKT_COUNT_P = "pkt_cnt_p"; //$NON-NLS-1$ } diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputBpsDataProvider.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputBpsDataProvider.java new file mode 100644 index 00000000..52a24937 --- /dev/null +++ b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputBpsDataProvider.java @@ -0,0 +1,196 @@ +/********************************************************************** + * Copyright (c) 2024 École Polytechnique de Montréal + * + * All rights reserved. This program and the accompanying materials are + * made available under the terms of the Eclipse Public License 2.0 which + * accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + **********************************************************************/ +package org.eclipse.tracecompass.incubator.internal.dpdk.core.ethdev.throughput.analysis; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Objects; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jdt.annotation.Nullable; +import org.eclipse.tracecompass.incubator.internal.dpdk.core.Activator; +import org.eclipse.tracecompass.internal.tmf.core.model.filters.FetchParametersUtils; +import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem; +import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException; +import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException; +import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval; +import org.eclipse.tracecompass.tmf.core.dataprovider.DataType; +import org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter; +import org.eclipse.tracecompass.tmf.core.model.xy.IYModel; +import org.eclipse.tracecompass.tmf.core.model.xy.TmfXYAxisDescription; +import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; +import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Iterables; + +/** + * This data provider will return a XY model showing the Ethernet traffic + * throughput per queue, in bits per second (bps). + * + * @author Adel Belkhiri + */ +public class DpdkEthdevThroughputBpsDataProvider extends AbstractDpdkEthdevThroughputDataProvider { + + public static final String ID = "org.eclipse.tracecompass.incubator.dpdk.ethdev.throughput.bps.dataprovider"; //$NON-NLS-1$ + private static final String PROVIDER_TITLE = "Dpdk Ethernet Device Throughput - BPS"; //$NON-NLS-1$ + private static final String BINARY_SPEED_UNIT = "b/s"; //$NON-NLS-1$ + private static final TmfXYAxisDescription Y_AXIS_DESCRIPTION = new TmfXYAxisDescription(Objects.requireNonNull(Messages.DpdkEthdev_ThroughputBpsDataProvider_YAxis), BINARY_SPEED_UNIT, DataType.NUMBER); + + /** + * Class for encapsulating all the values required to build a series. + */ + private class NicQueueBuilder extends AbstractNicQueueBuilder { + private static final double BITS_PER_BYTE = 8.0; + + protected NicQueueBuilder(long id, int nicQueueQuark, String name, int length) { + super(id, nicQueueQuark, name, length); + } + + @Override + protected void updateValue(int pos, double newCount, long deltaT) { + /** + * Linear interpolation between current and previous times to + * compute the queue RX and TX throughput in bps + */ + fValues[pos] = (newCount - fPrevCount) * BITS_PER_BYTE / (SECONDS_PER_NANOSECOND * deltaT); + fPrevCount = newCount; + } + } + + /** + * Create an instance of {@link DpdkEthdevThroughputBpsDataProvider}. + * Returns a null instance if the analysis module is not found. + * + * @param trace + * A trace on which we are interested to fetch a model + * @return A {@link DpdkEthdevThroughputBpsDataProvider} instance. If + * analysis module is not found, then returns null + */ + public static @Nullable DpdkEthdevThroughputBpsDataProvider create(ITmfTrace trace) { + DpdkEthdevThroughputAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, DpdkEthdevThroughputAnalysisModule.class, DpdkEthdevThroughputAnalysisModule.ID); + return module != null ? new DpdkEthdevThroughputBpsDataProvider(trace, module) : null; + } + + /** + * Constructor + */ + private DpdkEthdevThroughputBpsDataProvider(ITmfTrace trace, DpdkEthdevThroughputAnalysisModule module) { + super(trace, module); + } + + @Override + protected String getTitle() { + return PROVIDER_TITLE; + } + + @Override + public String getId() { + return ID; + } + + @Override + protected @Nullable Collection getYSeriesModels(ITmfStateSystem ss, Map fetchParameters, + @Nullable IProgressMonitor monitor) throws StateSystemDisposedException { + SelectionTimeQueryFilter filter = FetchParametersUtils.createSelectionTimeQuery(fetchParameters); + if (filter == null) { + return null; + } + + long[] xValues = filter.getTimesRequested(); + List builders = initBuilders(ss, filter); + if (builders.isEmpty()) { + return Collections.emptyList(); + } + + long currentEnd = ss.getCurrentEndTime(); + long prevTime = filter.getStart(); + + if (prevTime >= ss.getStartTime() && prevTime <= currentEnd) { + List states = ss.queryFullState(prevTime); + + for (NicQueueBuilder builder : builders) { + builder.setPrevCount(extractCount(ss, states, builder.fQueueQuark)); + } + } + + for (int i = 1; i < xValues.length; i++) { + if (monitor != null && monitor.isCanceled()) { + return null; + } + long time = xValues[i]; + if (time > currentEnd) { + break; + } else if (time >= ss.getStartTime()) { + List states = ss.queryFullState(time); + + for (NicQueueBuilder builder : builders) { + double count = extractCount(ss, states, builder.fQueueQuark); + builder.updateValue(i, count, time - prevTime); + } + } + prevTime = time; + } + + return ImmutableList.copyOf(Iterables.transform(builders, builder -> builder.build(Y_AXIS_DESCRIPTION))); + } + + /** + * Extract packets' size + * + * @param ss + * State System + * @param states + * ITmfStateInterval values + * @param queueQuark + * NIC queue quark + * @return The number of bytes received or sent from a queue + */ + private static double extractCount(ITmfStateSystem ss, List states, int queueQuark) { + try { + int metricQuark = ss.getQuarkRelative(queueQuark, DpdkEthdevThroughputAttributes.PKT_SIZE_P); + Object stateValue = states.get(metricQuark).getValue(); + return stateValue instanceof Number ? ((Number) stateValue).doubleValue() : 0.0; + } catch (AttributeNotFoundException | IndexOutOfBoundsException e) { + Activator.getInstance().logError("Error accessing packets size on state system", e); //$NON-NLS-1$ + return 0.0; + } + } + + @Override + protected List initBuilders(ITmfStateSystem ss, SelectionTimeQueryFilter filter) { + int length = filter.getTimesRequested().length; + List builders = new ArrayList<>(); + + for (Entry entry : getSelectedEntries(filter).entrySet()) { + long id = Objects.requireNonNull(entry.getKey()); + int quark = Objects.requireNonNull(entry.getValue()); + + if (quark == ITmfStateSystem.ROOT_ATTRIBUTE || ss.getParentAttributeQuark(quark) == ITmfStateSystem.ROOT_ATTRIBUTE) { + continue; + } + + int parentQuark = ss.getParentAttributeQuark(quark); + if (parentQuark != ITmfStateSystem.INVALID_ATTRIBUTE && + (DpdkEthdevThroughputAttributes.RX_Q.equals(ss.getAttributeName(parentQuark)) || + DpdkEthdevThroughputAttributes.TX_Q.equals(ss.getAttributeName(parentQuark)))) { + int nicQuark = ss.getParentAttributeQuark(parentQuark); + String name = getTrace().getName() + '/' + ss.getAttributeName(nicQuark) + '/' + ss.getAttributeName(parentQuark) + '/' + ss.getAttributeName(quark); + builders.add(new NicQueueBuilder(id, quark, name, length)); + } + } + return builders; + } +} diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputBpsDataProvider3.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputBpsDataProvider3.java deleted file mode 100644 index 9055b9ec..00000000 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputBpsDataProvider3.java +++ /dev/null @@ -1,380 +0,0 @@ -/********************************************************************** - * Copyright (c) 2024 École Polytechnique de Montréal - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License 2.0 which - * accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - **********************************************************************/ - -package org.eclipse.tracecompass.incubator.internal.dpdk.core.ethdev.throughput.analysis; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Objects; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jdt.annotation.Nullable; -import org.eclipse.tracecompass.incubator.internal.dpdk.core.Activator; -import org.eclipse.tracecompass.incubator.internal.dpdk.core.analysis.DpdkEthdevEventLayout; -import org.eclipse.tracecompass.internal.analysis.os.linux.core.inputoutput.IODataPalette; -import org.eclipse.tracecompass.internal.tmf.core.model.filters.FetchParametersUtils; -import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem; -import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException; -import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException; -import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval; -import org.eclipse.tracecompass.tmf.core.dataprovider.DataType; -import org.eclipse.tracecompass.tmf.core.model.CommonStatusMessage; -import org.eclipse.tracecompass.tmf.core.model.IOutputStyleProvider; -import org.eclipse.tracecompass.tmf.core.model.OutputElementStyle; -import org.eclipse.tracecompass.tmf.core.model.OutputStyleModel; -import org.eclipse.tracecompass.tmf.core.model.StyleProperties; -import org.eclipse.tracecompass.tmf.core.model.YModel; -import org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter; -import org.eclipse.tracecompass.tmf.core.model.tree.TmfTreeDataModel; -import org.eclipse.tracecompass.tmf.core.model.tree.TmfTreeModel; -import org.eclipse.tracecompass.tmf.core.model.xy.AbstractTreeCommonXDataProvider; -import org.eclipse.tracecompass.tmf.core.model.xy.IYModel; -import org.eclipse.tracecompass.tmf.core.model.xy.TmfXYAxisDescription; -import org.eclipse.tracecompass.tmf.core.response.ITmfResponse; -import org.eclipse.tracecompass.tmf.core.response.TmfModelResponse; -import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; -import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils; -import org.eclipse.tracecompass.tmf.core.util.Pair; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Iterables; - -/** - * This data provider will return a XY model showing showing the Ethernet - * traffic throughput per queue, in bit per second (bps). - * - * @author Adel Belkhiri - */ -public class DpdkEthdevThroughputBpsDataProvider extends AbstractTreeCommonXDataProvider - implements IOutputStyleProvider { - - /** - * Extension point ID. - */ - public static final String ID = "org.eclipse.tracecompass.incubator.dpdk.ethdev.throughput.bps.dataprovider"; //$NON-NLS-1$ - - /** - * Title used to create XY models for the - * {@link DpdkEthdevThroughputBpsDataProvider}. - */ - protected static final String PROVIDER_TITLE = Objects.requireNonNull("Dpdk Ethernet Device Throughput BPS"); //$NON-NLS-1$ - - private static final String BASE_STYLE = "base"; //$NON-NLS-1$ - private static final Map STATE_MAP; - private static final String BINARY_SPEED_UNIT = "b/s"; //$NON-NLS-1$ - private static final String NICS_LABEL = Objects.requireNonNull(Messages.DpdkEthdev_ThroughputDataProvider_NICs); - private static final String RX_QS_LABEL = Objects.requireNonNull(Messages.DpdkEthdev_ThroughputDataProvider_NIC_RX); - private static final String TX_QS_LABEL = Objects.requireNonNull(Messages.DpdkEthdev_ThroughputDataProvider_NIC_TX); - private static final List> COLOR_LIST = IODataPalette.getColors(); - private static final TmfXYAxisDescription Y_AXIS_DESCRIPTION = new TmfXYAxisDescription(Objects.requireNonNull(Messages.DpdkEthdev_ThroughputDataProvider_YAxis), BINARY_SPEED_UNIT, DataType.NUMBER); - private static final List SUPPORTED_STYLES = ImmutableList.of( - StyleProperties.SeriesStyle.SOLID, - StyleProperties.SeriesStyle.DASH, - StyleProperties.SeriesStyle.DOT, - StyleProperties.SeriesStyle.DASHDOT, - StyleProperties.SeriesStyle.DASHDOTDOT); - - static { - // Create the base style - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - builder.put(BASE_STYLE, new OutputElementStyle(null, ImmutableMap.of(StyleProperties.SERIES_TYPE, StyleProperties.SeriesType.AREA, StyleProperties.WIDTH, 1.0f))); - STATE_MAP = builder.build(); - } - - /** - * Class for encapsulating all the values required to build a series. - */ - private static final class NicQueueBuilder { - - private static final double SECONDS_PER_NANOSECOND = 1E-9; - private final long fId; - /** - * This series' represent the number of packets received or transmitted - * by a NIC port queue - */ - public final int fQueueQuark; - private final String fName; - private final double[] fValues; - private double fPrevCount; - - /** - * Constructor - * - * @param id - * The series Id - * @param nicQueueQuark - * The queue's quark - * @param name - * The name of this series - * @param length - * The length of the series - */ - private NicQueueBuilder(long id, int nicQueueQuark, String name, int length) { - fId = id; - fQueueQuark = nicQueueQuark; - fName = name; - fValues = new double[length]; - } - - private void setPrevCount(double prevCount) { - fPrevCount = prevCount; - } - - /** - * Update the value for the counter at the desired index. - * - * @param pos - * The index to update - * @param newCount - * The new count of bytes received or transmitted - * @param deltaT - * The time difference to the previous value for - * interpolation - */ - private void updateValue(int pos, double newCount, long deltaT) { - /** - * Linear interpolation to compute the queue throughput between time - * and the previous time, from the number of bytes received or sent - * at each time. - */ - fValues[pos] = (newCount - fPrevCount) * 8 / (SECONDS_PER_NANOSECOND * deltaT); - fPrevCount = newCount; - } - - private IYModel build() { - return new YModel(fId, fName, fValues, Y_AXIS_DESCRIPTION); - } - } - - /** - * Create an instance of {@link DpdkEthdevThroughputBpsDataProvider}. Returns - * a null instance if the analysis module is not found. - * - * @param trace - * A trace on which we are interested to fetch a model - * @return A {@link DpdkEthdevThroughputBpsDataProvider} instance. If - * analysis module is not found, then returns null - */ - public static @Nullable DpdkEthdevThroughputBpsDataProvider create(ITmfTrace trace) { - DpdkEthdevThroughputAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, DpdkEthdevThroughputAnalysisModule.class, DpdkEthdevThroughputAnalysisModule.ID); - if (module != null) { - module.schedule(); - return new DpdkEthdevThroughputBpsDataProvider(trace, module); - } - return null; - } - - /** - * Constructor - */ - private DpdkEthdevThroughputBpsDataProvider(ITmfTrace trace, DpdkEthdevThroughputAnalysisModule module) { - super(trace, module); - } - - @Override - public String getId() { - return ID; - } - - /** - * Get parts of the XY tree that are related to the RX and TX queues - * - * @param ss - * The state system - * @param qsQuark - * The quark of the queues list - * @param nicName - * The name of the NIC to which the queues are attached - * @param nicId - * The id of the related port - * @return a list of {@link TmfTreeDataModel} - */ - List getQueuesTree(ITmfStateSystem ss, int qsQuark, String nicName, long nicId) { - int i = 0; - List nodes = new ArrayList<>(); - boolean isRxQueue = true; - - try { - if (ss.getAttributeName(qsQuark).equals(DpdkEthdevThroughputAttributes.TX_Q)) { - isRxQueue = false; - } - - long qsId = getId(qsQuark); - nodes.add(new TmfTreeDataModel(qsId, nicId, Collections.singletonList(isRxQueue ? RX_QS_LABEL : TX_QS_LABEL), false, null)); - for (Integer queueQuark : ss.getSubAttributes(qsQuark, false)) { - String queueName = ss.getAttributeName(queueQuark); - long queueId = getId(queueQuark); - - /* - * get colors for this queue corresponding to their types: - * reception or transmission - */ - Pair pair = COLOR_LIST.get(i % COLOR_LIST.size()); - String seriesStyle = SUPPORTED_STYLES.get((i / COLOR_LIST.size()) % SUPPORTED_STYLES.size()); - - if (queueQuark != ITmfStateSystem.INVALID_ATTRIBUTE) { - nodes.add(new TmfTreeDataModel(queueId, qsId, Collections.singletonList(queueName), true, - new OutputElementStyle(BASE_STYLE, ImmutableMap.of( - StyleProperties.COLOR, isRxQueue ? pair.getFirst() : pair.getSecond(), - StyleProperties.SERIES_STYLE, seriesStyle, - StyleProperties.STYLE_NAME, - nicName + '/' + RX_QS_LABEL + '/' + queueName)))); - } - - i++; - } - } catch (IndexOutOfBoundsException e) { - Activator.getInstance().logWarning("A DPDK event (" + DpdkEthdevEventLayout.eventEthdevConfigure() + ") is missing"); //$NON-NLS-1$ //$NON-NLS-2$ - } - return nodes; - } - - @Override - protected TmfTreeModel getTree(ITmfStateSystem ss, Map parameters, @Nullable IProgressMonitor monitor) { - List nodes = new ArrayList<>(); - long rootId = getId(ITmfStateSystem.ROOT_ATTRIBUTE); - nodes.add(new TmfTreeDataModel(rootId, -1, Collections.singletonList(Objects.requireNonNull(getTrace().getName())), false, null)); - - try { - int nicsQuark = ss.getQuarkAbsolute(DpdkEthdevThroughputAttributes.NICS); - long nicsId = getId(nicsQuark); - nodes.add(new TmfTreeDataModel(nicsId, rootId, Collections.singletonList(NICS_LABEL), false, null)); - - for (Integer nicQuark : ss.getQuarks(DpdkEthdevThroughputAttributes.NICS, "*")) { //$NON-NLS-1$ - String nicName = ss.getAttributeName(nicQuark); - long nicId = getId(nicQuark); - nodes.add(new TmfTreeDataModel(nicId, nicsId, Collections.singletonList(nicName), false, null)); - - int rxQsQuark = ss.optQuarkRelative(nicQuark, DpdkEthdevThroughputAttributes.RX_Q); - int txQsQuark = ss.optQuarkRelative(nicQuark, DpdkEthdevThroughputAttributes.TX_Q); - if (rxQsQuark == ITmfStateSystem.INVALID_ATTRIBUTE && txQsQuark == ITmfStateSystem.INVALID_ATTRIBUTE) { - continue; - } - - nodes.addAll(getQueuesTree(ss, rxQsQuark, nicName, nicId)); - nodes.addAll(getQueuesTree(ss, txQsQuark, nicName, nicId)); - - } - } catch (AttributeNotFoundException e) { - Activator.getInstance().logError("Error getting the root attribute of " + DpdkEthdevThroughputAttributes.NICS); //$NON-NLS-1$ - } - return new TmfTreeModel<>(Collections.emptyList(), nodes); - } - - /** - * Extract a packets counts - * - * @param queueQuark - * NIC queue quark - * @param states - * ITmfStateInterval values - * @return The number of bytes received or sent from a queue - */ - public static double extractCount(int queueQuark, ITmfStateSystem ss, List states) { - double count = 0.0; - try { - int metricQuark = ss.getQuarkRelative(queueQuark, DpdkEthdevThroughputAttributes.PKT_SIZE); - Object stateValue = states.get(metricQuark).getValue(); - count = (stateValue instanceof Number) ? ((Number) stateValue).doubleValue() : 0.0; - } catch (AttributeNotFoundException e) { - } - return count; - } - - @Override - protected @Nullable Collection getYSeriesModels(ITmfStateSystem ss, Map fetchParameters, @Nullable IProgressMonitor monitor) throws StateSystemDisposedException { - SelectionTimeQueryFilter filter = FetchParametersUtils.createSelectionTimeQuery(fetchParameters); - if (filter == null) { - return null; - } - long[] xValues = filter.getTimesRequested(); - List builders = initBuilders(ss, filter); - if (builders.isEmpty()) { - return Collections.emptyList(); - } - - long currentEnd = ss.getCurrentEndTime(); - long prevTime = filter.getStart(); - if (prevTime >= ss.getStartTime() && prevTime <= currentEnd) { - // reuse the results from the full query - List states = ss.queryFullState(prevTime); - - for (NicQueueBuilder entry : builders) { - entry.setPrevCount(extractCount(entry.fQueueQuark, ss, states)); - } - } - - for (int i = 1; i < xValues.length; i++) { - if (monitor != null && monitor.isCanceled()) { - return null; - } - long time = xValues[i]; - if (time > currentEnd) { - break; - } else if (time >= ss.getStartTime()) { - List states = ss.queryFullState(time); - - for (NicQueueBuilder entry : builders) { - double count = extractCount(entry.fQueueQuark, ss, states); - entry.updateValue(i, count, time - prevTime); - } - } - prevTime = time; - } - return ImmutableList.copyOf(Iterables.transform(builders, NicQueueBuilder::build)); - } - - private List initBuilders(ITmfStateSystem ss, SelectionTimeQueryFilter filter) { - int length = filter.getTimesRequested().length; - List builders = new ArrayList<>(); - - for (Entry entry : getSelectedEntries(filter).entrySet()) { - long id = Objects.requireNonNull(entry.getKey()); - int quark = Objects.requireNonNull(entry.getValue()); - - if ((quark == ITmfStateSystem.ROOT_ATTRIBUTE) || - (ss.getParentAttributeQuark(quark) == ITmfStateSystem.ROOT_ATTRIBUTE)) { - continue; - } - - int parentQuark = ss.getParentAttributeQuark(quark); - if (parentQuark != ITmfStateSystem.INVALID_ATTRIBUTE && - ((ss.getAttributeName(parentQuark).equals(DpdkEthdevThroughputAttributes.RX_Q) || - ss.getAttributeName(parentQuark).equals(DpdkEthdevThroughputAttributes.TX_Q)))) { - int nicQuark = ss.getParentAttributeQuark(parentQuark); - String name = getTrace().getName() + '/' + ss.getAttributeName(nicQuark) + '/' + ss.getAttributeName(parentQuark) + '/' + ss.getAttributeName(quark); - builders.add(new NicQueueBuilder(id, quark, name, length)); - } - - } - return builders; - } - - @Override - protected boolean isCacheable() { - return true; - } - - @Override - protected String getTitle() { - return PROVIDER_TITLE; - } - - @Override - public TmfModelResponse fetchStyle(Map fetchParameters, @Nullable IProgressMonitor monitor) { - return new TmfModelResponse<>(new OutputStyleModel(STATE_MAP), ITmfResponse.Status.COMPLETED, CommonStatusMessage.COMPLETED); - } -} diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputBpsDataProviderFactory.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputBpsDataProviderFactory.java index a3469c3a..56cf4ea2 100644 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputBpsDataProviderFactory.java +++ b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputBpsDataProviderFactory.java @@ -21,41 +21,37 @@ import org.eclipse.tracecompass.tmf.core.model.DataProviderDescriptor; import org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel; import org.eclipse.tracecompass.tmf.core.model.xy.ITmfTreeXYDataProvider; -import org.eclipse.tracecompass.tmf.core.model.xy.TmfTreeXYCompositeDataProvider; import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; -import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager; import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils; -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; - /** - * Factory to create instances of the {@link DpdkEthdevThroughputBpsDataProvider}. + * Factory to create instances of the + * {@link DpdkEthdevThroughputBpsDataProvider}. * * @author Adel Belkhiri */ public class DpdkEthdevThroughputBpsDataProviderFactory implements IDataProviderFactory { - private static final Predicate PREDICATE = t -> TmfTraceUtils.getAnalysisModuleOfClass(t, DpdkEthdevThroughputAnalysisModule.class, DpdkEthdevThroughputAnalysisModule.ID) != null; private static final IDataProviderDescriptor DESCRIPTOR = new DataProviderDescriptor.Builder() - .setId( DpdkEthdevThroughputBpsDataProvider.ID) + .setId(DpdkEthdevThroughputBpsDataProvider.ID) .setName("Dpdk Ethernet Throughput BPS") //$NON-NLS-1$ - .setDescription("XY chart illustrating the throughput of DPDK Ethernet NIC ports in terms of bits per seconds") //$NON-NLS-1$ + .setDescription("XY chart illustrating the throughput of DPDK Ethernet NIC queues in bits per seconds") //$NON-NLS-1$ .setProviderType(ProviderType.TREE_TIME_XY) .build(); @Override public @Nullable ITmfTreeXYDataProvider createProvider(ITmfTrace trace) { - Collection traces = TmfTraceManager.getTraceSet(trace); - if (traces.size() == 1) { - return DpdkEthdevThroughputBpsDataProvider.create(trace); + DpdkEthdevThroughputAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, DpdkEthdevThroughputAnalysisModule.class, DpdkEthdevThroughputAnalysisModule.ID); + if (module == null) { + return null; } - return TmfTreeXYCompositeDataProvider.create(traces, DpdkEthdevThroughputBpsDataProvider.PROVIDER_TITLE, DpdkEthdevThroughputBpsDataProvider.ID); + module.schedule(); + return DpdkEthdevThroughputBpsDataProvider.create(trace); } @Override public Collection getDescriptors(ITmfTrace trace) { - Collection traces = TmfTraceManager.getTraceSet(trace); - return Iterables.any(traces, PREDICATE) ? Collections.singletonList(DESCRIPTOR) : Collections.emptyList(); + DpdkEthdevThroughputAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, DpdkEthdevThroughputAnalysisModule.class, DpdkEthdevThroughputAnalysisModule.ID); + return module != null ? Collections.singletonList(DESCRIPTOR) : Collections.emptyList(); } } diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputEventHandler.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputEventHandler.java index 67cea0b7..fcc26940 100644 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputEventHandler.java +++ b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputEventHandler.java @@ -12,6 +12,7 @@ import java.util.Objects; +import org.eclipse.jdt.annotation.Nullable; import org.eclipse.tracecompass.incubator.internal.dpdk.core.Activator; import org.eclipse.tracecompass.incubator.internal.dpdk.core.analysis.DpdkEthdevEventLayout; import org.eclipse.tracecompass.incubator.internal.dpdk.core.analysis.IDpdkEventHandler; @@ -33,7 +34,9 @@ public class DpdkEthdevThroughputEventHandler implements IDpdkEventHandler { private static final String RX_Q = Objects.requireNonNull(DpdkEthdevThroughputAttributes.RX_Q); private static final String TX_Q = Objects.requireNonNull(DpdkEthdevThroughputAttributes.TX_Q); private static final String PKT_NB = Objects.requireNonNull(DpdkEthdevThroughputAttributes.PKT_COUNT); - private static final String PKT_SIZE = Objects.requireNonNull(DpdkEthdevThroughputAttributes.PKT_SIZE); + + private static final String PKT_NB_P = Objects.requireNonNull(DpdkEthdevThroughputAttributes.PKT_COUNT_P); + private static final String PKT_SIZE_P = Objects.requireNonNull(DpdkEthdevThroughputAttributes.PKT_SIZE_P); DpdkEthdevThroughputEventHandler() { // Nothing here @@ -64,64 +67,105 @@ static private void createNicQueues(ITmfStateSystemBuilder ssb, int queueSetQuar * Port identifier * @param queueId * Queue identifier - * @param queueCategory + * @param queueCategoryAttribute * Category of the target queue (RX or TX) + * @param isProfileEvent + * The event is emitted through pre-loading the custom profiling + * library * @param nbPkts * Number of packets received or transmitted * @param size * Size of the burst in bytes - * @param ts + * @param timestamp * Time to use for the state change */ - public void updateCounts(ITmfStateSystemBuilder ssb, Integer portId, Integer queueId, String queueCategory, Integer nbPkts, Integer size, long ts) { - int portQuark = ssb.getQuarkAbsoluteAndAdd(ETH_NICS, String.valueOf(portId)); - int qsQuark = ssb.getQuarkRelativeAndAdd(portQuark, queueCategory); - int queueQuark = ssb.getQuarkRelativeAndAdd(qsQuark, Objects.requireNonNull(queueId).toString()); + public void updateCounts(ITmfStateSystemBuilder ssb, Integer portId, Integer queueId, String queueCategoryAttribute, + boolean isProfileEvent, Integer nbPkts, @Nullable Integer size, long timestamp) { + int portQuark = ssb.getQuarkAbsoluteAndAdd(ETH_NICS, portId.toString()); + int queuesQuark = ssb.getQuarkRelativeAndAdd(portQuark, queueCategoryAttribute); + int queueQuark = ssb.getQuarkRelativeAndAdd(queuesQuark, queueId.toString()); try { - int pktNumberQuark = ssb.getQuarkRelativeAndAdd(queueQuark, PKT_NB); - StateSystemBuilderUtils.incrementAttributeLong(ssb, ts, pktNumberQuark, nbPkts); - int pktSizeQuark = ssb.getQuarkRelativeAndAdd(queueQuark, PKT_SIZE); - StateSystemBuilderUtils.incrementAttributeLong(ssb, ts, pktSizeQuark, size); + if (isProfileEvent) { + int pktSizeQuark = ssb.getQuarkRelativeAndAdd(queueQuark, PKT_SIZE_P); + StateSystemBuilderUtils.incrementAttributeLong(ssb, timestamp, pktSizeQuark, Objects.requireNonNull(size)); + + int pktNumberQuark = ssb.getQuarkRelativeAndAdd(queueQuark, PKT_NB_P); + StateSystemBuilderUtils.incrementAttributeLong(ssb, timestamp, pktNumberQuark, nbPkts); + } else { + int pktNumberQuark = ssb.getQuarkRelativeAndAdd(queueQuark, PKT_NB); + StateSystemBuilderUtils.incrementAttributeLong(ssb, timestamp, pktNumberQuark, nbPkts); + } } catch (StateValueTypeException e) { - Activator.getInstance().logWarning("Problem accessing the state of a NIC queue (Quark =" + String.valueOf(queueQuark) + ")"); //$NON-NLS-1$ //$NON-NLS-2$ + Activator.getInstance().logWarning("Problem accessing the state of a NIC queue (Quark = " + queueQuark + ")", e); //$NON-NLS-1$ //$NON-NLS-2$ } } @Override public void handleEvent(ITmfStateSystemBuilder ssb, ITmfEvent event) { - Integer portId = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldPortId()); - long ts = event.getTimestamp().getValue(); String eventName = event.getName(); + long timestamp = event.getTimestamp().getValue(); + Integer portId = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldPortId()); + Objects.requireNonNull(portId); if (eventName.equals(DpdkEthdevEventLayout.eventEthdevConfigure())) { - Integer rc = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldRc()); - Integer nbRxQueues = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldNbRxQ()); - Integer nbTxQueues = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldNbTxQ()); - - if (Objects.requireNonNull(rc) == 0) { - // save the new Ethernet device on the satet system - int portQuark = ssb.getQuarkAbsoluteAndAdd(ETH_NICS, String.valueOf(portId)); - int rxQueueQark = ssb.getQuarkRelativeAndAdd(portQuark, RX_Q); - createNicQueues(ssb, rxQueueQark, Objects.requireNonNull(nbRxQueues), ts); - int txQueueQark = ssb.getQuarkRelativeAndAdd(portQuark, TX_Q); - createNicQueues(ssb, txQueueQark, Objects.requireNonNull(nbTxQueues), ts); - } else { - Activator.getInstance().logWarning("The event " + DpdkEthdevEventLayout.eventEthdevConfigure() + " presents a Non-Null RC value"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - } else if (eventName.equals(DpdkEthdevEventLayout.eventProfileEthdevRxBurst()) || + handleConfigureEvent(ssb, event, portId, timestamp); + } else if (eventName.equals(DpdkEthdevEventLayout.eventEthdevRxBurstNonEmpty()) || + eventName.equals(DpdkEthdevEventLayout.eventProfileEthdevRxBurst())) { + handleRxBurstEvent(ssb, event, portId, timestamp, eventName); + } else if (eventName.equals(DpdkEthdevEventLayout.eventEthdevTxBurst()) || eventName.equals(DpdkEthdevEventLayout.eventProfileEthdevTxBurst())) { - Integer queueId = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldQueueId()); - Integer size = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldSize()); + handleTxBurstEvent(ssb, event, portId, timestamp, eventName); + } else { + Activator.getInstance().logError("Unknown event (" + eventName + ") !!"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } - if (eventName.equals(DpdkEthdevEventLayout.eventProfileEthdevRxBurst())) { - Integer nbRxPkts = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldNbRxPkts()); - updateCounts(ssb, Objects.requireNonNull(portId), Objects.requireNonNull(queueId), RX_Q, Objects.requireNonNull(nbRxPkts), Objects.requireNonNull(size), ts); - } else { - Integer nbTxPkts = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldNbTxPkts()); - updateCounts(ssb, Objects.requireNonNull(portId), Objects.requireNonNull(queueId), TX_Q, Objects.requireNonNull(nbTxPkts), Objects.requireNonNull(size), ts); - } + private static void handleConfigureEvent(ITmfStateSystemBuilder ssb, ITmfEvent event, Integer portId, long timestamp) { + Integer rc = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldRc()); + Integer nbRxQueues = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldNbRxQ()); + Integer nbTxQueues = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldNbTxQ()); + + if (rc != null && rc == 0 && nbRxQueues != null && nbTxQueues != null) { + int portQuark = ssb.getQuarkAbsoluteAndAdd(ETH_NICS, portId.toString()); + + int rxQueueQuark = ssb.getQuarkRelativeAndAdd(portQuark, RX_Q); + createNicQueues(ssb, rxQueueQuark, nbRxQueues, timestamp); + + int txQueueQuark = ssb.getQuarkRelativeAndAdd(portQuark, TX_Q); + createNicQueues(ssb, txQueueQuark, nbTxQueues, timestamp); + } else { + Activator.getInstance().logWarning(DpdkEthdevEventLayout.eventEthdevConfigure() + "event has invalid or missing fields"); //$NON-NLS-1$ + } + } + + private void handleRxBurstEvent(ITmfStateSystemBuilder ssb, ITmfEvent event, Integer portId, long timestamp, String eventName) { + Integer queueId = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldQueueId()); + Integer nbRxPkts = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldNbRxPkts()); + + Integer size = null; + + boolean isProfileEvent = eventName.equals(DpdkEthdevEventLayout.eventProfileEthdevRxBurst()); + if (isProfileEvent) { + size = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldSize()); } + + updateCounts(ssb, portId, Objects.requireNonNull(queueId), RX_Q, isProfileEvent, Objects.requireNonNull(nbRxPkts), size, timestamp); + } + + private void handleTxBurstEvent(ITmfStateSystemBuilder ssb, ITmfEvent event, Integer portId, long timestamp, String eventName) { + Integer nbTxPkts; + Integer size = null; + Integer queueId = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldQueueId()); + + boolean isProfileEvent = eventName.equals(DpdkEthdevEventLayout.eventProfileEthdevTxBurst()); + if (isProfileEvent) { + nbTxPkts = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldNbTxPkts()); + size = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldSize()); + } else { + nbTxPkts = event.getContent().getFieldValue(Integer.class, DpdkEthdevEventLayout.fieldNbPkts()); + } + + updateCounts(ssb, portId, Objects.requireNonNull(queueId), TX_Q, isProfileEvent, Objects.requireNonNull(nbTxPkts), size, timestamp); } } diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputPpsDataProvider.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputPpsDataProvider.java index b3967a19..cc99ad35 100644 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputPpsDataProvider.java +++ b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputPpsDataProvider.java @@ -8,7 +8,6 @@ * * SPDX-License-Identifier: EPL-2.0 **********************************************************************/ - package org.eclipse.tracecompass.incubator.internal.dpdk.core.ethdev.throughput.analysis; import java.util.ArrayList; @@ -22,148 +21,72 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.tracecompass.incubator.internal.dpdk.core.Activator; -import org.eclipse.tracecompass.incubator.internal.dpdk.core.analysis.DpdkEthdevEventLayout; -import org.eclipse.tracecompass.internal.analysis.os.linux.core.inputoutput.IODataPalette; import org.eclipse.tracecompass.internal.tmf.core.model.filters.FetchParametersUtils; import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem; import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException; import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException; import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval; import org.eclipse.tracecompass.tmf.core.dataprovider.DataType; -import org.eclipse.tracecompass.tmf.core.model.CommonStatusMessage; -import org.eclipse.tracecompass.tmf.core.model.IOutputStyleProvider; -import org.eclipse.tracecompass.tmf.core.model.OutputElementStyle; -import org.eclipse.tracecompass.tmf.core.model.OutputStyleModel; -import org.eclipse.tracecompass.tmf.core.model.StyleProperties; -import org.eclipse.tracecompass.tmf.core.model.YModel; import org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter; -import org.eclipse.tracecompass.tmf.core.model.tree.TmfTreeDataModel; -import org.eclipse.tracecompass.tmf.core.model.tree.TmfTreeModel; -import org.eclipse.tracecompass.tmf.core.model.xy.AbstractTreeCommonXDataProvider; import org.eclipse.tracecompass.tmf.core.model.xy.IYModel; import org.eclipse.tracecompass.tmf.core.model.xy.TmfXYAxisDescription; -import org.eclipse.tracecompass.tmf.core.response.ITmfResponse; -import org.eclipse.tracecompass.tmf.core.response.TmfModelResponse; import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils; -import org.eclipse.tracecompass.tmf.core.util.Pair; import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; /** * This data provider returns an XY model representing the throughput of - * transmitted or received network traffic in bits per second (bps). This model - * can be used to generate time-series charts that visualize the network's + * transmitted or received network traffic in packets per second (pps). This + * model can be used to generate time-series charts that visualize the network's * bandwidth usage over time. * * @author Adel Belkhiri */ -public class DpdkEthdevThroughputPpsDataProvider extends AbstractTreeCommonXDataProvider - implements IOutputStyleProvider { +public class DpdkEthdevThroughputPpsDataProvider extends AbstractDpdkEthdevThroughputDataProvider { - /** - * Extension point ID. - */ public static final String ID = "org.eclipse.tracecompass.incubator.dpdk.ethdev.throughput.pps.dataprovider"; //$NON-NLS-1$ - - /** - * Title used to create XY models for the - * {@link DpdkEthdevThroughputPpsDataProvider}. - */ - protected static final String PROVIDER_TITLE = Objects.requireNonNull("Dpdk Ethernet Device Throughput PPS"); //$NON-NLS-1$ - - private static final String BASE_STYLE = "base"; //$NON-NLS-1$ - private static final Map STATE_MAP; + protected static final String PROVIDER_TITLE = "Dpdk Ethernet Device Throughput - PPS"; //$NON-NLS-1$ private static final String BINARY_SPEED_UNIT = "/s"; //$NON-NLS-1$ - private static final String NICS_LABEL = Objects.requireNonNull(Messages.DpdkEthdev_ThroughputDataProvider_NICs); - private static final String RX_QS_LABEL = Objects.requireNonNull(Messages.DpdkEthdev_ThroughputDataProvider_NIC_RX); - private static final String TX_QS_LABEL = Objects.requireNonNull(Messages.DpdkEthdev_ThroughputDataProvider_NIC_TX); - private static final List> COLOR_LIST = IODataPalette.getColors(); - private static final TmfXYAxisDescription Y_AXIS_DESCRIPTION = new TmfXYAxisDescription(Objects.requireNonNull(Messages.DpdkEthdev_ThroughputDataProvider_YAxis), BINARY_SPEED_UNIT, DataType.NUMBER); - private static final List SUPPORTED_STYLES = ImmutableList.of( - StyleProperties.SeriesStyle.SOLID, - StyleProperties.SeriesStyle.DASH, - StyleProperties.SeriesStyle.DOT, - StyleProperties.SeriesStyle.DASHDOT, - StyleProperties.SeriesStyle.DASHDOTDOT); - - static { - // Create the base style - ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); - builder.put(BASE_STYLE, new OutputElementStyle(null, ImmutableMap.of(StyleProperties.SERIES_TYPE, StyleProperties.SeriesType.AREA, StyleProperties.WIDTH, 1.0f))); - STATE_MAP = builder.build(); - } + private static final TmfXYAxisDescription Y_AXIS_DESCRIPTION = new TmfXYAxisDescription( + Objects.requireNonNull(Messages.DpdkEthdev_ThroughputPpsDataProvider_YAxis), BINARY_SPEED_UNIT, DataType.NUMBER); /** - * Class for encapsulating all the values required to build a series. + * Class for generating data series representing packets RX/TX rates */ - private static final class NicQueueBuilder { - - private static final double SECONDS_PER_NANOSECOND = 1E-9; - private final long fId; - /** - * This series' represent the number of packets received or transmitted - * by a NIC port queue - */ - public final int fQueueQuark; - private final String fName; - private final double[] fValues; - private double fPrevCount; + protected class NicQueueBuilder extends AbstractNicQueueBuilder { + private final boolean fIsProfileMetric; /** * Constructor * * @param id - * The series Id + * The unique identifier for this data series * @param nicQueueQuark - * The queue's quark + * The quark representing the target NIC queue in the state system + * @param isProfileMetric + * {@code true} if the values are generated from profiling events; {@code false} otherwise. * @param name - * The name of this series + * The name of this data series * @param length - * The length of the series + * The number of data points in this series */ - private NicQueueBuilder(long id, int nicQueueQuark, String name, int length) { - fId = id; - fQueueQuark = nicQueueQuark; - fName = name; - fValues = new double[length]; + protected NicQueueBuilder(long id, int nicQueueQuark, boolean isProfileMetric, String name, int length) { + super(id, nicQueueQuark, name, length); + fIsProfileMetric = isProfileMetric; } - private void setPrevCount(double prevCount) { - fPrevCount = prevCount; - } - - /** - * Update the value for the counter at the desired index. - * - * @param pos - * The index to update - * @param newCount - * The new number of received or transmitted packets - * @param deltaT - * The time difference to the previous value for - * interpolation - */ - private void updateValue(int pos, double newCount, long deltaT) { - /** - * Linear interpolation to compute the queue throughput between time - * and the previous time, from the number of packets received or - * sent at each time. - */ + @Override + protected void updateValue(int pos, double newCount, long deltaT) { fValues[pos] = (newCount - fPrevCount) / (SECONDS_PER_NANOSECOND * deltaT); fPrevCount = newCount; } - - private IYModel build() { - return new YModel(fId, fName, fValues, Y_AXIS_DESCRIPTION); - } } /** - * Create an instance of {@link DpdkEthdevThroughputPpsDataProvider}. Returns - * a null instance if the analysis module is not found. + * Create an instance of {@link DpdkEthdevThroughputPpsDataProvider}. + * Returns a null instance if the analysis module is not found. * * @param trace * A trace on which we are interested to fetch a model @@ -171,134 +94,33 @@ private IYModel build() { * analysis module is not found, it returns null */ public static @Nullable DpdkEthdevThroughputPpsDataProvider create(ITmfTrace trace) { - DpdkEthdevThroughputAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, DpdkEthdevThroughputAnalysisModule.class, DpdkEthdevThroughputAnalysisModule.ID); - if (module != null) { - module.schedule(); - return new DpdkEthdevThroughputPpsDataProvider(trace, module); - } - return null; + DpdkEthdevThroughputAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, + DpdkEthdevThroughputAnalysisModule.class, DpdkEthdevThroughputAnalysisModule.ID); + return module != null ? new DpdkEthdevThroughputPpsDataProvider(trace, module) : null; } - /** - * Constructor - */ private DpdkEthdevThroughputPpsDataProvider(ITmfTrace trace, DpdkEthdevThroughputAnalysisModule module) { super(trace, module); } @Override - public String getId() { - return ID; - } - - /** - * Get parts of the XY tree that are related to Rx and Tx queues - * - * @param ss - * State System - * @param qsQuark - * Queues list quark - * @param nicName - * Name of the NIC to which the queues belong - * @param nicId - * Id of the related NIC - * @return a list of TmfTreeDataModel - */ - List getQueuesTree(ITmfStateSystem ss, int qsQuark, String nicName, long nicId) { - int i = 0; - List nodes = new ArrayList<>(); - boolean isRxQueue = true; - - try { - if (ss.getAttributeName(qsQuark).equals(DpdkEthdevThroughputAttributes.TX_Q)) { - isRxQueue = false; - } - - long qsId = getId(qsQuark); - nodes.add(new TmfTreeDataModel(qsId, nicId, Collections.singletonList(isRxQueue ? RX_QS_LABEL : TX_QS_LABEL), false, null)); - for (Integer queueQuark : ss.getSubAttributes(qsQuark, false)) { - String queueName = ss.getAttributeName(queueQuark); - long queueId = getId(queueQuark); - - // Get receive or send colors for this queue - Pair pair = COLOR_LIST.get(i % COLOR_LIST.size()); - String seriesStyle = SUPPORTED_STYLES.get((i / COLOR_LIST.size()) % SUPPORTED_STYLES.size()); - - if (queueQuark != ITmfStateSystem.INVALID_ATTRIBUTE) { - nodes.add(new TmfTreeDataModel(queueId, qsId, Collections.singletonList(queueName), true, - new OutputElementStyle(BASE_STYLE, ImmutableMap.of( - StyleProperties.COLOR, isRxQueue ? pair.getFirst() : pair.getSecond(), - StyleProperties.SERIES_STYLE, seriesStyle, - StyleProperties.STYLE_NAME, - nicName + '/' + RX_QS_LABEL + '/' + queueName)))); - } - - i++; - } - } catch (IndexOutOfBoundsException e) { - Activator.getInstance().logWarning("A DPDK event (" + DpdkEthdevEventLayout.eventEthdevConfigure() + ") is missing"); //$NON-NLS-1$ //$NON-NLS-2$ - } - return nodes; + protected String getTitle() { + return PROVIDER_TITLE; } @Override - protected TmfTreeModel getTree(ITmfStateSystem ss, Map parameters, @Nullable IProgressMonitor monitor) { - List nodes = new ArrayList<>(); - long rootId = getId(ITmfStateSystem.ROOT_ATTRIBUTE); - nodes.add(new TmfTreeDataModel(rootId, -1, Collections.singletonList(Objects.requireNonNull(getTrace().getName())), false, null)); - - try { - int nicsQuark = ss.getQuarkAbsolute(DpdkEthdevThroughputAttributes.NICS); - long nicsId = getId(nicsQuark); - nodes.add(new TmfTreeDataModel(nicsId, rootId, Collections.singletonList(NICS_LABEL), false, null)); - - for (Integer nicQuark : ss.getQuarks(DpdkEthdevThroughputAttributes.NICS, "*")) { //$NON-NLS-1$ - String nicName = ss.getAttributeName(nicQuark); - long nicId = getId(nicQuark); - nodes.add(new TmfTreeDataModel(nicId, nicsId, Collections.singletonList(nicName), false, null)); - - int rxQsQuark = ss.optQuarkRelative(nicQuark, DpdkEthdevThroughputAttributes.RX_Q); - int txQsQuark = ss.optQuarkRelative(nicQuark, DpdkEthdevThroughputAttributes.TX_Q); - if (rxQsQuark == ITmfStateSystem.INVALID_ATTRIBUTE && txQsQuark == ITmfStateSystem.INVALID_ATTRIBUTE) { - continue; - } - - nodes.addAll(getQueuesTree(ss, rxQsQuark, nicName, nicId)); - nodes.addAll(getQueuesTree(ss, txQsQuark, nicName, nicId)); - - } - } catch (AttributeNotFoundException e) { - Activator.getInstance().logError("Error getting the root attribute of " + DpdkEthdevThroughputAttributes.NICS); //$NON-NLS-1$ - } - return new TmfTreeModel<>(Collections.emptyList(), nodes); - } - - /** - * Extract a packets counts - * - * @param queueQuark - * NIC queue quark - * @param states - * ITmfStateInterval state values - * @return number of packets received or sent from the RX/TX queue - */ - public static double extractCount(int queueQuark, ITmfStateSystem ss, List states) { - double count = 0.0; - try { - int metricQuark = ss.getQuarkRelative(queueQuark, DpdkEthdevThroughputAttributes.PKT_COUNT); - Object stateValue = states.get(metricQuark).getValue(); - count = (stateValue instanceof Number) ? ((Number) stateValue).doubleValue() : 0.0; - } catch (AttributeNotFoundException e) { - } - return count; + public String getId() { + return ID; } @Override - protected @Nullable Collection getYSeriesModels(ITmfStateSystem ss, Map fetchParameters, @Nullable IProgressMonitor monitor) throws StateSystemDisposedException { + protected @Nullable Collection getYSeriesModels(ITmfStateSystem ss, Map fetchParameters, + @Nullable IProgressMonitor monitor) throws StateSystemDisposedException { SelectionTimeQueryFilter filter = FetchParametersUtils.createSelectionTimeQuery(fetchParameters); if (filter == null) { return null; } + long[] xValues = filter.getTimesRequested(); List builders = initBuilders(ss, filter); if (builders.isEmpty()) { @@ -307,12 +129,12 @@ public static double extractCount(int queueQuark, ITmfStateSystem ss, List= ss.getStartTime() && prevTime <= currentEnd) { - // reuse the results from the full query List states = ss.queryFullState(prevTime); - for (NicQueueBuilder entry : builders) { - entry.setPrevCount(extractCount(entry.fQueueQuark, ss, states)); + for (NicQueueBuilder builder : builders) { + builder.setPrevCount(extractCount(ss, states, builder.fQueueQuark, builder.fIsProfileMetric)); } } @@ -326,54 +148,69 @@ public static double extractCount(int queueQuark, ITmfStateSystem ss, List= ss.getStartTime()) { List states = ss.queryFullState(time); - for (NicQueueBuilder entry : builders) { - double count = extractCount(entry.fQueueQuark, ss, states); - entry.updateValue(i, count, time - prevTime); + for (NicQueueBuilder builder : builders) { + double count = extractCount(ss, states, builder.fQueueQuark, builder.fIsProfileMetric); + builder.updateValue(i, count, time - prevTime); } } prevTime = time; } - return ImmutableList.copyOf(Iterables.transform(builders, NicQueueBuilder::build)); + + return ImmutableList.copyOf(Iterables.transform(builders, builder -> builder.build(Y_AXIS_DESCRIPTION))); + } + + /** + * Extract a packets counts + * + * @param ss + * State system + * @param queueQuark + * NIC queue quark + * @param states + * ITmfStateInterval state values + * @param isProfileMetric + * Whether the metric attribute was generated via the profiling + * library or not + * @return number of packets received or sent from the RX/TX queue + */ + private static double extractCount(ITmfStateSystem ss, List states, int queueQuark, boolean isProfileMetric) { + try { + int metricQuark = isProfileMetric + ? ss.getQuarkRelative(queueQuark, DpdkEthdevThroughputAttributes.PKT_COUNT_P) + : ss.getQuarkRelative(queueQuark, DpdkEthdevThroughputAttributes.PKT_COUNT); + + Object stateValue = states.get(metricQuark).getValue(); + return stateValue instanceof Number ? ((Number) stateValue).doubleValue() : 0.0; + } catch (AttributeNotFoundException | IndexOutOfBoundsException e) { + Activator.getInstance().logError("Error accessing packets count on state system", e); //$NON-NLS-1$ + return 0.0; + } } - private List initBuilders(ITmfStateSystem ss, SelectionTimeQueryFilter filter) { + @Override + protected List initBuilders(ITmfStateSystem ss, SelectionTimeQueryFilter filter) { int length = filter.getTimesRequested().length; List builders = new ArrayList<>(); for (Entry entry : getSelectedEntries(filter).entrySet()) { - long id = Objects.requireNonNull(entry.getKey()); - int quark = Objects.requireNonNull(entry.getValue()); + long id = entry.getKey(); + int quark = entry.getValue(); - if ((quark == ITmfStateSystem.ROOT_ATTRIBUTE) || - (ss.getParentAttributeQuark(quark) == ITmfStateSystem.ROOT_ATTRIBUTE)) { + if (quark == ITmfStateSystem.ROOT_ATTRIBUTE || ss.getParentAttributeQuark(quark) == ITmfStateSystem.ROOT_ATTRIBUTE) { continue; } int parentQuark = ss.getParentAttributeQuark(quark); if (parentQuark != ITmfStateSystem.INVALID_ATTRIBUTE && - ((ss.getAttributeName(parentQuark).equals(DpdkEthdevThroughputAttributes.RX_Q) || - ss.getAttributeName(parentQuark).equals(DpdkEthdevThroughputAttributes.TX_Q)))) { + (DpdkEthdevThroughputAttributes.RX_Q.equals(ss.getAttributeName(parentQuark)) || + DpdkEthdevThroughputAttributes.TX_Q.equals(ss.getAttributeName(parentQuark)))) { int nicQuark = ss.getParentAttributeQuark(parentQuark); String name = getTrace().getName() + '/' + ss.getAttributeName(nicQuark) + '/' + ss.getAttributeName(parentQuark) + '/' + ss.getAttributeName(quark); - builders.add(new NicQueueBuilder(id, quark, name, length)); - } + boolean isProfileMetric = ss.getAttributeName(quark).equals(DpdkEthdevThroughputAttributes.PKT_COUNT_P); + builders.add(new NicQueueBuilder(id, quark, isProfileMetric, name, length)); + } } return builders; } - - @Override - protected boolean isCacheable() { - return true; - } - - @Override - protected String getTitle() { - return PROVIDER_TITLE; - } - - @Override - public TmfModelResponse fetchStyle(Map fetchParameters, @Nullable IProgressMonitor monitor) { - return new TmfModelResponse<>(new OutputStyleModel(STATE_MAP), ITmfResponse.Status.COMPLETED, CommonStatusMessage.COMPLETED); - } } diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputPpsDataProviderFactory.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputPpsDataProviderFactory.java index e230aaed..5ca4ae61 100644 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputPpsDataProviderFactory.java +++ b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputPpsDataProviderFactory.java @@ -21,14 +21,9 @@ import org.eclipse.tracecompass.tmf.core.model.DataProviderDescriptor; import org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel; import org.eclipse.tracecompass.tmf.core.model.xy.ITmfTreeXYDataProvider; -import org.eclipse.tracecompass.tmf.core.model.xy.TmfTreeXYCompositeDataProvider; import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace; -import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager; import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils; -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; - /** * Factory to create instances of the * {@link DpdkEthdevThroughputPpsDataProvider}. @@ -36,27 +31,26 @@ * @author Adel Belkhiri */ public class DpdkEthdevThroughputPpsDataProviderFactory implements IDataProviderFactory { - private static final Predicate PREDICATE = t -> TmfTraceUtils.getAnalysisModuleOfClass(t, DpdkEthdevThroughputAnalysisModule.class, DpdkEthdevThroughputAnalysisModule.ID) != null; private static final IDataProviderDescriptor DESCRIPTOR = new DataProviderDescriptor.Builder() .setId( DpdkEthdevThroughputPpsDataProvider.ID) .setName("Dpdk Ethernet Throughput PPS") //$NON-NLS-1$ - .setDescription("XY chart illustrating the throughput of DPDK Ethernet NIC ports in terms of PPS") //$NON-NLS-1$ + .setDescription("XY chart illustrating the throughput of DPDK Ethernet NIC queues in PPS") //$NON-NLS-1$ .setProviderType(ProviderType.TREE_TIME_XY) .build(); @Override public @Nullable ITmfTreeXYDataProvider createProvider(ITmfTrace trace) { - Collection traces = TmfTraceManager.getTraceSet(trace); - if (traces.size() == 1) { - return DpdkEthdevThroughputPpsDataProvider.create(trace); + DpdkEthdevThroughputAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, DpdkEthdevThroughputAnalysisModule.class, DpdkEthdevThroughputAnalysisModule.ID); + if (module == null) { + return null; } - return TmfTreeXYCompositeDataProvider.create(traces, DpdkEthdevThroughputPpsDataProvider.PROVIDER_TITLE, DpdkEthdevThroughputPpsDataProvider.ID); + module.schedule(); + return DpdkEthdevThroughputPpsDataProvider.create(trace); } @Override public Collection getDescriptors(ITmfTrace trace) { - Collection traces = TmfTraceManager.getTraceSet(trace); - return Iterables.any(traces, PREDICATE) ? Collections.singletonList(DESCRIPTOR) : Collections.emptyList(); + DpdkEthdevThroughputAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, DpdkEthdevThroughputAnalysisModule.class, DpdkEthdevThroughputAnalysisModule.ID); + return module != null ? Collections.singletonList(DESCRIPTOR) : Collections.emptyList(); } - } diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputStateProvider.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputStateProvider.java index b42628ee..93fdab25 100644 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputStateProvider.java +++ b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/DpdkEthdevThroughputStateProvider.java @@ -22,11 +22,11 @@ import com.google.common.collect.ImmutableMap; /** - * state provider for the {@link DpdkEthdevThroughputAnalysisModule} analysis + * State provider for the {@link DpdkEthdevThroughputAnalysisModule} analysis * * @author Adel Belkhiri */ -public class DpdkEthdevStateProvider extends AbstractDpdkStateProvider { +public class DpdkEthdevThroughputStateProvider extends AbstractDpdkStateProvider { private static final int VERSION = 1; @@ -41,7 +41,7 @@ public class DpdkEthdevStateProvider extends AbstractDpdkStateProvider { * @param id * id */ - protected DpdkEthdevStateProvider(ITmfTrace trace, String id) { + protected DpdkEthdevThroughputStateProvider(ITmfTrace trace, String id) { super(trace, id); } @@ -58,18 +58,21 @@ public int getVersion() { */ @Override public ITmfStateProvider getNewInstance() { - return new DpdkEthdevStateProvider(this.getTrace(), DpdkEthdevThroughputAnalysisModule.ID); + return new DpdkEthdevThroughputStateProvider(this.getTrace(), DpdkEthdevThroughputAnalysisModule.ID); } - - @Override protected @Nullable IDpdkEventHandler getEventHandler(String eventName) { if (fEventNames == null) { ImmutableMap.Builder builder = ImmutableMap.builder(); IDpdkEventHandler ethdevEventHandler = new DpdkEthdevThroughputEventHandler(); builder.put(DpdkEthdevEventLayout.eventEthdevConfigure(), ethdevEventHandler); - //Events generated when using the custom profiling library + builder.put(DpdkEthdevEventLayout.eventEthdevRxBurstNonEmpty(), ethdevEventHandler); + builder.put(DpdkEthdevEventLayout.eventEthdevTxBurst(), ethdevEventHandler); + /* + * The following events are emitted only when the custom profiling + * library is pre-loaded + */ builder.put(DpdkEthdevEventLayout.eventProfileEthdevTxBurst(), ethdevEventHandler); builder.put(DpdkEthdevEventLayout.eventProfileEthdevRxBurst(), ethdevEventHandler); fEventNames = builder.build(); diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/Messages.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/Messages.java index 626e91cb..69bd6e95 100644 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/Messages.java +++ b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/Messages.java @@ -8,7 +8,6 @@ * * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ - package org.eclipse.tracecompass.incubator.internal.dpdk.core.ethdev.throughput.analysis; import org.eclipse.jdt.annotation.Nullable; @@ -25,7 +24,8 @@ public class Messages extends NLS { public static @Nullable String DpdkEthdev_ThroughputDataProvider_NICs; public static @Nullable String DpdkEthdev_ThroughputDataProvider_NIC_RX; public static @Nullable String DpdkEthdev_ThroughputDataProvider_NIC_TX; - public static @Nullable String DpdkEthdev_ThroughputDataProvider_YAxis; + public static @Nullable String DpdkEthdev_ThroughputBpsDataProvider_YAxis; + public static @Nullable String DpdkEthdev_ThroughputPpsDataProvider_YAxis; static { // initialize resource bundle diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/messages.properties b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/messages.properties index 3ebe3c27..3a5284e7 100644 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/messages.properties +++ b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/messages.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2018 Ericsson +# Copyright (c) 2024 École Polytechnique de Montréal # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License 2.0 @@ -12,4 +12,5 @@ DpdkEthdev_ThroughputDataProvider_NICs=NIC Port DpdkEthdev_ThroughputDataProvider_NIC_RX=RX DpdkEthdev_ThroughputDataProvider_NIC_TX=TX -DpdkEthdev_ThroughputDataProvider_YAxis=Throughput +DpdkEthdev_ThroughputBpsDataProvider_YAxis=Throughput (bps) +DpdkEthdev_ThroughputPpsDataProvider_YAxis=Throughput (pps) diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/package-info.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/package-info.java index 9df53ef9..55642fee 100644 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/package-info.java +++ b/analyses/org.eclipse.tracecompass.incubator.dpdk.core/src/org/eclipse/tracecompass/incubator/internal/dpdk/core/ethdev/throughput/analysis/package-info.java @@ -1,5 +1,5 @@ /********************************************************************** - * Copyright (c) 2023 École Polytechnique de Montréal + * Copyright (c) 2024 École Polytechnique de Montréal * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License 2.0 which diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/plugin.xml b/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/plugin.xml index a85baec4..077a271c 100644 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/plugin.xml +++ b/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/plugin.xml @@ -20,9 +20,9 @@ + id="org.eclipse.tracecompass.incubator.dpdk.ethdev.throughput.pps.view"> + class="org.eclipse.tracecompass.incubator.internal.dpdk.core.ethdev.throughput.analysis.DpdkEthdevThroughputAnalysisModule"> diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/bps/Messages.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/bps/Messages.java index 25866d10..3f01b6b2 100644 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/bps/Messages.java +++ b/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/bps/Messages.java @@ -9,28 +9,28 @@ * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.tracecompass.incubator.internal.dpdk.ui.ethdev.throughput; +package org.eclipse.tracecompass.incubator.internal.dpdk.ui.ethdev.throughput.bps; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.osgi.util.NLS; /** - * Messages for the {@link NicQueueThroughputView} view + * Messages for the {@link NicQueueThroughputBpsView} view * * @author Adel Belkhiri */ public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.tracecompass.incubator.internal.dpdk.ui.ethdev.throughput.messages"; //$NON-NLS-1$ + private static final String BUNDLE_NAME = "org.eclipse.tracecompass.incubator.internal.dpdk.ui.ethdev.throughput.bps.messages"; //$NON-NLS-1$ /** Title of the Disk I/O view */ - public static @Nullable String EthdevThroughputView_Title; + public static @Nullable String EthdevThroughputBpsView_Title; /** Title of the Disk I/O activity viewer */ - public static @Nullable String EthdevThroughputViewer_Title; + public static @Nullable String EthdevThroughputBpsViewer_Title; /** X axis caption */ - public static @Nullable String EthdevThroughputViewer_XAxis; + public static @Nullable String EthdevThroughputBpsViewer_XAxis; /** Disk Name column */ - public static @Nullable String EthdevThroughputTreeViewer_NicName; + public static @Nullable String EthdevThroughputBpsTreeViewer_NicName; /** Legend Column*/ - public static @Nullable String EthdevThroughputTreeViewer_Legend; + public static @Nullable String EthdevThroughputBpsTreeViewer_Legend; static { // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, Messages.class); diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/bps/NicQueueThroughputBpsView.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/bps/NicQueueThroughputBpsView.java index c4b2b6f6..1f20af4f 100644 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/bps/NicQueueThroughputBpsView.java +++ b/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/bps/NicQueueThroughputBpsView.java @@ -8,7 +8,7 @@ * * SPDX-License-Identifier: EPL-2.0 **********************************************************************/ -package org.eclipse.tracecompass.incubator.internal.dpdk.ui.ethdev.throughput; +package org.eclipse.tracecompass.incubator.internal.dpdk.ui.ethdev.throughput.bps; import java.util.Comparator; @@ -33,7 +33,7 @@ * * @author Adel Belkhiri */ -public class NicQueueThroughputView extends TmfChartView { +public class NicQueueThroughputBpsView extends TmfChartView { /** * Identifier of this view @@ -44,13 +44,13 @@ public class NicQueueThroughputView extends TmfChartView { /** * Default constructor */ - public NicQueueThroughputView() { - super(Messages.EthdevThroughputView_Title); + public NicQueueThroughputBpsView() { + super(Messages.EthdevThroughputBpsView_Title); } @Override protected TmfXYChartViewer createChartViewer(Composite parent) { - TmfXYChartSettings settings = new TmfXYChartSettings(Messages.EthdevThroughputViewer_Title, Messages.EthdevThroughputViewer_XAxis, null, RESOLUTION); + TmfXYChartSettings settings = new TmfXYChartSettings(Messages.EthdevThroughputBpsViewer_Title, Messages.EthdevThroughputBpsViewer_XAxis, null, RESOLUTION); return new TmfFilteredXYChartViewer(parent, settings, DpdkEthdevThroughputBpsDataProvider.ID); } @@ -61,8 +61,8 @@ protected TmfXYChartViewer createChartViewer(Composite parent) { protected ITmfTreeColumnDataProvider getColumnDataProvider() { return () -> { return ImmutableList.of( - createColumn(Messages.EthdevThroughputTreeViewer_NicName, Comparator.comparing(TmfGenericTreeEntry::getName)), - new TmfTreeColumnData(Messages.EthdevThroughputTreeViewer_Legend)); + createColumn(Messages.EthdevThroughputBpsTreeViewer_NicName, Comparator.comparing(TmfGenericTreeEntry::getName)), + new TmfTreeColumnData(Messages.EthdevThroughputBpsTreeViewer_Legend)); }; } }; diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/bps/messages.properties b/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/bps/messages.properties index 7a6a1bfc..496c46a0 100644 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/bps/messages.properties +++ b/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/bps/messages.properties @@ -8,8 +8,8 @@ # # SPDX-License-Identifier: EPL-2.0 ############################################################################### -EthdevThroughputView_Title=NIC Throughput View -EthdevThroughputViewer_Title=NIC Throughput View -EthdevThroughputViewer_XAxis=Time -EthdevThroughputTreeViewer_NicName=NIC Port ID -EthdevThroughputTreeViewer_Legend=Legend +EthdevThroughputBpsView_Title=NIC Throughput View +EthdevThroughputBpsViewer_Title=NIC Throughput View +EthdevThroughputBpsViewer_XAxis=Time +EthdevThroughputBpsTreeViewer_NicName=NIC Port ID +EthdevThroughputBpsTreeViewer_Legend=Legend diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/bps/package-info.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/bps/package-info.java index 0628c437..878397b0 100644 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/bps/package-info.java +++ b/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/bps/package-info.java @@ -8,4 +8,4 @@ * * SPDX-License-Identifier: EPL-2.0 **********************************************************************/ -package org.eclipse.tracecompass.incubator.internal.dpdk.ui.ethdev.throughput; +package org.eclipse.tracecompass.incubator.internal.dpdk.ui.ethdev.throughput.bps; diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/pps/Messages.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/pps/Messages.java index b6faba7b..0f49ab33 100644 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/pps/Messages.java +++ b/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/pps/Messages.java @@ -9,28 +9,28 @@ * SPDX-License-Identifier: EPL-2.0 *******************************************************************************/ -package org.eclipse.tracecompass.incubator.internal.dpdk.ui.ethdev.rate; +package org.eclipse.tracecompass.incubator.internal.dpdk.ui.ethdev.throughput.pps; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.osgi.util.NLS; /** - * Translatable strings for the {@link NicQueueRateView} View + * Translatable strings for the {@link NicQueueThroughputPpsView} View * * @author Houssem Daoud */ public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.tracecompass.incubator.internal.dpdk.ui.ethdev.rate.messages"; //$NON-NLS-1$ + private static final String BUNDLE_NAME = "org.eclipse.tracecompass.incubator.internal.dpdk.ui.ethdev.throughput.pps.messages"; //$NON-NLS-1$ /** Title of the Disk I/O view */ - public static @Nullable String EthdevRateView_Title; + public static @Nullable String EthdevThroughputPpsView_Title; /** Title of the Disk I/O activity viewer */ - public static @Nullable String EthdevRateViewer_Title; + public static @Nullable String EthdevThroughputPpsViewer_Title; /** X axis caption */ - public static @Nullable String EthdevRateViewer_XAxis; + public static @Nullable String EthdevThroughputPpsViewer_XAxis; /** Disk Name column */ - public static @Nullable String EthdevRateTreeViewer_NicName; + public static @Nullable String EthdevThroughputPpsTreeViewer_NicName; /** Legend Column*/ - public static @Nullable String EthdevRateTreeViewer_Legend; + public static @Nullable String EthdevThroughputPpsTreeViewer_Legend; static { // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, Messages.class); diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/pps/NicQueueThroughputPpsView.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/pps/NicQueueThroughputPpsView.java index ae4dee73..eff9b4e9 100644 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/pps/NicQueueThroughputPpsView.java +++ b/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/pps/NicQueueThroughputPpsView.java @@ -8,14 +8,14 @@ * * SPDX-License-Identifier: EPL-2.0 **********************************************************************/ -package org.eclipse.tracecompass.incubator.internal.dpdk.ui.ethdev.rate; +package org.eclipse.tracecompass.incubator.internal.dpdk.ui.ethdev.throughput.pps; import java.util.Comparator; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.swt.widgets.Composite; -import org.eclipse.tracecompass.incubator.internal.dpdk.core.ethdev.rate.analysis.DpdkEthdevRateDataProvider; +import org.eclipse.tracecompass.incubator.internal.dpdk.core.ethdev.throughput.analysis.DpdkEthdevThroughputPpsDataProvider; import org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer; import org.eclipse.tracecompass.tmf.ui.viewers.tree.AbstractSelectTreeViewer2; import org.eclipse.tracecompass.tmf.ui.viewers.tree.ITmfTreeColumnDataProvider; @@ -33,36 +33,36 @@ * * @author Adel Belkhiri */ -public class NicQueueRateView extends TmfChartView { +public class NicQueueThroughputPpsView extends TmfChartView { /** * Identifier of this view */ - public static final String ID = "org.eclipse.tracecompass.incubator.dpdk.ethdev.rate.view"; //$NON-NLS-1$ + public static final String ID = "org.eclipse.tracecompass.incubator.dpdk.ethdev.throughput.pps.view"; //$NON-NLS-1$ private static final double RESOLUTION = 0.2; /** * Default constructor */ - public NicQueueRateView() { - super(Messages.EthdevRateView_Title); + public NicQueueThroughputPpsView() { + super(Messages.EthdevThroughputPpsView_Title); } @Override protected TmfXYChartViewer createChartViewer(Composite parent) { - TmfXYChartSettings settings = new TmfXYChartSettings(Messages.EthdevRateViewer_Title, Messages.EthdevRateViewer_XAxis, null, RESOLUTION); - return new TmfFilteredXYChartViewer(parent, settings, DpdkEthdevRateDataProvider.ID); + TmfXYChartSettings settings = new TmfXYChartSettings(Messages.EthdevThroughputPpsViewer_Title, Messages.EthdevThroughputPpsViewer_XAxis, null, RESOLUTION); + return new TmfFilteredXYChartViewer(parent, settings, DpdkEthdevThroughputPpsDataProvider.ID); } @Override protected @NonNull TmfViewer createLeftChildViewer(@Nullable Composite parent) { - return new AbstractSelectTreeViewer2(parent, 1, DpdkEthdevRateDataProvider.ID) { + return new AbstractSelectTreeViewer2(parent, 1, DpdkEthdevThroughputPpsDataProvider.ID) { @Override protected ITmfTreeColumnDataProvider getColumnDataProvider() { return () -> { return ImmutableList.of( - createColumn(Messages.EthdevRateTreeViewer_NicName, Comparator.comparing(TmfGenericTreeEntry::getName)), - new TmfTreeColumnData(Messages.EthdevRateTreeViewer_Legend)); + createColumn(Messages.EthdevThroughputPpsTreeViewer_NicName, Comparator.comparing(TmfGenericTreeEntry::getName)), + new TmfTreeColumnData(Messages.EthdevThroughputPpsTreeViewer_Legend)); }; } }; diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/pps/messages.properties b/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/pps/messages.properties index 285641f2..dd6e9e63 100644 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/pps/messages.properties +++ b/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/pps/messages.properties @@ -8,8 +8,8 @@ # # SPDX-License-Identifier: EPL-2.0 ############################################################################### -EthdevRateView_Title=NIC Rate View -EthdevRateViewer_Title=NIC Rate View -EthdevRateViewer_XAxis=Time -EthdevRateTreeViewer_NicName=NIC Port ID -EthdevRateTreeViewer_Legend=Legend +EthdevThroughputPpsView_Title=NIC Rate View +EthdevThroughputPpsViewer_Title=NIC Rate View +EthdevThroughputPpsViewer_XAxis=Time +EthdevThroughputPpsTreeViewer_NicName=NIC Port ID +EthdevThroughputPpsTreeViewer_Legend=Legend diff --git a/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/pps/package-info.java b/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/pps/package-info.java index 47ef48df..963a8f37 100644 --- a/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/pps/package-info.java +++ b/analyses/org.eclipse.tracecompass.incubator.dpdk.ui/src/org/eclipse/tracecompass/incubator/internal/dpdk/ui/ethdev/throughput/pps/package-info.java @@ -8,4 +8,4 @@ * * SPDX-License-Identifier: EPL-2.0 **********************************************************************/ -package org.eclipse.tracecompass.incubator.internal.dpdk.ui.ethdev.rate; +package org.eclipse.tracecompass.incubator.internal.dpdk.ui.ethdev.throughput.pps;