Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tracecompass-dev] Fw: Interval colors in CallStackView

Hi
I was able to implement a simple scheme by overriding CallStackPresentationProvider#getStateTable to return an array of StateItem objects with contrasting colors.
Then I overrode CallStackPresentationProvider#getStateTableIndex to maintain a counter incremented with each event and I use (index %2) to get alternating StateItem objects.

This does what I want. It assumes that intervals in a timeline are written sequentially left to right before elements for the next timeline are drawn. Is this a reasonable assumption?

Dave
----- Forwarded by David Wootton/Poughkeepsie/Contr/IBM on 03/15/2017 10:15 AM -----

From: Patrick Tasse <patrick.tasse@xxxxxxxxx>
To: tracecompass developer discussions <tracecompass-dev@xxxxxxxxxxx>
Date: 03/10/2017 09:28 AM
Subject: Re: [tracecompass-dev] Interval colors in CallStackView
Sent by: tracecompass-dev-bounces@xxxxxxxxxxx





Hi Dave,

Another solution you might want to consider is to draw borders around the time events, or some other visual help.

You could do something like this in the overridden presentation provider:

    @Override
    public void postDrawEvent(ITimeEvent event, Rectangle bounds, GC gc) {
        super.postDrawEvent(event, bounds, gc);
        gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_BLACK));
        gc.drawRectangle(bounds.x - 1, bounds.y, bounds.width + 1, bounds.height - 1);
    }

The -1 and +1 allows for the state color to be visible when the state is only 1 or 2 pixels wide, but it makes the even look wider than it actually is. You could also experiment with transparency using gc.setAlpha(), or having some kind of stateful presentation provider that only draws a separator line when the previous drawn event is adjacent.

Patrick



On Thu, Mar 9, 2017 at 6:54 PM, Matthew Khouzam <matthew.khouzam@xxxxxxxxxxxx> wrote:
    Hi Dave,

    Excellent question. Genevieve is working on it as we speak. If you need something sooner, and you don't mind getting your hands covered in Java, take a look at CallStackPresentationProvider#getState.

    I would extract that code somewhere safe like the symbol providers or somewhere else, so the other charts like flame graph can use it too.

    This is very interesting for me personally. If you have any improvements to share, I will gladly review it. When I get some spare time I might do something similar. �

    Cheers,

    Matthew



    From: tracecompass-dev-bounces@xxxxxxxxxxx <tracecompass-dev-bounces@xxxxxxxxxxx> on behalf of David Wootton <dwootton@xxxxxxxxxx>
    Sent:
    Thursday, March 9, 2017 5:45:08 PM
    To:
    Trace Compass Developer Discussions
    Subject:
    [tracecompass-dev] Interval colors in CallStackView
     

    Hi
    Is there any way to control colors for intervals in the CallStackView? I have a case where I am generating intervals where the end time for one interval on a thread exactly matches the start time for the next interval on the same thread. These are correctly displayed on the timeline, but it is difficult to find the boundary between the two intervals since they both have the same color.

    Is there some way to control the color of the intervals from within a class which extends CallStackView, or at least get intervals to use alternating colors?

    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



Back to the top