Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
linux.core: Add priority/thread name statistics data provider factory
This commit creates a new data provider for the new priority/thread name statistics analysis by extending the AbstractSegmentStoreStatisticsDataProviderFactory class. The data provider has a private class called PriorityThreadNameStatisticsAnalysis which specifies that entries for the priority/thread name statistics analysis should be grouped by priority and thread name. [Added] Data provider factory for priority/thread name statistics analysis Change-Id: Id5ad6a8301e1188916f0abc40006c11045b54976 Signed-off-by: Hoang Thuan Pham <hoang.pham@calian.ca> Reviewed-on: https://git.eclipse.org/r/c/tracecompass/org.eclipse.tracecompass/+/204382 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
1 parent
32f3220
commit 34d2520
Showing
5 changed files
with
162 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...e/src/org/eclipse/tracecompass/internal/analysis/os/linux/core/segmentstore/Messages.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/********************************************************************** | ||
* 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.internal.analysis.os.linux.core.segmentstore; | ||
|
||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.eclipse.osgi.util.NLS; | ||
|
||
/** | ||
* Message bundle for the segment store analysis module | ||
* | ||
* @author Hoang Thuan Pham | ||
*/ | ||
public class Messages extends NLS { | ||
private static final String BUNDLE_NAME = "org.eclipse.tracecompass.internal.analysis.os.linux.core.segmentstore.messages"; //$NON-NLS-1$ | ||
|
||
/** | ||
* Name of the Priority/Thread name data provider | ||
*/ | ||
public static @Nullable String PriorityThreadNameStatisticsDataProviderFactory_AnalysisName; | ||
/** | ||
* Title of the Priority/Thread name data provider | ||
*/ | ||
public static @Nullable String PriorityThreadNameStatisticsDataProviderFactory_title; | ||
/** | ||
* Description of the Priority/Thread name data provider | ||
*/ | ||
public static @Nullable String PriorityThreadNameStatisticsDataProviderFactory_description; | ||
/** | ||
* The segment type format of the PriorityThreadNameStatisticsAnalysis | ||
*/ | ||
public static @Nullable String PriorityThreadNameStatisticsAnalysis_segmentType; | ||
|
||
static { | ||
// initialize resource bundle | ||
NLS.initializeMessages(BUNDLE_NAME, Messages.class); | ||
} | ||
|
||
private Messages() { | ||
} | ||
} |
95 changes: 95 additions & 0 deletions
95
.../analysis/os/linux/core/segmentstore/PriorityThreadNameStatisticsDataProviderFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/********************************************************************** | ||
* 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.internal.analysis.os.linux.core.segmentstore; | ||
|
||
import java.util.Objects; | ||
|
||
import org.eclipse.jdt.annotation.NonNull; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.eclipse.osgi.util.NLS; | ||
import org.eclipse.tracecompass.analysis.timing.core.segmentstore.GenericSegmentStatisticsAnalysis; | ||
import org.eclipse.tracecompass.analysis.timing.core.segmentstore.statistics.AbstractSegmentStatisticsAnalysis; | ||
import org.eclipse.tracecompass.internal.analysis.timing.core.segmentstore.AbstractSegmentStoreStatisticsDataProviderFactory; | ||
import org.eclipse.tracecompass.segmentstore.core.ISegment; | ||
import org.eclipse.tracecompass.segmentstore.core.segment.interfaces.INamedSegment; | ||
import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule; | ||
import org.eclipse.tracecompass.tmf.core.component.DataProviderConstants; | ||
import org.eclipse.tracecompass.tmf.core.dataprovider.IDataProviderDescriptor.ProviderType; | ||
import org.eclipse.tracecompass.tmf.core.model.DataProviderDescriptor; | ||
import org.eclipse.tracecompass.tmf.core.model.DataProviderDescriptor.Builder; | ||
|
||
/** | ||
* A data provider factory for Priority/Thread name statistics analysis. | ||
* | ||
* @author Hoang Thuan Pham | ||
*/ | ||
public class PriorityThreadNameStatisticsDataProviderFactory extends AbstractSegmentStoreStatisticsDataProviderFactory { | ||
|
||
/** | ||
* The data provider ID | ||
*/ | ||
public static final String DATA_PROVIDER_ID = "org.eclipse.tracecompass.internal.analysis.os.linux.core.segmentstore.PriorityThreadNameStatisticsDataProvider"; //$NON-NLS-1$ | ||
|
||
/** | ||
* To extend another data provider, create an analysis that extends | ||
* {@link GenericSegmentStatisticsAnalysis} and override the | ||
* getSegmentType method again to specify how entries should be grouped for the | ||
* statistics. | ||
*/ | ||
private final class PriorityThreadNameStatisticsAnalysis extends GenericSegmentStatisticsAnalysis { | ||
/** | ||
* Constructor | ||
* | ||
* @param secondaryId The ID of the analysis which generates the segment store | ||
*/ | ||
private PriorityThreadNameStatisticsAnalysis(String secondaryId) { | ||
super(secondaryId); | ||
} | ||
|
||
@Override | ||
protected @Nullable String getSegmentType(@NonNull ISegment segment) { | ||
if ((segment instanceof INamedSegment) && (segment instanceof IPrioritySegment)) { | ||
return NLS.bind(Messages.PriorityThreadNameStatisticsAnalysis_segmentType, ((IPrioritySegment) segment).getPriority(), ((INamedSegment) segment).getName()); | ||
} | ||
return null; | ||
} | ||
} | ||
|
||
@Override | ||
protected AbstractSegmentStatisticsAnalysis getAnalysis(String analysisId) { | ||
/** | ||
* Return the {@link AbstractSegmentStatisticsAnalysis} that has the new | ||
* getSegmentType logic to bind it to the data provider. | ||
*/ | ||
return new PriorityThreadNameStatisticsAnalysis(analysisId); | ||
} | ||
|
||
@Override | ||
protected String getDataProviderId() { | ||
return DATA_PROVIDER_ID; | ||
} | ||
|
||
@Override | ||
protected void setStatisticsAnalysisModuleName(AbstractSegmentStatisticsAnalysis statisticsAnalysisModule, IAnalysisModule baseAnalysisModule) { | ||
statisticsAnalysisModule.setName(Objects.requireNonNull(NLS.bind(Messages.PriorityThreadNameStatisticsDataProviderFactory_AnalysisName, baseAnalysisModule.getName()))); | ||
} | ||
|
||
@Override | ||
protected Builder getDataProviderDescriptor(IAnalysisModule analysis) { | ||
DataProviderDescriptor.Builder builder = new DataProviderDescriptor.Builder(); | ||
builder.setId(DATA_PROVIDER_ID + DataProviderConstants.ID_SEPARATOR + analysis.getId()) | ||
.setName(Objects.requireNonNull(NLS.bind(Messages.PriorityThreadNameStatisticsDataProviderFactory_title, analysis.getName()))) | ||
.setDescription(Objects.requireNonNull(NLS.bind(Messages.PriorityThreadNameStatisticsDataProviderFactory_description, analysis.getHelpText()))) | ||
.setProviderType(ProviderType.DATA_TREE); | ||
return builder; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...org/eclipse/tracecompass/internal/analysis/os/linux/core/segmentstore/messages.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
############################################################################### | ||
# 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 | ||
############################################################################### | ||
|
||
PriorityThreadNameStatisticsDataProviderFactory_AnalysisName=Priority/Thread name Statistics for {0} | ||
PriorityThreadNameStatisticsDataProviderFactory_title={0} - Priority/Thread name Statistics Table | ||
PriorityThreadNameStatisticsDataProviderFactory_description=Show Priority/Thread name Statistics Table provided by {0} | ||
PriorityThreadNameStatisticsAnalysis_segmentType=Prio: {0}; {1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters