Search in sources :

Example 1 with HostThread

use of org.eclipse.tracecompass.analysis.os.linux.core.model.HostThread in project tracecompass by tracecompass.

the class TraceEventHandlerExecutionGraph method handleSchedSwitch.

private void handleSchedSwitch(ITmfEvent event) {
    String host = event.getTrace().getHostId();
    long ts = event.getTimestamp().getValue();
    IKernelAnalysisEventLayout eventLayout = getProvider().getEventLayout(event.getTrace());
    OsSystemModel system = getProvider().getSystem();
    ITmfEventField content = event.getContent();
    Integer next = content.getFieldValue(Integer.class, eventLayout.fieldNextTid());
    Integer prev = content.getFieldValue(Integer.class, eventLayout.fieldPrevTid());
    if (next == null || prev == null) {
        return;
    }
    OsWorker nextTask = system.findWorker(new HostThread(host, next));
    OsWorker prevTask = system.findWorker(new HostThread(host, prev));
    if (prevTask == null || nextTask == null) {
        return;
    }
    stateChange(prevTask, ts);
    stateChange(nextTask, ts);
}
Also used : HostThread(org.eclipse.tracecompass.analysis.os.linux.core.model.HostThread) OsWorker(org.eclipse.tracecompass.analysis.os.linux.core.execution.graph.OsWorker) OsSystemModel(org.eclipse.tracecompass.analysis.os.linux.core.execution.graph.OsSystemModel) ITmfEventField(org.eclipse.tracecompass.tmf.core.event.ITmfEventField) IKernelAnalysisEventLayout(org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout)

Example 2 with HostThread

use of org.eclipse.tracecompass.analysis.os.linux.core.model.HostThread in project tracecompass by tracecompass.

the class TraceEventHandlerSched method handleSchedWakeup.

private void handleSchedWakeup(ITmfEvent event) {
    String host = event.getTrace().getHostId();
    Integer cpu = NonNullUtils.checkNotNull(TmfTraceUtils.resolveIntEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event));
    IKernelAnalysisEventLayout eventLayout = getProvider().getEventLayout(event.getTrace());
    OsSystemModel system = getProvider().getSystem();
    Integer tid = event.getContent().getFieldValue(Integer.class, eventLayout.fieldTid());
    if (tid == null) {
        return;
    }
    HostThread targetHt = new HostThread(host, tid);
    OsWorker target = system.findWorker(targetHt);
    OsWorker current = system.getWorkerOnCpu(host, cpu);
    if (target == null) {
        String name = EventField.getOrDefault(event, eventLayout.fieldComm(), NonNullUtils.checkNotNull(Messages.TraceEventHandlerSched_UnknownThreadName));
        target = new OsWorker(targetHt, name, event.getTimestamp().getValue());
        system.addWorker(target);
        target.setStatus(ProcessStatus.WAIT_BLOCKED);
    }
    // spurious wakeup
    ProcessStatus status = target.getStatus();
    if ((current != null && target.getHostThread().equals(current.getHostThread())) || status == ProcessStatus.WAIT_CPU) {
        return;
    }
    if (status == ProcessStatus.WAIT_BLOCKED || status == ProcessStatus.WAIT_FORK || status == ProcessStatus.UNKNOWN) {
        target.setStatus(ProcessStatus.WAIT_CPU);
        return;
    }
}
Also used : HostThread(org.eclipse.tracecompass.analysis.os.linux.core.model.HostThread) OsWorker(org.eclipse.tracecompass.analysis.os.linux.core.execution.graph.OsWorker) OsSystemModel(org.eclipse.tracecompass.analysis.os.linux.core.execution.graph.OsSystemModel) TmfCpuAspect(org.eclipse.tracecompass.tmf.core.event.aspect.TmfCpuAspect) ProcessStatus(org.eclipse.tracecompass.analysis.os.linux.core.model.ProcessStatus) IKernelAnalysisEventLayout(org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout)

Example 3 with HostThread

use of org.eclipse.tracecompass.analysis.os.linux.core.model.HostThread in project tracecompass by tracecompass.

the class TraceEventHandlerSched method handleSchedProcessExit.

private void handleSchedProcessExit(ITmfEvent event) {
    String host = event.getTrace().getHostId();
    IKernelAnalysisEventLayout eventLayout = getProvider().getEventLayout(event.getTrace());
    OsSystemModel system = getProvider().getSystem();
    Integer tid = event.getContent().getFieldValue(Integer.class, eventLayout.fieldTid());
    if (tid == null) {
        return;
    }
    OsWorker task = system.findWorker(new HostThread(host, tid));
    if (task == null) {
        return;
    }
    task.setStatus(ProcessStatus.EXIT);
}
Also used : HostThread(org.eclipse.tracecompass.analysis.os.linux.core.model.HostThread) OsWorker(org.eclipse.tracecompass.analysis.os.linux.core.execution.graph.OsWorker) OsSystemModel(org.eclipse.tracecompass.analysis.os.linux.core.execution.graph.OsSystemModel) IKernelAnalysisEventLayout(org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout)

