Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tracecompass-dev] Implementing new trrace format viewing in Trace Compass



On Tue, Jun 14, 2016 at 4:25 PM, David Wootton <dwootton@xxxxxxxxxx> wrote:

Patrick
I think I have resolved yesterday's problems. I moved the 'current location' into my ITmfContext class and fixed a problem with one of my seek methods and the 'Fetching events' problem seems to be gone.

I was confused about how to show a Time Graph. Once I realized I had to open the Call Stack view, and fixed a couple problems with my state management code I got a view showing me timelines for threads like I wanted. It's not quite what I want since I get multiple rows for each thread that look something like a call stack, so I need to do some investigation but have something to work with.

I suggested the Call Stack view for a quick result because its analysis/state provider are the easiest to extend, and the view itself doesn't need to be extended at all. But as you see it may not quite be exactly the result you wanted. The tree structure is:

<trace>
+-<process>
   +-<thread>
      +-<function stack depth 1> [timeline intervals]
         <function stack depth 2> [timeline intervals]
         <...>

I suggest you open the State System Explorer view to see exactly how the state attributes and intervals look like in the state system created by your analysis's state provider.

Depending on which trace events you use as triggers in the functionEntry()/functionExit() implementations of your CallStackStateProvider, it will affect what your function stack looks like. If you don't want it to look like a stack then there must be no overlap in function entry's and exit's.

If you were to create your own view instead of using Call Stack view, I would guess your state provider would have state intervals on the thread attribute, and no function attributes. But then you'd have to implement yourself the code to query the state system and create time graph entries from state system attributes and time graph events from state system intervals. You can see examples in the concrete implementations of AbstractTimeGraphView/AbstractStateSystemTimeGraphView for ex. Control Flow view's buildEntryList() and getEventList(). It's not a trivial task...

There always the data-driven way which is all XML and no code, I myself am not too familiar with it but I'm sure others could help if you want to try that approach.

The one question I have at the moment is your mention of concurrency issues in my class extending TmfTrace. I'm expecting the user to load only a single trace at a time. Are there reasons to worry about concurrency in this model or does this only become a problem if the user happens to try to open a second trace file while the first trace is still loading?

There should be no concurrency issues between traces, you can open multiple traces at the same time, but the Call Stack view will only show the one that has focus. The others can continue loading in the background.

The concurrency issues I was worried about is if the 'current location' is stored in the single trace instance, and for the same trace many views/threads/analyses try to read events at different locations at the same time. But each use their own context so if the location is stored there, it will be fine.

Patrick

Dave

Inactive hide details for Patrick Tasse ---06/14/2016 10:47:51 AM---Hi Dave, On Mon, Jun 13, 2016 at 5:52 PM, David Wootton <dwPatrick Tasse ---06/14/2016 10:47:51 AM---Hi Dave, On Mon, Jun 13, 2016 at 5:52 PM, David Wootton <dwootton@xxxxxxxxxx> wrote:

From: Patrick Tasse <patrick.tasse@xxxxxxxxx>
To: tracecompass developer discussions <tracecompass-dev@xxxxxxxxxxx>
Date: 06/14/2016 10:47 AM


Subject: Re: [tracecompass-dev] Implementing new trrace format viewing in Trace Compass
Sent by: tracecompass-dev-bounces@xxxxxxxxxxx




Hi Dave,

