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