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
.kernelanalysis
;
15 import org
.eclipse
.jdt
.annotation
.Nullable
;
16 import org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.event
.aspect
.LinuxTidAspect
;
17 import org
.eclipse
.tracecompass
.tmf
.core
.event
.ITmfEvent
;
18 import org
.eclipse
.tracecompass
.tmf
.core
.event
.aspect
.TmfCpuAspect
;
19 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.TmfTraceUtils
;
22 * This aspect finds the ID of the thread running from this event using the
23 * {@link KernelAnalysisModule}.
25 * @author Geneviève Bastien
28 public final class KernelTidAspect
extends LinuxTidAspect
{
30 /** The singleton instance */
31 public static final KernelTidAspect INSTANCE
= new KernelTidAspect();
33 private KernelTidAspect() {
37 public @Nullable Integer
resolve(ITmfEvent event
) {
38 /* Find the CPU this event is run on */
39 Object cpuObj
= TmfTraceUtils
.resolveEventAspectOfClassForEvent(event
.getTrace(),
40 TmfCpuAspect
.class, event
);
44 Integer cpu
= (Integer
) cpuObj
;
46 /* Find the analysis module for the trace */
47 KernelAnalysisModule analysis
= TmfTraceUtils
.getAnalysisModuleOfClass(event
.getTrace(),
48 KernelAnalysisModule
.class, KernelAnalysisModule
.ID
);
49 if (analysis
== null) {
52 Integer tid
= KernelThreadInformationProvider
.getThreadOnCpu(
53 analysis
, cpu
, event
.getTimestamp().getValue());