On Mon, Jun 13, 2016 at 5:52 PM, David Wootton <dwootton@xxxxxxxxxx> wrote:
    Patrick
    I have a time chart view that is showing me a single timeline with a number of events that look like they match to the events in the editor window. If I close the editor window the time chart view clears. So I think I have a basic implementation that gives me confidence I can make this work running end to end.

 That indicates that your trace parser is providing events with timestamps. The Time Chart view is only using events provided by the trace parser, it doesn't use any state system created by an analysis.
    I did run into more problems along the way though.
    1) After I added the org.eclipse.linuxtools.tmf.core.analysis extension to my plugin.xml, I tried to add the analysis as a child of the extendion. When I right clicked in the extensions editor window and clicked new, my only choices were listener, module, output, parameterProvider and source. If I tried adding them, the extension details had no fields related to analysis modules as far as I could tell. I ended up finding a use of this extension in org.eclipse.tracecompass.lttng2.ust.core/plugin.xml so I copied that into my plugin.xml. Then when I switched back to the extensions editor tab I was able to change the fields to reference my analysis module and to modify the fields in the child tracetype entry to reference my class extending TmfTrace.

You should have been able to add a 'module' element, and reference your module class with property 'analysis_module'. The you can add a 'tracetype' child element with 'class' property to indicate for which trace type your module applies. The Extension Details of the extension point itself (org.eclipse.linuxtools.tmf.core.analysis) are not used and can be left blank.
    2) I was expecting the time chart view to open automatically since I set the 'automatic' attribute to true. Does that attribute indicate views open automatically or is it only running the analysis? Does my code need to open the view itself somewhere? Do I have to implement the getAnalysisRequirements() method in my analysis class and do something there to have the view open automatically?

The 'automatic' attribute only affects whether the analysis executes immediately when opening the trace for the first time, or if it waits until the analysis module is requested (usually, by a view that requests it explicitly).

Opening a trace does not open any view automatically, just the 'trace editor' with the event table. Some views are opened by default depending on your perspective. Other views you need to open manually from the menus, but some views that are output of a specific analysis can be opened by double-clicking them under the trace element in the Project view. Since you're not using the Project view, you'll need to open the Call Stack view (or any other view you create) yourself from the menus.
    Once I open the view manually, by clicking Window->Show View and picking Time Chart view the view does open, populated with events. If I hover the mouse over events I get some popup detail about the event.

Once again, I don't think Time Chart view is what you're looking for if you want to see processes and threads of your traced application.
    3) Is there a way to have the Time Chart view zoom in/out? I tried left clicking the mouse then drag right a bit and then release the mouse button to try to select a region to expand. There's nothing else in the view that I can click to zoom in/out.

Left-click drag is for selecting a time range 'cursor', not for zooming. You can use any of these to zoom in most time graph views:
- Right-click drag
- Ctrl+Mouse wheel
- Left-click drag on time axis
- +/- key and Zoom In/Out tool bar buttons (but those are not implemented in Time Chart view)

    4) If I scroll up and down in the editor view, I end up getting a progress monitor labeled 'Fetching Events' that remains running or is being repeatedly invoked such that the progress monitor appears in the lower right of the eclipse window for several minutes, it flickers a lot in the Progress view (which makes me think it is running repeatedly) and scrolling in the editor no longer works. Is this an indication I am doing something wrong, or am I just scrolling so fast I'm getting ahead of whatever is fetching events and there are a lot of 'fetch' requests pending?

 This could be many things, it will need some debugging, some ideas:
