Search in sources :

Example 1 with ResourcesEntryModel

use of org.eclipse.tracecompass.internal.analysis.os.linux.core.resourcesstatus.ResourcesEntryModel in project tracecompass by tracecompass.

the class ResourcesPresentationProvider method getEventHoverToolTipInfo.

@Override
public Map<String, String> getEventHoverToolTipInfo(ITimeEvent event, long hoverTime) {
    ITimeGraphEntry entry = event.getEntry();
    if (event instanceof TimeEvent && ((TimeEvent) event).hasValue() && entry instanceof TimeGraphEntry) {
        ITmfTreeDataModel model = ((TimeGraphEntry) entry).getEntryModel();
        TimeEvent tcEvent = (TimeEvent) event;
        if (tcEvent.hasValue() && model instanceof ResourcesEntryModel) {
            ResourcesEntryModel resourcesModel = (ResourcesEntryModel) model;
            if (resourcesModel.getType().equals(Type.IRQ) || resourcesModel.getType().equals(Type.SOFT_IRQ) || resourcesModel.getType().equals(Type.CPU) || resourcesModel.getType().equals(Type.CURRENT_THREAD) || resourcesModel.getType().equals(Type.FREQUENCY)) {
                ITimeGraphDataProvider<? extends TimeGraphEntryModel> provider = BaseDataProviderTimeGraphView.getProvider((TimeGraphEntry) entry);
                if (provider != null) {
                    return getTooltip(provider, model.getId(), hoverTime);
                }
            }
        }
    }
    return Collections.emptyMap();
}
Also used : ITmfTreeDataModel(org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) NullTimeEvent(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.NullTimeEvent) TimeEvent(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeEvent) ITimeEvent(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent) ResourcesEntryModel(org.eclipse.tracecompass.internal.analysis.os.linux.core.resourcesstatus.ResourcesEntryModel) TimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry)

Example 2 with ResourcesEntryModel

use of org.eclipse.tracecompass.internal.analysis.os.linux.core.resourcesstatus.ResourcesEntryModel in project tracecompass by tracecompass.

the class ResourcesPresentationProvider method getEventState.

private static StateItem getEventState(TimeEvent event) {
    if (event instanceof NullTimeEvent) {
        return null;
    }
    ITimeGraphEntry entry = event.getEntry();
    if (entry instanceof TimeGraphEntry && ((TimeGraphEntry) entry).getEntryModel() instanceof ResourcesEntryModel) {
        int value = event.getValue();
        ResourcesEntryModel resourcesModel = (ResourcesEntryModel) ((TimeGraphEntry) entry).getEntryModel();
        Type type = resourcesModel.getType();
        switch(type) {
            case CPU:
                return STATE_MAP.get(value);
            case IRQ:
                return STATE_MAP.get(StateValues.CPU_STATUS_IRQ);
            case SOFT_IRQ:
                if (value == StateValues.CPU_STATUS_SOFT_IRQ_RAISED) {
                    return STATE_MAP.get(StateValues.CPU_STATUS_SOFT_IRQ_RAISED);
                }
                return STATE_MAP.get(StateValues.CPU_STATUS_SOFTIRQ);
            case GROUP:
                return null;
            case CURRENT_THREAD:
            case FREQUENCY:
                if (!event.hasValue()) {
                    return null;
                }
                return STATE_MAP.get(StateValues.CPU_STATUS_RUN_USERMODE);
            default:
                return null;
        }
    }
    return null;
}
Also used : NullTimeEvent(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.NullTimeEvent) Type(org.eclipse.tracecompass.internal.analysis.os.linux.core.resourcesstatus.ResourcesEntryModel.Type) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) ResourcesEntryModel(org.eclipse.tracecompass.internal.analysis.os.linux.core.resourcesstatus.ResourcesEntryModel) TimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry)

Example 3 with ResourcesEntryModel

use of org.eclipse.tracecompass.internal.analysis.os.linux.core.resourcesstatus.ResourcesEntryModel in project tracecompass by tracecompass.

the class ResourcesView method fillTimeEventContextMenu.

