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();
}
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;
}
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);
}
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));
}
}
}
}
}
}
Aggregations