1 /*******************************************************************************
2 * Copyright (c) 2015 Keba AG
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 * Christian Mansky - Initial implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.analysis
.os
.linux
.core
.kernel
;
15 import org
.eclipse
.jdt
.annotation
.Nullable
;
16 import org
.eclipse
.tracecompass
.common
.core
.NonNullUtils
;
17 import org
.eclipse
.tracecompass
.tmf
.core
.event
.ITmfEvent
;
18 import org
.eclipse
.tracecompass
.tmf
.core
.event
.aspect
.ITmfEventAspect
;
19 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.TmfTraceUtils
;
22 * This aspect finds the priority of the thread running from this event using
23 * the {@link KernelAnalysisModule}.
25 * @author Christian Mansky
28 public final class ThreadPriorityAspect
implements ITmfEventAspect
{
30 /** The singleton instance */
31 public static final ThreadPriorityAspect INSTANCE
= new ThreadPriorityAspect();
33 private ThreadPriorityAspect() {
37 public final String
getName() {
38 return NonNullUtils
.nullToEmptyString(Messages
.AspectName_Prio
);
42 public final String
getHelpText() {
43 return NonNullUtils
.nullToEmptyString(Messages
.AspectHelpText_Prio
);
47 public @Nullable Integer
resolve(ITmfEvent event
) {
48 KernelAnalysisModule kernelAnalysis
= TmfTraceUtils
.getAnalysisModuleOfClass(event
.getTrace(), KernelAnalysisModule
.class, KernelAnalysisModule
.ID
);
49 if (kernelAnalysis
== null) {
53 Integer tid
= KernelTidAspect
.INSTANCE
.resolve(event
);
58 Integer prio
= KernelThreadInformationProvider
.getThreadPrio(kernelAnalysis
, tid
, event
.getTimestamp().getValue());