Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tracecompass-dev] Fw: Fw: Implementing multiple analysis modules for same trace type

Hi David,

I'm not sure exactly what would be the best way to do what you are trying to do, but I can give some advice.

Analysis modules (extensions of IAnalysisModule), despite initially being designed initially to be restartable, in practice the great majority of the implementations are meant to just run once. A good part of the logic in intermediary classes like Abstract*AnalysisModule assumes the module will be run once, then will always considered "complete".

A more recent API that was added is IOndemandAnalysis. It is similar in idea, but completely separate from IAnalysisModule (for now), and is meant for things that may be executed several times on a given trace, with different input parameters every time. It is much more lightweight though, so not as integrated with other components like views and outputs. So you would need to control the execution and display of outputs manually.

For your particular case I could see two possible approaches. Either you go with a "classic" IAnalysisModule that computes all the possible data for your analysis. So when the user clicks the toggle in the view, the change is done at a display level only, and the view queries the pre-computed data it needs. The second approach would be to have a IOndemandAnalysis, or something similar, which is executed every time the user clicks the toggle.

Perhaps even a hybrid approach could be used, where you compute a base set of information that is always valid, then regenerates another layer of data specific to the input given by the user. This is how the Critical Path analysis works: it first computes the Execution Graph for the whole trace, then when the user request the analysis for a particular TID, it computes the critical path within that graph for that one TID (that second step is not done as a IOndemandAnalysis yet, but should be, eventually).


Hope this helps,
Alexandre



On 2016-07-12 12:55 PM, David Wootton wrote:

Hi
I tried a different approach with a single analysis module, since the
intervals I want to display in one view are a subset of all the intervals
in the original view.

I set a flag in my analysis module to indicate whether all events are to be
processed or only those that generate the subset of intervals. I can toggle
this flag by menu selections from a menu I added to my class extending
CallStackView.

I added a method to my class extending TmfTrace that I could call in order
to run TmfTrace.executeAnalysis(), which is otherwise inaccessible with the
intent that I wanted to rerun the analysis without reloading the trace. I
also marked my analysis module class as 'automatic' when registering it
with the org.eclipse.linuxtools.tmf.core.analysis extension.

When I initially load the trace, the analysis runs and updates my view as
expected. If I try to rerun the analysis, it appears to run, but the
methods in my class extending CallStackStateProvider don't seem to run,
implying that even though the analysis module runs, it's not re-scanning
the trace events. AbstractCallStackAnalysis.executeAnalysis
(IProgressMonitor) does return true, so I think analysis was successful.

Is what I'm tying to do possible?

Alternatively, is there any filtering capability in CallStackView such that
I can filter individual intervals in or out of the view?

Thanks

Dave
----- Forwarded by David Wootton/Poughkeepsie/Contr/IBM on 07/12/2016 12:42
PM -----

From:	David Wootton/Poughkeepsie/Contr/IBM@IBMUS
To:	"tracecompass developer discussions"
             <tracecompass-dev@xxxxxxxxxxx>
Date:	07/07/2016 06:04 PM
Subject:	[tracecompass-dev] Fw: Implementing multiple analysis modules
             for	same	trace type
Sent by:	tracecompass-dev-bounces@xxxxxxxxxxx



Looking at this more today, I found that it is not consistent how many
times I need to reload the trace before the output of the analysis I
requested (by a menu choice I added to my UI) is displayed. Sometimes I
only need to reload once and sometimes select the analysis again and reload
the trace again for it to take effect.

Investigating further, I found that the CallStackView class has a method
getCallStackModule() that is invoked after the trace is reloaded if a
CallStackView view is open, and it is running the wrong analysis module
sometimes. Looking at CallStackView source I see that method gets a list of
analysis modules derived from AbstractCallStackAnalysis and selects the
first module in the list, where the list order seems unpredictable.

There are TODO comments in this method stating work is needed for traces
which have multiple analysis modules, which is my case.

Does this mean I need to implement a single analysis module that has
multiple state systems?

Also, I'm still not sure why I need to reload the trace to get my view to
refresh.

Dave
----- Forwarded by David Wootton/Poughkeepsie/Contr/IBM on 07/07/2016 05:37
PM -----

From: David Wootton/Poughkeepsie/Contr/IBM@IBMUS
To: "tracecompass developer discussions" <tracecompass-dev@xxxxxxxxxxx>
Date: 07/07/2016 09:49 AM
Subject: [tracecompass-dev] Implementing multiple analysis modules for same
trace type
Sent by: tracecompass-dev-bounces@xxxxxxxxxxx



I'm trying to implement analysis modules for my trace, where the analysis
modules both extend AbstractCallStackAnalysis. My intent is to view the
results in my view which extends CallStackView (only to add a couple menu
entries to the toolbar menu in CallStackView for now)

Both of these analysis modules are registered to the
org.eclipse.linuxtools.tmf.core.analysis extension with 'automatic' set to
false.

If I use either of these analysis modules separately they seem to generate
correct data for the view.

One of these analysis modules is intended to generate intervals for all
events in my trace. The second analysis module is intended to generate
intervals for only a subset of the events in the trace, providing an
alternate view of the trace.

My intent is that once a trace is opened, the user can select a menu entry
to select which type of analysis to display in the view, and that the user
can switch back and forth without having to reload the trace.

When I click the menu entry for an analysis, the Action handler invokes
IAnalysisModule.schedule() for the required analysis module.

In order for the view to update at all, I have to reload the trace, but
even then, it seems like I have to do it twice. I've tried this with the
in-memory state model to see what happened, thinking there might be
problems with lingering analysis files but that did not matter.

Looking at the documentation, I also read about an analysis module that
could implement ITmfAnalysisModuleWithStateSystems in order to deal with
multiple state systems in one analysis module, but I'm not sure if that
helps here or how it helps.

I'm apparently missing something in the code I'm writing, but I'm not sure
what.

Anyone have suggestions?

Thanks

Dave_______________________________________________
tracecompass-dev mailing list
tracecompass-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/tracecompass-dev

_______________________________________________
tracecompass-dev mailing list
tracecompass-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/tracecompass-dev




_______________________________________________
tracecompass-dev mailing list
tracecompass-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tracecompass-dev



Back to the top