import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent;
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.TimeEvent;
+import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.widgets.Utils.TimeFormat;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PlatformUI;
/**
* Main implementation for the LTTng 2.0 kernel Resource view
/** View ID. */
public static final String ID = "org.eclipse.linuxtools.lttng2.kernel.ui.views.resources"; //$NON-NLS-1$
- /** Initial time range */
- private static final long INITIAL_WINDOW_OFFSET = (1L * 100 * 1000 * 1000); // .1sec
-
/**
* Redraw state enum
*/
}
long resolution = Math.max(1, (fZoomEndTime - fZoomStartTime) / fDisplayWidth);
for (TraceEntry traceEntry : fZoomEntryList) {
- if (!traceEntry.fKernelTrace.getStateSystem().waitUntilBuilt()) {
+ if (!traceEntry.fKernelTrace.getStateSystem(CtfKernelTrace.STATE_ID).waitUntilBuilt()) {
return;
}
for (ITimeGraphEntry child : traceEntry.getChildren()) {
public void createPartControl(Composite parent) {
fTimeGraphViewer = new TimeGraphViewer(parent, SWT.NONE);
- fTimeGraphViewer.setTimeGraphProvider(new ResourcesPresentationProvider());
+ fTimeGraphViewer.setTimeGraphProvider(new ResourcesPresentationProvider(fTimeGraphViewer));
- fTimeGraphViewer.setTimeCalendarFormat(true);
+ fTimeGraphViewer.setTimeFormat(TimeFormat.CALENDAR);
fTimeGraphViewer.addRangeListener(new ITimeGraphRangeListener() {
@Override
makeActions();
contributeToActionBars();
- IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ IEditorPart editor = getSite().getPage().getActiveEditor();
if (editor instanceof ITmfTraceEditor) {
ITmfTrace trace = ((ITmfTraceEditor) editor).getTrace();
if (trace != null) {
} else {
fStartTime = fTrace.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
fEndTime = fTrace.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
- refresh(INITIAL_WINDOW_OFFSET);
+ refresh();
}
}
}
if (fZoomThread != null) {
fZoomThread.cancel();
}
- refresh(INITIAL_WINDOW_OFFSET);
+ refresh();
}
}
if (signal.getSource() == this || fTrace == null) {
return;
}
+ if (signal.getCurrentRange().getIntersection(fTrace.getTimeRange()) == null) {
+ return;
+ }
final long startTime = signal.getCurrentRange().getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
final long endTime = signal.getCurrentRange().getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
final long time = signal.getCurrentTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
}
if (aTrace instanceof CtfKernelTrace) {
CtfKernelTrace ctfKernelTrace = (CtfKernelTrace) aTrace;
- ITmfStateSystem ssq = ctfKernelTrace.getStateSystem();
+ ITmfStateSystem ssq = ctfKernelTrace.getStateSystem(CtfKernelTrace.STATE_ID);
if (!ssq.waitUntilBuilt()) {
return;
}
fEntryListMap.put(trace, (ArrayList<TraceEntry>) entryList.clone());
}
if (trace == fTrace) {
- refresh(INITIAL_WINDOW_OFFSET);
+ refresh();
}
for (TraceEntry traceEntry : entryList) {
if (monitor.isCanceled()) {
return;
}
CtfKernelTrace ctfKernelTrace = traceEntry.getTrace();
- ITmfStateSystem ssq = ctfKernelTrace.getStateSystem();
+ ITmfStateSystem ssq = ctfKernelTrace.getStateSystem(CtfKernelTrace.STATE_ID);
long startTime = ssq.getStartTime();
long endTime = ssq.getCurrentEndTime() + 1;
long resolution = (endTime - startTime) / fDisplayWidth;
private static List<ITimeEvent> getEventList(ResourcesEntry entry,
long startTime, long endTime, long resolution, boolean includeNull,
IProgressMonitor monitor) {
- ITmfStateSystem ssq = entry.getTrace().getStateSystem();
+ ITmfStateSystem ssq = entry.getTrace().getStateSystem(CtfKernelTrace.STATE_ID);
startTime = Math.max(startTime, ssq.getStartTime());
endTime = Math.min(endTime, ssq.getCurrentEndTime() + 1);
if (endTime <= startTime) {
return eventList;
}
- private void refresh(final long windowRange) {
+ private void refresh() {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
fTimeGraphViewer.setInput(entries);
fTimeGraphViewer.setTimeBounds(fStartTime, fEndTime);
- long endTime = fStartTime + windowRange;
-
- if (fEndTime < endTime) {
- endTime = fEndTime;
- }
- fTimeGraphViewer.setStartFinishTime(fStartTime, endTime);
+ long timestamp = fTrace == null ? 0 : fTrace.getCurrentTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+ long startTime = fTrace == null ? 0 : fTrace.getCurrentRange().getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+ long endTime = fTrace == null ? 0 : fTrace.getCurrentRange().getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue();
+ startTime = Math.max(startTime, fStartTime);
+ endTime = Math.min(endTime, fEndTime);
+ fTimeGraphViewer.setSelectedTime(timestamp, false);
+ fTimeGraphViewer.setStartFinishTime(startTime, endTime);
- startZoomThread(fStartTime, endTime);
+ startZoomThread(startTime, endTime);
}
}
});