Skip to content

Commit

Permalink
linux.core: Add Priority/Thread name stats view for SWSLatency analysis
Browse files Browse the repository at this point in the history
This commit adds view and viewer classes for the Priority/Thread name
statistics view. It also adds the view to SWS Latency analysis. The view
groups entries in the SWS Latency analysis based on priority and name.

[Added] Priority/Thread name statistics view for SWSLatency analysis

Change-Id: I003932ae82f8c6594a9866f8da4bb9cfe2131f06
Signed-off-by: Hoang Thuan Pham <hoang.pham@calian.ca>
Reviewed-on: https://git.eclipse.org/r/c/tracecompass/org.eclipse.tracecompass/+/204188
Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
  • Loading branch information
hoangphamEclipse authored and PatrickTasse committed Oct 13, 2023
1 parent 34d2520 commit 501cd49
Show file tree
Hide file tree
Showing 7 changed files with 161 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,11 @@
id="org.eclipse.tracecompass.internal.analysis.os.linux.core.threadstatus.ResourcesStatusDataProvider">
</dataProviderFactory>
</extension>
<extension
point="org.eclipse.tracecompass.tmf.core.dataprovider">
<dataProviderFactory
class="org.eclipse.tracecompass.internal.analysis.os.linux.core.segmentstore.PriorityThreadNameStatisticsDataProviderFactory"
id="org.eclipse.tracecompass.internal.analysis.os.linux.core.segmentstore.PriorityThreadNameStatisticsDataProvider">
</dataProviderFactory>
</extension>
</plugin>
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.eclipse.tracecompass.datastore.core.interval.IHTIntervalReader;
import org.eclipse.tracecompass.datastore.core.serialization.ISafeByteBufferWriter;
import org.eclipse.tracecompass.datastore.core.serialization.SafeByteBufferFactory;
import org.eclipse.tracecompass.internal.analysis.os.linux.core.segmentstore.IPrioritySegment;
import org.eclipse.tracecompass.segmentstore.core.ISegment;
import org.eclipse.tracecompass.segmentstore.core.segment.interfaces.INamedSegment;
import org.eclipse.tracecompass.tmf.core.model.ICoreElementResolver;
Expand All @@ -29,7 +30,7 @@
* @author Abdellah Rahmani
* @since 8.1
*/
public final class SchedWS implements INamedSegment, ICoreElementResolver {
public final class SchedWS implements INamedSegment, IPrioritySegment, ICoreElementResolver {

private static final long serialVersionUID = 4183872871733170072L;

Expand Down Expand Up @@ -132,6 +133,7 @@ public int getTid() {
*
* @return The priority value of the thread
*/
@Override
public int getPriority() {
return fPriority;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ diskioactivity.view.name = Disk I/O Activity
swslatency.table.view.name = Sched_Wakeup/Switch Latencies
swslatency.scatter.view.name = Sched_Wakeup/Switch Latency vs Time
swslatency.stats.view.name = Sched_Wakeup/Switch Latency Statistics
swslatency.stats.view.name.prioname = Sched_Wakeup/Switch Latency Priority/Thread name Statistics
swslatency.density.view.name = Sched_Wakeup/Switch Density

view.segstore.statistics.prioname = Priority/Thread name Statistics

perspective.name = OS Tracing Overview
24 changes: 24 additions & 0 deletions analysis/org.eclipse.tracecompass.analysis.os.linux.ui/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@
name="%swslatency.stats.view.name"
restorable="true">
</view>
<view
category="org.eclipse.linuxtools.tmf.ui.views.category"
class="org.eclipse.tracecompass.analysis.os.linux.ui.segmentstore.statistics.PriorityThreadNameStatisticsView"
icon="icons/eview16/statistics_view.gif"
id="org.eclipse.tracecompass.analysis.os.linux.ui.segmentstore.statistics.prioname"
name="%view.segstore.statistics.prioname"
restorable="true">
</view>
<view
allowMultiple="false"
category="org.eclipse.linuxtools.lttng2.ui.views.category"
class="org.eclipse.tracecompass.analysis.os.linux.ui.segmentstore.statistics.PriorityThreadNameStatisticsView"
icon="icons/obj16/statistics_view.gif"
id="org.eclipse.tracecompass.analysis.os.linux.ui.segmentstore.statistics.prioname:org.eclipse.tracecompass.analysis.os.linux.core.swslatency.sws"
name="%swslatency.stats.view.name.prioname"
restorable="true">
</view>
<view
category="org.eclipse.linuxtools.lttng2.ui.views.category"
class="org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.swslatency.SWSLatencyDensityView"
Expand Down Expand Up @@ -201,6 +218,13 @@
class="org.eclipse.tracecompass.analysis.os.linux.core.swslatency.SWSLatencyAnalysis">
</analysisModuleClass>
</output>
<output
class="org.eclipse.tracecompass.tmf.ui.analysis.TmfAnalysisViewOutput"
id="org.eclipse.tracecompass.analysis.os.linux.ui.segmentstore.statistics.prioname:org.eclipse.tracecompass.analysis.os.linux.core.swslatency.sws">
<analysisModuleClass
class="org.eclipse.tracecompass.analysis.os.linux.core.swslatency.SWSLatencyAnalysis">
</analysisModuleClass>
</output>
<output
class="org.eclipse.tracecompass.tmf.ui.analysis.TmfAnalysisViewOutput"
id="org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.swslatency.density">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**********************************************************************
* Copyright (c) 2023 Ericsson
*
* 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.analysis.os.linux.ui.segmentstore.statistics;

import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.statistics.AbstractSegmentsStatisticsView;
import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.statistics.AbstractSegmentsStatisticsViewer;
import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.views.IViewDescriptor;

/**
* A segment store statistics view for showing statistics based on Priority and
* Thread name. The analysis specified by the secondaryId must create segments
* that implement IPrioritySegment.
*
* @author Hoang Thuan Pham
* @since 6.2
*/
public class PriorityThreadNameStatisticsView extends AbstractSegmentsStatisticsView {
/**
* ID of this view
*/
public static final String ID = "org.eclipse.tracecompass.analysis.os.linux.ui.segmentstore.statistics.prioname"; //$NON-NLS-1$

@Override
public void createPartControl(@Nullable Composite parent) {
super.createPartControl(parent);
// Set the title of the view from the actual view ID
IViewDescriptor desc = PlatformUI.getWorkbench().getViewRegistry().find(getViewId());
if (desc != null) {
setPartName(desc.getLabel());
}
}

@Override
protected @NonNull AbstractSegmentsStatisticsViewer createSegmentStoreStatisticsViewer(@NonNull Composite parent) {
// The analysis ID is the secondary ID of the view
String analysisId = NonNullUtils.nullToEmptyString(getViewSite().getSecondaryId());
return new PriorityThreadNameStatisticsViewer(parent, analysisId);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**********************************************************************
* Copyright (c) 2023 Ericsson
*
* 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.analysis.os.linux.ui.segmentstore.statistics;

import org.eclipse.swt.widgets.Composite;
import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.statistics.AbstractSegmentsStatisticsViewer;
import org.eclipse.tracecompass.internal.analysis.os.linux.core.segmentstore.PriorityThreadNameStatisticsDataProviderFactory;

/**
* A segment store statistics viewer for showing statistics based on Priority
* and Thread name.
*
* @author Hoang Thuan Pham
* @since 6.2
*/
public class PriorityThreadNameStatisticsViewer extends AbstractSegmentsStatisticsViewer {

/**
* Constructor
*
* @param parent
* The parent composite
* @param analysisId
* The ID of the segment store provider to do statistics on
*/
public PriorityThreadNameStatisticsViewer(Composite parent, String analysisId) {
super(parent, PriorityThreadNameStatisticsDataProviderFactory.DATA_PROVIDER_ID + ':' + analysisId);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/******************************************************************************
* Copyright (c) 2021 Ericsson
* Copyright (c) 2021, 2023 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License 2.0 which
Expand Down Expand Up @@ -98,6 +98,12 @@ public class DataProviderManagerTest {
.setId("org.eclipse.tracecompass.internal.analysis.timing.core.segmentstore.scatter.dataprovider:lttng.analysis.futex");
EXPECTED_KERNEL_DP_DESCRIPTORS.add(builder.build());
builder = new DataProviderDescriptor.Builder();
builder.setName("Futex Contention Analysis - Priority/Thread name Statistics Table")
.setDescription("Show Priority/Thread name Statistics Table provided by Analysis module: Futex Contention Analysis")
.setProviderType(ProviderType.DATA_TREE)
.setId("org.eclipse.tracecompass.internal.analysis.os.linux.core.segmentstore.PriorityThreadNameStatisticsDataProvider:lttng.analysis.futex");
EXPECTED_KERNEL_DP_DESCRIPTORS.add(builder.build());
builder = new DataProviderDescriptor.Builder();
builder.setName("Histogram")
.setDescription("Show a histogram of number of events to time for a trace")
.setProviderType(ProviderType.TREE_TIME_XY)
Expand Down Expand Up @@ -128,6 +134,12 @@ public class DataProviderManagerTest {
.setId("org.eclipse.tracecompass.internal.analysis.timing.core.segmentstore.scatter.dataprovider:lttng.analysis.irq");
EXPECTED_KERNEL_DP_DESCRIPTORS.add(builder.build());
builder = new DataProviderDescriptor.Builder();
builder.setName("IRQ Analysis - Priority/Thread name Statistics Table")
.setDescription("Show Priority/Thread name Statistics Table provided by Analysis module: IRQ Analysis")
.setProviderType(ProviderType.DATA_TREE)
.setId("org.eclipse.tracecompass.internal.analysis.os.linux.core.segmentstore.PriorityThreadNameStatisticsDataProvider:lttng.analysis.irq");
EXPECTED_KERNEL_DP_DESCRIPTORS.add(builder.build());
builder = new DataProviderDescriptor.Builder();
builder.setName("Memory Usage")
.setDescription("Show the relative memory usage in the Linux kernel by process, can be filtered to show only the processes which were active on a time range")
.setProviderType(ProviderType.TREE_TIME_XY)
Expand Down Expand Up @@ -164,27 +176,41 @@ public class DataProviderManagerTest {
.setId("org.eclipse.tracecompass.internal.analysis.timing.core.segmentstore.scatter.dataprovider:org.eclipse.tracecompass.analysis.os.linux.latency.syscall");
EXPECTED_KERNEL_DP_DESCRIPTORS.add(builder.build());
builder = new DataProviderDescriptor.Builder();
builder.setName("System Call Latency - Priority/Thread name Statistics Table")
.setDescription("Show Priority/Thread name Statistics Table provided by Analysis module: System Call Latency")
.setProviderType(ProviderType.DATA_TREE)
.setId("org.eclipse.tracecompass.internal.analysis.os.linux.core.segmentstore.PriorityThreadNameStatisticsDataProvider:org.eclipse.tracecompass.analysis.os.linux.latency.syscall");
EXPECTED_KERNEL_DP_DESCRIPTORS.add(builder.build());
builder = new DataProviderDescriptor.Builder();
builder.setName("Thread Status")
.setDescription("Show the hierarchy of Linux threads and their status (RUNNING, SYSCALL, IRQ, IDLE)")
.setProviderType(ProviderType.TIME_GRAPH)
.setId("org.eclipse.tracecompass.internal.analysis.os.linux.core.threadstatus.ThreadStatusDataProvider");
EXPECTED_KERNEL_DP_DESCRIPTORS.add(builder.build());
builder = new DataProviderDescriptor.Builder();
builder.setName("Scheduler Wakeup to Scheduler Switch Latency - Latency Statistics")
.setDescription("Show latency statistics provided by Analysis module: Scheduler Wakeup to Scheduler Switch Latency")
.setProviderType(ProviderType.DATA_TREE)
.setId("org.eclipse.tracecompass.analysis.timing.core.segmentstore.SegmentStoreStatisticsDataProvider:org.eclipse.tracecompass.analysis.os.linux.core.swslatency.sws");
EXPECTED_KERNEL_DP_DESCRIPTORS.add(builder.build());
builder = new DataProviderDescriptor.Builder();
builder.setName("Scheduler Wakeup to Scheduler Switch Latency - Latency Table")
.setDescription("Show latency table provided by Analysis module: Scheduler Wakeup to Scheduler Switch Latency")
.setProviderType(ProviderType.TABLE)
.setId("org.eclipse.tracecompass.analysis.timing.core.segmentstore.SegmentStoreTableDataProvider:org.eclipse.tracecompass.analysis.os.linux.core.swslatency.sws");
EXPECTED_KERNEL_DP_DESCRIPTORS.add(builder.build());
builder = new DataProviderDescriptor.Builder();
builder.setName("Scheduler Wakeup to Scheduler Switch Latency - Latency vs Time")
.setDescription("Show latencies provided by Analysis module: Scheduler Wakeup to Scheduler Switch Latency")
.setProviderType(ProviderType.TREE_TIME_XY)
.setId("org.eclipse.tracecompass.internal.analysis.timing.core.segmentstore.scatter.dataprovider:org.eclipse.tracecompass.analysis.os.linux.core.swslatency.sws");
EXPECTED_KERNEL_DP_DESCRIPTORS.add(builder.build());

builder = new DataProviderDescriptor.Builder();
builder.setName("Scheduler Wakeup to Scheduler Switch Latency - Priority/Thread name Statistics Table")
.setDescription("Show Priority/Thread name Statistics Table provided by Analysis module: Scheduler Wakeup to Scheduler Switch Latency")
.setProviderType(ProviderType.DATA_TREE)
.setId("org.eclipse.tracecompass.internal.analysis.os.linux.core.segmentstore.PriorityThreadNameStatisticsDataProvider:org.eclipse.tracecompass.analysis.os.linux.core.swslatency.sws");
EXPECTED_KERNEL_DP_DESCRIPTORS.add(builder.build());
// UST Trace
builder = new DataProviderDescriptor.Builder();
builder.setName("Events Table")
Expand Down Expand Up @@ -234,6 +260,12 @@ public class DataProviderManagerTest {
.setProviderType(ProviderType.TREE_TIME_XY)
.setId("org.eclipse.tracecompass.internal.analysis.timing.core.segmentstore.scatter.dataprovider:org.eclipse.linuxtools.lttng2.ust.analysis.callstack");
EXPECTED_UST_DP_DESCRIPTORS.add(builder.build());
builder = new DataProviderDescriptor.Builder();
builder.setName("LTTng-UST CallStack - Priority/Thread name Statistics Table")
.setDescription("Show Priority/Thread name Statistics Table provided by Analysis module: LTTng-UST CallStack")
.setProviderType(ProviderType.DATA_TREE)
.setId("org.eclipse.tracecompass.internal.analysis.os.linux.core.segmentstore.PriorityThreadNameStatisticsDataProvider:org.eclipse.linuxtools.lttng2.ust.analysis.callstack");
EXPECTED_UST_DP_DESCRIPTORS.add(builder.build());
}

/**
Expand Down

0 comments on commit 501cd49

Please sign in to comment.