Skip to content

Commit

Permalink
linux.core: make ThreadStatusDataProvider generic
Browse files Browse the repository at this point in the history
ThreadStatusDataProvider does not need to be bounded to a specific
analysis module.

This commit bounds ThreadStatusDataProvider to the more abstract
TmfStateSystemAnalysisModule. The benefit is that after this change
the ThreadStatusDataProvider can use other analysis that provide
the expected information in their state system.

Signed-off-by: Francesco Robino <francesco.robino@ericsson.com>
Change-Id: I6738cdd4eafa666df2d9c791ff15636d924e9250
Reviewed-on: https://git.eclipse.org/r/c/tracecompass/org.eclipse.tracecompass/+/199693
Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org>
Tested-by: Marco Miller <marco.miller@ericsson.com>
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-by: Hoang Thuan Pham <hoangpham.eclipse@gmail.com>
Reviewed-by: Marco Miller <marco.miller@ericsson.com>
  • Loading branch information
frallax authored and marco-miller committed Mar 10, 2023
1 parent f1dd159 commit e379f32
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Expand Up @@ -46,6 +46,7 @@
import org.eclipse.tracecompass.tmf.core.response.ITmfResponse;
import org.eclipse.tracecompass.tmf.core.response.TmfModelResponse;
import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
import org.junit.Test;

Expand Down Expand Up @@ -75,7 +76,7 @@ public void testThreadStatusDataProvider() throws TmfTraceException, IOException
trace.initTrace(null, filePath.toOSString(), TmfEvent.class);
trace.traceOpened(new TmfTraceOpenedSignal(this, trace, null));

KernelAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, KernelAnalysisModule.class, KernelAnalysisModule.ID);
TmfStateSystemAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, TmfStateSystemAnalysisModule.class, KernelAnalysisModule.ID);
assertNotNull(module);
assertTrue(module.schedule().isOK());
assertTrue(module.waitForCompletion());
Expand Down
Expand Up @@ -32,7 +32,6 @@
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.analysis.os.linux.core.event.aspect.LinuxTidAspect;
import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
import org.eclipse.tracecompass.analysis.os.linux.core.model.OsStrings;
import org.eclipse.tracecompass.analysis.os.linux.core.model.ProcessStatus;
import org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelTrace;
Expand Down Expand Up @@ -79,6 +78,7 @@
import org.eclipse.tracecompass.tmf.core.model.tree.TmfTreeModel;
import org.eclipse.tracecompass.tmf.core.response.ITmfResponse;
import org.eclipse.tracecompass.tmf.core.response.TmfModelResponse;
import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
import org.eclipse.tracecompass.tmf.core.util.Pair;
Expand Down Expand Up @@ -146,7 +146,7 @@ public class ThreadStatusDataProvider extends AbstractTmfTraceDataProvider imple
STATE_MAP = builder.build();
}

private final KernelAnalysisModule fModule;
private final TmfStateSystemAnalysisModule fModule;
private final long fTraceId = fAtomicLong.getAndIncrement();

/**
Expand Down Expand Up @@ -186,11 +186,11 @@ public class ThreadStatusDataProvider extends AbstractTmfTraceDataProvider imple
* @param trace
* The trace for which this provider will be built.
* @param module
* the {@link KernelAnalysisModule} to access the underlying
* the {@link TmfStateSystemAnalysisModule} to access the underlying
* {@link ITmfStateSystem}
*
*/
public ThreadStatusDataProvider(@NonNull ITmfTrace trace, KernelAnalysisModule module) {
public ThreadStatusDataProvider(@NonNull ITmfTrace trace, TmfStateSystemAnalysisModule module) {
super(trace);
fModule = module;
fEventAnnotationProvider = new EventAnnotationProvider<>(OsStrings.tid(), (unused -> true), (candidate) -> !(candidate instanceof IKernelTrace) && trace != candidate, LinuxTidAspect.class, trace,
Expand Down

0 comments on commit e379f32

Please sign in to comment.