1 /*******************************************************************************
2 * Copyright (c) 2015 École Polytechnique de Montréal
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Geneviève Bastien - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.kernel
;
15 import org
.eclipse
.jdt
.annotation
.Nullable
;
16 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.event
.aspect
.LinuxTidAspect
;
17 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.tid
.TidAnalysisModule
;
18 import org
.eclipse
.tracecompass
.tmf
.core
.event
.ITmfEvent
;
19 import org
.eclipse
.tracecompass
.tmf
.core
.event
.aspect
.TmfCpuAspect
;
20 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.TmfTraceUtils
;
23 * This aspect finds the ID of the thread running from this event using the
24 * {@link KernelAnalysisModule}.
26 * @author Geneviève Bastien
29 public final class KernelTidAspect
extends LinuxTidAspect
{
31 /** The singleton instance */
32 public static final KernelTidAspect INSTANCE
= new KernelTidAspect();
34 private KernelTidAspect() {
38 public @Nullable Integer
resolve(ITmfEvent event
) {
39 /* Find the CPU this event is run on */
40 Integer cpu
= TmfTraceUtils
.resolveIntEventAspectOfClassForEvent(event
.getTrace(),
41 TmfCpuAspect
.class, event
);
46 /* Find the analysis module for the trace */
47 TidAnalysisModule analysis
= TmfTraceUtils
.getAnalysisModuleOfClass(event
.getTrace(),
48 TidAnalysisModule
.class, TidAnalysisModule
.ID
);
49 if (analysis
== null) {
52 return analysis
.getThreadOnCpuAtTime(cpu
, event
.getTimestamp().toNanos());