@Override
protected void fillTimeEventContextMenu(@NonNull IMenuManager menuManager) {
    ISelection selection = getSite().getSelectionProvider().getSelection();
    if (selection instanceof IStructuredSelection) {
        IStructuredSelection sSel = (IStructuredSelection) selection;
        if (sSel.getFirstElement() instanceof TimeGraphEntry) {
            TimeGraphEntry resourcesEntry = (TimeGraphEntry) sSel.getFirstElement();
            ITmfTreeDataModel model = resourcesEntry.getEntryModel();
            if (sSel.toArray()[1] instanceof NamedTimeEvent && ((ResourcesEntryModel) model).getType() == Type.CURRENT_THREAD) {
                ITmfTrace trace = getTrace(resourcesEntry);
                NamedTimeEvent event = (NamedTimeEvent) sSel.toArray()[1];
                TmfTraceContext ctx = TmfTraceManager.getInstance().getCurrentTraceContext();
                HostThread data = (HostThread) ctx.getData(HostThread.SELECTED_HOST_THREAD_KEY);
                if (data != null) {
                    menuManager.add(new UnfollowThreadAction(ResourcesView.this));
                } else {
                    menuManager.add(new FollowThreadAction(ResourcesView.this, null, event.getValue(), trace));
                }
            }
        }
    }
    super.fillTimeEventContextMenu(menuManager);
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) HostThread(org.eclipse.tracecompass.analysis.os.linux.core.model.HostThread) ITmfTreeDataModel(org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel) TmfTraceContext(org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext) FollowThreadAction(org.eclipse.tracecompass.internal.analysis.os.linux.ui.actions.FollowThreadAction) ISelection(org.eclipse.jface.viewers.ISelection) UnfollowThreadAction(org.eclipse.tracecompass.internal.analysis.os.linux.ui.actions.UnfollowThreadAction) ResourcesEntryModel(org.eclipse.tracecompass.internal.analysis.os.linux.core.resourcesstatus.ResourcesEntryModel) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) TimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) NamedTimeEvent(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.NamedTimeEvent)

Example 4 with ResourcesEntryModel

use of org.eclipse.tracecompass.internal.analysis.os.linux.core.resourcesstatus.ResourcesEntryModel in project tracecompass by tracecompass.

the class ResourcesView method fillTimeGraphEntryContextMenu.

/**
 * @since 2.0
 */
@Override
protected void fillTimeGraphEntryContextMenu(@NonNull IMenuManager menuManager) {
    ISelection selection = getSite().getSelectionProvider().getSelection();
    if (selection instanceof IStructuredSelection) {
        IStructuredSelection sSel = (IStructuredSelection) selection;
        if (sSel.getFirstElement() instanceof TimeGraphEntry) {
            TimeGraphEntry resourcesEntry = (TimeGraphEntry) sSel.getFirstElement();
            ITmfTreeDataModel model = resourcesEntry.getEntryModel();
            if (model instanceof ResourcesEntryModel) {
                ResourcesEntryModel resourcesModel = (ResourcesEntryModel) model;
                Type type = resourcesModel.getType();
                if (type == Type.CPU || type == Type.CURRENT_THREAD) {
                    ITmfTrace trace = getTrace(resourcesEntry);
                    TmfTraceContext ctx = TmfTraceManager.getInstance().getTraceContext(trace);
                    Integer data = (Integer) ctx.getData(RESOURCES_FOLLOW_CPU);
                    int cpu = data != null ? data.intValue() : -1;
                    if (cpu >= 0) {
                        menuManager.add(new UnfollowCpuAction(ResourcesView.this, resourcesModel.getResourceId(), trace));
                    } else {
                        menuManager.add(new FollowCpuAction(ResourcesView.this, resourcesModel.getResourceId(), trace));
                    }
                }
            }
        }
    }
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) ITmfTreeDataModel(org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel) Type(org.eclipse.tracecompass.internal.analysis.os.linux.core.resourcesstatus.ResourcesEntryModel.Type) TmfTraceContext(org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext) FollowCpuAction(org.eclipse.tracecompass.internal.analysis.os.linux.ui.actions.FollowCpuAction) ISelection(org.eclipse.jface.viewers.ISelection) ResourcesEntryModel(org.eclipse.tracecompass.internal.analysis.os.linux.core.resourcesstatus.ResourcesEntryModel) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) TimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) UnfollowCpuAction(org.eclipse.tracecompass.internal.analysis.os.linux.ui.actions.UnfollowCpuAction)

Aggregations

ResourcesEntryModel (org.eclipse.tracecompass.internal.analysis.os.linux.core.resourcesstatus.ResourcesEntryModel)4 ITimeGraphEntry (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry)4 TimeGraphEntry (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry)4 ITmfTreeDataModel (org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel)3 ISelection (org.eclipse.jface.viewers.ISelection)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 Type (org.eclipse.tracecompass.internal.analysis.os.linux.core.resourcesstatus.ResourcesEntryModel.Type)2 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)2 TmfTraceContext (org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext)2 NullTimeEvent (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.NullTimeEvent)2 HostThread (org.eclipse.tracecompass.analysis.os.linux.core.model.HostThread)1 FollowCpuAction (org.eclipse.tracecompass.internal.analysis.os.linux.ui.actions.FollowCpuAction)1 FollowThreadAction (org.eclipse.tracecompass.internal.analysis.os.linux.ui.actions.FollowThreadAction)1 UnfollowCpuAction (org.eclipse.tracecompass.internal.analysis.os.linux.ui.actions.UnfollowCpuAction)1 UnfollowThreadAction (org.eclipse.tracecompass.internal.analysis.os.linux.ui.actions.UnfollowThreadAction)1 ITimeEvent (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeEvent)1 NamedTimeEvent (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.NamedTimeEvent)1 TimeEvent (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeEvent)1