- The location (ITmfLocation implementation) inside the ITmfContext is not updated correctly when calling ITmfTrace.getNext(ITmfContext), the location after that call, when fed back to ITmfTrace.seekEvent(ITmfLocation), should give a context that returns the next event. And after reading the last event in the trace, the returned context should return null if passed to getNext().
- seekEvent(double ratio) or getLocationRatio(ITmfLocation) is not implemented correctly, if the problem is when using the vertical scroll bar
- The number of events in the trace is incorrect (you could try deleting supplementary files in Project view, otherwise try deleting the folder <workspace>/<project>/.tracing/<trace>.
    At the moment, my trace data model is just a simple in memory array. I implement seek by either updating the current array index when seeking by index/rank and by lookup in a TreeMap object I use to initially merge my trace input streams into a single data stream in timestamp order when seeking by timestamp. So my 'seek' should be fast.

Where is 'current array index'? If it's in the trace instance I'd worry about concurrency issues, but it's possible that this is implemented correctly with synchronization on the trace. I'm not sure... In any case, the index should probably be part of the ITmfLocation that is in the context, and be updated when getNext() is called.
    Also, my plugin has a RCP implementation which does not include the Project Explorer view, so I'm not invoking anything my mouse clicks in the Project Explorer view. At the moment I'm getting everything started by setting up my trace input and opening the editor via a call to IDE.openEditor(), where everything seems to work so far. I'm anticipating any additional processing by my code invoking methods that are driven by menu clicks in the TraceCompass perspective.

I think this should work as long as the editor that gets opened is a TmfEventsEditor, it will take care of notifying the framework when the trace is opened/closed.

Without a Project view you lose a lot of functionality though (deleting supplementary files, viewing analyses and their outputs, properly renaming and deleting traces, time offsetting, etc.)
    Dave

Patrick



    Inactive hide details for Patrick Tasse ---06/13/2016 04:19:23 PM---Hi Dave, It appears our developer guide has not been kept uPatrick Tasse ---06/13/2016 04:19:23 PM---Hi Dave, It appears our developer guide has not been kept up to date with some code

    From:
    Patrick Tasse <patrick.tasse@xxxxxxxxx>
    To:
    tracecompass developer discussions <tracecompass-dev@xxxxxxxxxxx>
    Date:
    06/13/2016 04:19 PM


    Subject:
    Re: [tracecompass-dev] Implementing new trrace format viewing in Trace Compass
    Sent by:
    tracecompass-dev-bounces@xxxxxxxxxxx





    Hi Dave,


    It appears our developer guide has not been kept up to date with some code changes. At one point we changed it so that the state systems are built from an analysis instead of explicitly from the trace implementation. The two other classes you refer to have been renamed to remove 'Tmf' prefix.


    In your case, you do not need to register the state provider. You should create an analysis, and that analysis you register with the extension point org.eclipse.linuxtools.tmf.core.analysis. Then the analysis should be executed when the trace is opened if automatic=true (or when the view is opened if automatic=false). If your analysis module extends TmfAbstractAnalysisModule (or AbstractCallStackAnalysis) then you need to override createStateProvider() and that is where you reference your state provider.


    If you use the Call Stack view, it will automatically look for an analysis that extends AbstractCallStackAnalysis. If you make your own view that extends AbstractTimeGraphView, then it is in overriding buildEntryList() that you make it look for your own analysis.


    Patrick



    On Mon, Jun 13, 2016 at 12:11 PM, David Wootton <
    dwootton@xxxxxxxxxx> wrote:
        Patrick
        I am able to create a trace from my input trace and get it to show up in the editor view. I can also add attributes to trace events and have them show up in the editor view after I defined the proper trace aspect objects.

        I'm now trying to extend CallStackStateProvider and AbstractTimeGraphView as you suggested. I have written my class extending CallStackStateProvider, but I'm not sure how I register that class, which I'm guessing has to be registered in my class extending TmfTrace.The Trace Compass developer doc references a TmfTrace.buildStateSystems() method htat I'm supposed to call, but this does not seem to exist in the Trace Compass version 2.0 code. I also do not find the TmfStateSystemFactory or TmfStateSystem classes anywhere in the 2.0 code.

        What do I need to do to get a working TimeGraphView?

        Thanks

        Dave

        Inactive hide details for Patrick Tasse ---06/09/2016 11:48:51 AM---Hi David, Right now the triggers to get things going with aPatrick Tasse ---06/09/2016 11:48:51 AM---Hi David, Right now the triggers to get things going with a trace are based on

        From:
        Patrick Tasse <patrick.tasse@xxxxxxxxx>
        To:
        tracecompass developer discussions <tracecompass-dev@xxxxxxxxxxx>
        Date:
        06/09/2016 11:48 AM
        Subject:
        Re: [tracecompass-dev] Implementing new trrace format viewing in Trace Compass
        Sent by:
        tracecompass-dev-bounces@xxxxxxxxxxx





        Hi David,

        Right now the triggers to get things going with a trace are based on opening the trace in the tool from the Project view. This will open the trace in an editor (read-only), start the trace indexing which will read all events and update the number of events in the table.

        Your new trace class has to be assigned a trace type using the org.eclipse.linuxtools.tmf.core.tracetype extension point.

        The Time Chart view only knows about punctual events and their timestamps, so it will show ticks in a time line when events occur, in a single row for the trace. I don't think that's what you're trying to achieve.

        What you're looking for is a view based on a time graph, that has time graph entries (rows) for threads and processes. In order to go from punctual events to states with duration, most views use a state system that is built using an analysis (you need to define it with extension point org.eclipse.linuxtools.tmf.core.analysis).

        I think you might have some luck with creating an analysis that extends AbstractCallStackAnalysis. You will need to create a state provider (I suggest to extend CallStackStateProvider), which will populate the state system with attributes and intervals based on the events you identify in your trace. Then the overridable methods in AbstractCallStackAnalysis will identify which state system attributes will map to rows in the Call Stack view. If you're not really doing a full call stack model, you could 'fake it' in such a way that a thread start is seen as a function entry and a thread end is seen as a function exit.

        You could also create your own view that extends AbstractTimeGraphView, then you need to implement the methods that create time graph entries (rows) and compute the time graph model time events (states) from your trace. Usually this is also done through a state system, but doesn't have to be.

        And another completely different way to go about it, is to define your state system and your view in a data-driven way using XML (without writing code). There is documentation and an example of how to do this here:


        http://archive.eclipse.org/tracecompass/doc/stable/org.eclipse.tracecompass.doc.user/Data-driven-analysis.html#Data_driven_analysis
        https://www.eclipsecon.org/na2015/sites/default/files/slides/EclipseConAmerica2015.pdf

        FYI, the Nexus sample code was lost in the move from Linux Tools to Trace Compass. I could point you to the last version in Linux Tools git but it would surely not compile in Trace Compass.

        Patrick



        On Wed, Jun 8, 2016 at 5:27 PM, David Wootton <
        dwootton@xxxxxxxxxx> wrote:
                Hi
                I am trying to implement viewers using Trace Compass for a trace file generated by my plugin and some backend tools.I am having troble understanding the high level model that I need to follow to get this work. I have downloaded the source for Trace Compass and Linux tools and cannot find the source for the Nexus sample anywhere. Is there any information available that explains at a high level what I need to to to implement a new trace reader and get it to properly interface with the viewers?

                My intent was to initially load the trace and have it display in a Time Chart view where I am trying to display a timeline for each thread in each process in the application that generated the trace. I'm trying to get a view that shows one timeline for each thread in each process in the traced application, so I think this is the view I want.

                I have an existing trace reader for my trace format which reads the trace into memory and then opens my plugin's trace viewer. I have modified it so that it generates trace events that are implementations of the ITmfEvent interface and have started to implement a class extending TmfTrace. However, it's unclear to me what I need to do in order to initiate the processing in my TmfTrace class once I create an instance of my class and call initTrace in that class. I'm expecting parseEvent to be called to read each event, but that is not happening. I'm also not sure how I notify the viewer that trace data is available. I'm not sure if I need to call some method in the viewer or if I need to do something to hook up with the Trace Compass signal processing.

                I also experimented with loading a sample Linux kernel trace in Trace Compass. It seems that when I load the trace, the initial view that gets loaded is the TmfEventsEditor and then other views seem to be populated from that editor. Therefore I'm wondering if I need to set my instance of a TmfTrace class as an editor input to that editor and then everything will run from there?

                Any assistance is appreciated.

                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
    _______________________________________________
    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




_______________________________________________
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