Example 4 with HostThread

use of org.eclipse.tracecompass.analysis.os.linux.core.model.HostThread in project tracecompass by tracecompass.

the class TraceEventHandlerSched method handleSchedProcessFork.

private void handleSchedProcessFork(ITmfEvent event) {
    String host = event.getTrace().getHostId();
    IKernelAnalysisEventLayout eventLayout = getProvider().getEventLayout(event.getTrace());
    OsSystemModel system = getProvider().getSystem();
    ITmfEventField content = event.getContent();
    Integer childTid = content.getFieldValue(Integer.class, eventLayout.fieldChildTid());
    String name = content.getFieldValue(String.class, eventLayout.fieldChildComm());
    if (childTid == null) {
        return;
    }
    name = (name == null ? String.valueOf(childTid) : name);
    long ts = event.getTimestamp().getValue();
    HostThread childHt = new HostThread(host, childTid);
    OsWorker childTask = system.findWorker(childHt);
    if (childTask == null) {
        childTask = new OsWorker(childHt, name, ts);
        system.addWorker(childTask);
    }
    childTask.setStatus(ProcessStatus.WAIT_FORK);
}
Also used : HostThread(org.eclipse.tracecompass.analysis.os.linux.core.model.HostThread) OsWorker(org.eclipse.tracecompass.analysis.os.linux.core.execution.graph.OsWorker) OsSystemModel(org.eclipse.tracecompass.analysis.os.linux.core.execution.graph.OsSystemModel) ITmfEventField(org.eclipse.tracecompass.tmf.core.event.ITmfEventField) IKernelAnalysisEventLayout(org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout)

Example 5 with HostThread

use of org.eclipse.tracecompass.analysis.os.linux.core.model.HostThread in project tracecompass by tracecompass.

the class CriticalPathParameterProvider method getParameter.

@Override
public Object getParameter(String name) {
    if (name.equals(CriticalPathModule.PARAM_WORKER)) {
        final HostThread currentHostThread = fCurrentHostThread;
        if (currentHostThread == null) {
            return null;
        }
        /* Try to find the worker for the critical path */
        IAnalysisModule mod = getModule();
        if (mod instanceof CriticalPathModule) {
            // $NON-NLS-1$
            OsWorker worker = new OsWorker(currentHostThread, "", 0);
            return worker;
        }
    }
    return null;
}
Also used : HostThread(org.eclipse.tracecompass.analysis.os.linux.core.model.HostThread) OsWorker(org.eclipse.tracecompass.analysis.os.linux.core.execution.graph.OsWorker) CriticalPathModule(org.eclipse.tracecompass.analysis.graph.core.criticalpath.CriticalPathModule) IAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule)

Aggregations

HostThread (org.eclipse.tracecompass.analysis.os.linux.core.model.HostThread)12 OsWorker (org.eclipse.tracecompass.analysis.os.linux.core.execution.graph.OsWorker)9 OsSystemModel (org.eclipse.tracecompass.analysis.os.linux.core.execution.graph.OsSystemModel)7 IKernelAnalysisEventLayout (org.eclipse.tracecompass.analysis.os.linux.core.trace.IKernelAnalysisEventLayout)6 ITmfEventField (org.eclipse.tracecompass.tmf.core.event.ITmfEventField)4 TmfCpuAspect (org.eclipse.tracecompass.tmf.core.event.aspect.TmfCpuAspect)3 ProcessStatus (org.eclipse.tracecompass.analysis.os.linux.core.model.ProcessStatus)2 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)2 ISelection (org.eclipse.jface.viewers.ISelection)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 TmfGraph (org.eclipse.tracecompass.analysis.graph.core.base.TmfGraph)1 CriticalPathModule (org.eclipse.tracecompass.analysis.graph.core.criticalpath.CriticalPathModule)1 TmfThreadSelectedSignal (org.eclipse.tracecompass.analysis.os.linux.core.signals.TmfThreadSelectedSignal)1 NonNullUtils.nullToEmptyString (org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString)1 ResourcesEntryModel (org.eclipse.tracecompass.internal.analysis.os.linux.core.resourcesstatus.ResourcesEntryModel)1 FollowThreadAction (org.eclipse.tracecompass.internal.analysis.os.linux.ui.actions.FollowThreadAction)1 UnfollowThreadAction (org.eclipse.tracecompass.internal.analysis.os.linux.ui.actions.UnfollowThreadAction)1 IAnalysisModule (org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule)1 ITmfTreeDataModel (org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel)1 TmfSignalHandler (org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)1