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 statistics data provider factory
This commit creates a new data provider for the new priority statistics analysis by extending the AbstractSegmentStoreStatisticsDataProviderFactory class. The data provider has a private class called PriorityStatisticsAnalysis which specifies that entries for the priority statistics analysis should be grouped by priority of each segment. [Added] Data provider factory for priority statistics analysis Change-Id: Id169d66c67337f653a7b503b456827db994b4f47 Signed-off-by: Hoang Thuan Pham <hoang.pham@calian.ca> Reviewed-on: https://git.eclipse.org/r/c/tracecompass/org.eclipse.tracecompass/+/204774 Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com> Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com> Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org> Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
- Loading branch information
1 parent
2eeea8d
commit 1bbe313
Showing
5 changed files
with
150 additions
and
0 deletions.
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
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
91 changes: 91 additions & 0 deletions
91
...s/internal/analysis/os/linux/core/segmentstore/PriorityStatisticsDataProviderFactory.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,91 @@ | ||
/********************************************************************** | ||
* 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.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 Statistics analysis. | ||
* | ||
* @author Hoang Thuan Pham | ||
*/ | ||
public class PriorityStatisticsDataProviderFactory extends AbstractSegmentStoreStatisticsDataProviderFactory { | ||
/** | ||
* The data provider ID | ||
*/ | ||
public static final String DATA_PROVIDER_ID = "org.eclipse.tracecompass.internal.analysis.os.linux.core.segmentstore.PriorityStatisticsDataProvider"; //$NON-NLS-1$ | ||
|
||
/** | ||
* A statistics analysis that groups entries based on the priority of each segment. | ||
*/ | ||
private final class PriorityStatisticsAnalysis extends GenericSegmentStatisticsAnalysis { | ||
/** | ||
* Constructor | ||
* | ||
* @param secondaryId The ID of the analysis which generates the segment store | ||
*/ | ||
private PriorityStatisticsAnalysis(String secondaryId) { | ||
super(secondaryId); | ||
} | ||
|
||
@Override | ||
protected @Nullable String getSegmentType(@NonNull ISegment segment) { | ||
if (segment instanceof IPrioritySegment) { | ||
// The segment type is the priority of the segment | ||
return NLS.bind(Messages.PriorityStatisticsAnalysis_segmentType, ((IPrioritySegment) segment).getPriority()); | ||
} | ||
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 PriorityStatisticsAnalysis(analysisId); | ||
} | ||
|
||
@Override | ||
protected String getDataProviderId() { | ||
return DATA_PROVIDER_ID; | ||
} | ||
|
||
@Override | ||
protected void setStatisticsAnalysisModuleName(AbstractSegmentStatisticsAnalysis statisticsAnalysisModule, IAnalysisModule baseAnalysisModule) { | ||
statisticsAnalysisModule.setName(Objects.requireNonNull(NLS.bind(Messages.PriorityStatisticsDataProviderFactory_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.PriorityStatisticsDataProviderFactory_title, analysis.getName()))) | ||
.setDescription(Objects.requireNonNull(NLS.bind(Messages.PriorityStatisticsDataProviderFactory_description, analysis.getHelpText()))) | ||
.setProviderType(ProviderType.DATA_TREE); | ||
return builder; | ||
} | ||
} |
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
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