<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
- <attribute name="annotationpath" value="/org.lttng.scope.common.core/annotations"/>
+ <attribute name="annotationpath" value="/org.eclipse.tracecompass.common.core/annotations"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
<attributes>
- <attribute name="annotationpath" value="/org.lttng.scope.common.core/annotations"/>
+ <attribute name="annotationpath" value="/org.eclipse.tracecompass.common.core/annotations"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.tracecompass.tmf.core,
- org.eclipse.tracecompass.ctf.tmf.core,
- org.lttng.scope.common.core,
- org.lttng.scope.lami.core,
- ca.polymtl.dorsal.libdelorean,
- org.lttng.scope.tmf2.views.core
+ org.lttng.scope.tmf2.views.core,
+ org.eclipse.tracecompass.common.core,
+ org.eclipse.tracecompass.analysis.os.linux.core,
+ org.eclipse.tracecompass.tmf.ctf.core,
+ org.eclipse.tracecompass.statesystem.core
Export-Package: org.lttng.scope.lttng.kernel.core.activator.internal;x-internal:=true,
- org.lttng.scope.lttng.kernel.core.analysis.os,
- org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal;x-internal:=true,
- org.lttng.scope.lttng.kernel.core.analysis.os.internal;x-internal:=true,
- org.lttng.scope.lttng.kernel.core.event.aspect,
- org.lttng.scope.lttng.kernel.core.trace,
- org.lttng.scope.lttng.kernel.core.trace.layout,
- org.lttng.scope.lttng.kernel.core.trace.layout.internal;x-internal:=true,
org.lttng.scope.lttng.kernel.core.views.timegraph,
org.lttng.scope.lttng.kernel.core.views.timegraph.resources,
org.lttng.scope.lttng.kernel.core.views.timegraph.resources.elements,
bin.includes = META-INF/,\
.,\
about.html,\
- plugin.properties,\
- plugin.xml,\
- lttng-analyses-configs/
+ plugin.properties
src.includes = about.html
additional.bundles = org.eclipse.jdt.annotation
jars.extra.classpath = platform:/plugin/org.eclipse.jdt.annotation
+++ /dev/null
-###############################################################################
-# Copyright (c) 2016 EfficiOS Inc. and others
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-###############################################################################
-
-name = LTTng-Analyses: CPU Usage Top
-command = lttng-cputop-mi
+++ /dev/null
-###############################################################################
-# Copyright (c) 2016 EfficiOS Inc. and others
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-###############################################################################
-
-analyses = cputop \
- iolatencyfreq \
- iolatencystats \
- iolatencytop \
- iolog \
- iousagetop \
- irqfreq \
- irqlog \
- irqstats \
- memtop \
- schedfreq \
- schedlog \
- schedstats \
- schedtop \
- syscallstats
+++ /dev/null
-###############################################################################
-# Copyright (c) 2016 EfficiOS Inc. and others
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-###############################################################################
-
-name = LTTng-Analyses: I/O Latency Frequency Distribution
-command = lttng-iolatencyfreq-mi
+++ /dev/null
-###############################################################################
-# Copyright (c) 2016 EfficiOS Inc. and others
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-###############################################################################
-
-name = LTTng-Analyses: I/O Latency Statistics
-command = lttng-iolatencystats-mi
+++ /dev/null
-###############################################################################
-# Copyright (c) 2016 EfficiOS Inc. and others
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-###############################################################################
-
-name = LTTng-Analyses: I/O Latency Top
-command = lttng-iolatencytop-mi
+++ /dev/null
-###############################################################################
-# Copyright (c) 2016 EfficiOS Inc. and others
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-###############################################################################
-
-name = LTTng-Analyses: I/O Usage Log
-command = lttng-iolog-mi
+++ /dev/null
-###############################################################################
-# Copyright (c) 2016 EfficiOS Inc. and others
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-###############################################################################
-
-name = LTTng-Analyses: I/O Usage Top
-command = lttng-iousagetop-mi
+++ /dev/null
-###############################################################################
-# Copyright (c) 2016 EfficiOS Inc. and others
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-###############################################################################
-
-name = LTTng-Analyses: Interrupt Frequency Distribution
-command = lttng-irqfreq-mi
+++ /dev/null
-###############################################################################
-# Copyright (c) 2016 EfficiOS Inc. and others
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-###############################################################################
-
-name = LTTng-Analyses: Interrupt Log
-command = lttng-irqlog-mi
+++ /dev/null
-###############################################################################
-# Copyright (c) 2016 EfficiOS Inc. and others
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-###############################################################################
-
-name = LTTng-Analyses: Interrupt Statistics
-command = lttng-irqstats-mi
+++ /dev/null
-###############################################################################
-# Copyright (c) 2016 EfficiOS Inc. and others
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-###############################################################################
-
-name = LTTng-Analyses: Memory Usage Top
-command = lttng-memtop-mi
+++ /dev/null
-###############################################################################
-# Copyright (c) 2016 EfficiOS Inc. and others
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-###############################################################################
-
-name = LTTng-Analyses: Scheduling Latency Frequency Distribution
-command = lttng-schedfreq-mi
+++ /dev/null
-###############################################################################
-# Copyright (c) 2016 EfficiOS Inc. and others
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-###############################################################################
-
-name = LTTng-Analyses: Scheduling Latency Log
-command = lttng-schedlog-mi
+++ /dev/null
-###############################################################################
-# Copyright (c) 2016 EfficiOS Inc. and others
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-###############################################################################
-
-name = LTTng-Analyses: Scheduling Latency Statistics
-command = lttng-schedstats-mi
+++ /dev/null
-###############################################################################
-# Copyright (c) 2016 EfficiOS Inc. and others
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-###############################################################################
-
-name = LTTng-Analyses: Scheduling Latency Top
-command = lttng-schedtop-mi
+++ /dev/null
-###############################################################################
-# Copyright (c) 2016 EfficiOS Inc. and others
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-###############################################################################
-
-name = LTTng-Analyses: System Call Statistics
-command = lttng-syscallstats-mi
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.linuxtools.tmf.core.analysis">
- <module
- analysis_module="org.lttng.scope.lttng.kernel.core.analysis.os.KernelAnalysisModule"
- automatic="true"
- id="org.eclipse.tracecompass.analysis.os.linux.kernel"
- name="%analysis.linuxkernel">
- <tracetype
- applies="true"
- class="org.lttng.scope.lttng.kernel.core.trace.IKernelTrace">
- </tracetype>
- </module>
- </extension>
- <extension
- point="org.eclipse.linuxtools.tmf.core.tracetype">
- <type
- category="org.eclipse.linuxtools.ctf.tmf.core.category.ctf"
- event_type="org.eclipse.tracecompass.ctf.tmf.core.event.CtfTmfEvent"
- id="org.eclipse.linuxtools.lttng2.kernel.tracetype"
- isDirectory="true"
- name="%tracetype.type.kernel"
- trace_type="org.lttng.scope.lttng.kernel.core.trace.LttngKernelTrace">
- </type>
- </extension>
-</plugin>
package org.lttng.scope.lttng.kernel.core.activator.internal;
-import org.lttng.scope.common.core.ScopeCoreActivator;
import org.lttng.scope.lttng.kernel.core.views.timegraph.resources.ResourcesCpuIrqModelProvider;
-import org.lttng.scope.lttng.kernel.core.views.timegraph.resources.ResourcesIrqModelProvider;
import org.lttng.scope.lttng.kernel.core.views.timegraph.threads.ThreadsModelProvider;
+import org.lttng.scope.tmf2.views.core.ScopeCoreActivator;
import org.lttng.scope.tmf2.views.core.timegraph.model.provider.TimeGraphModelProviderManager;
/**
TimeGraphModelProviderManager manager = TimeGraphModelProviderManager.instance();
manager.registerProviderFactory(() -> new ThreadsModelProvider());
manager.registerProviderFactory(() -> new ResourcesCpuIrqModelProvider());
- manager.registerProviderFactory(() -> new ResourcesIrqModelProvider());
+ // Not available in TC since the State system doesn't have aggregate attributes
+// manager.registerProviderFactory(() -> new ResourcesIrqModelProvider());
/* Register the built-in LTTng-Analyses descriptors */
// try {
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2016 EfficiOS Inc., Philippe Proulx
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.activator.internal;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-import org.eclipse.tracecompass.tmf.core.analysis.ondemand.OnDemandAnalysisManager;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.lttng.scope.lami.core.module.LamiAnalysis;
-import org.lttng.scope.lami.core.module.LamiAnalysisFactoryException;
-import org.lttng.scope.lami.core.module.LamiAnalysisFactoryFromConfigFile;
-import org.lttng.scope.lttng.kernel.core.trace.LttngKernelTrace;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-import org.lttng.scope.lttng.kernel.core.trace.layout.internal.Lttng27EventLayout;
-
-/**
- * Loader of LTTng analyses.
- *
- * @author Philippe Proulx
- */
-final class LttngAnalysesLoader {
-
- private static final String CONFIG_DIR_NAME = "lttng-analyses-configs"; //$NON-NLS-1$
-
- private LttngAnalysesLoader() {
- }
-
- private static boolean appliesTo(ITmfTrace trace) {
- /* LTTng-Analysis is supported only on LTTng >= 2.7 kernel traces */
- if (trace instanceof LttngKernelTrace) {
- final LttngKernelTrace kernelTrace = (LttngKernelTrace) trace;
- final ILttngKernelEventLayout layout = kernelTrace.getKernelEventLayout();
-
- if (layout instanceof Lttng27EventLayout) {
- return true;
- }
- }
-
- return false;
- }
-
- private static String[] getAnalysisNames() throws IOException {
- final ClassLoader loader = LttngAnalysesLoader.class.getClassLoader();
- final String path = "/" + CONFIG_DIR_NAME + "/index.properties"; //$NON-NLS-1$ //$NON-NLS-2$
- final String[] names = new String[0];
- final Properties indexProps = new Properties();
-
- try (final InputStream in = loader.getResourceAsStream(path)) {
- if (in == null) {
- return names;
- }
-
- indexProps.load(in);
- }
-
- String analyses = indexProps.getProperty("analyses"); //$NON-NLS-1$
-
- if (analyses == null) {
- return names;
- }
-
- analyses = analyses.trim();
- return analyses.split("\\s+"); //$NON-NLS-1$
- }
-
- public static void load() throws LamiAnalysisFactoryException, IOException {
- final String[] names = getAnalysisNames();
- final ClassLoader loader = LttngAnalysesLoader.class.getClassLoader();
-
- for (final String name : names) {
- final String path = String.format("/%s/%s.properties", CONFIG_DIR_NAME, name); //$NON-NLS-1$
-
- try (final InputStream in = loader.getResourceAsStream(path)) {
- if (in == null) {
- continue;
- }
-
- final LamiAnalysis analysis = LamiAnalysisFactoryFromConfigFile.buildFromInputStream(in, false, LttngAnalysesLoader::appliesTo);
- OnDemandAnalysisManager.getInstance().registerAnalysis(analysis);
- }
- }
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- ******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os;
-
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.tmf.core.util.Pair;
-
-/**
- * This file defines all the attribute names used in the handler. Both the
- * construction and query steps should use them.
- *
- * These should not be externalized! The values here are used as-is in the
- * history file on disk, so they should be kept the same to keep the file format
- * compatible. If a view shows attribute names directly, the localization should
- * be done on the viewer side.
- *
- * @author Alexandre Montplaisir
- */
-@SuppressWarnings({ "nls", "javadoc" })
-public interface Attributes {
-
- /* First-level attributes */
- String CPUS = "CPUs";
- String THREADS = "Threads";
-
- /* Sub-attributes of the CPU nodes */
- String CURRENT_THREAD = "Current_thread";
- String SOFT_IRQS = "Soft_IRQs";
- String IRQS = "IRQs";
-
- /* Sub-attributes of the Thread nodes */
- String CURRENT_CPU_RQ = "Current_cpu_rq";
- String PPID = "PPID";
- String EXEC_NAME = "Exec_name";
-
- String PRIO = "Prio";
- String SYSTEM_CALL = "System_call";
-
- /* Misc stuff */
- String UNKNOWN = "Unknown";
- String THREAD_0_PREFIX = "0_";
- String THREAD_0_SEPARATOR = "_";
-
- /**
- * Build the thread attribute name.
- *
- * For all threads except "0" this is the string representation of the
- * threadId. For thread "0" which is the idle thread and can be running
- * concurrently on multiple CPUs, append "_cpuId".
- *
- * @param threadId
- * the thread id
- * @param cpuId
- * the cpu id
- * @return the thread attribute name null if the threadId is zero and the
- * cpuId is null
- */
- public static @Nullable String buildThreadAttributeName(int threadId, @Nullable Integer cpuId) {
- if (threadId == 0) {
- if (cpuId == null) {
- return null;
- }
- return Attributes.THREAD_0_PREFIX + String.valueOf(cpuId);
- }
-
- return String.valueOf(threadId);
- }
-
- /**
- * Parse the thread id and CPU id from the thread attribute name string
- *
- * For thread "0" the attribute name is in the form "threadId_cpuId",
- * extract both values from the string.
- *
- * For all other threads, the attribute name is the string representation of
- * the threadId and there is no cpuId.
- *
- * @param threadAttributeName
- * the thread attribute name
- * @return the thread id and cpu id
- */
- public static Pair<Integer, Integer> parseThreadAttributeName(String threadAttributeName) {
- Integer threadId = -1;
- Integer cpuId = -1;
-
- try {
- if (threadAttributeName.startsWith(Attributes.THREAD_0_PREFIX)) {
- threadId = 0;
- String[] tokens = threadAttributeName.split(Attributes.THREAD_0_SEPARATOR);
- cpuId = Integer.parseInt(tokens[1]);
- } else {
- threadId = Integer.parseInt(threadAttributeName);
- }
- } catch (NumberFormatException e1) {
- // pass
- }
-
- return new Pair<>(threadId, cpuId);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2015 École Polytechnique de Montréal
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Geneviève Bastien - Initial API and implementation
- * Mathieu Rail - Provide the requirements of the analysis
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os;
-
-import static java.util.Objects.requireNonNull;
-import static org.lttng.scope.common.core.NonNullUtils.nullToEmptyString;
-
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider;
-import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.lttng.scope.lttng.kernel.core.analysis.os.internal.KernelStateProvider;
-import org.lttng.scope.lttng.kernel.core.trace.IKernelTrace;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-import org.lttng.scope.lttng.kernel.core.trace.layout.internal.LttngEventLayout;
-
-import com.google.common.primitives.Ints;
-
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystemBuilder;
-import ca.polymtl.dorsal.libdelorean.aggregation.AttributePriorityAggregationRule;
-import ca.polymtl.dorsal.libdelorean.aggregation.IStateAggregationRule;
-import ca.polymtl.dorsal.libdelorean.statevalue.TmfStateValue;
-
-/**
- * State System Module for lttng kernel traces
- *
- * @author Geneviève Bastien
- */
-public class KernelAnalysisModule extends TmfStateSystemAnalysisModule {
-
- /** The ID of this analysis module */
- public static final String ID = "org.eclipse.tracecompass.analysis.os.linux.kernel"; //$NON-NLS-1$
-
- @Override
- protected @NonNull ITmfStateProvider createStateProvider() {
- ITmfTrace trace = requireNonNull(getTrace());
- ILttngKernelEventLayout layout;
-
- if (trace instanceof IKernelTrace) {
- layout = ((IKernelTrace) trace).getKernelEventLayout();
- } else {
- /* Fall-back to the base LttngEventLayout */
- layout = LttngEventLayout.getInstance();
- }
-
- return new KernelStateProvider(trace, layout);
- }
-
- @Override
- protected String getFullHelpText() {
- return nullToEmptyString(Messages.LttngKernelAnalysisModule_Help);
- }
-
- @Override
- protected void setupAggregationRules(ITmfStateSystemBuilder ss) {
- /* Set up the virtual "IRQs" and "SoftIRQs" sub-trees */
- final int cpusQuark = ss.getQuarkAbsoluteAndAdd(Attributes.CPUS);
- final List<Integer> cpuQuarks = ss.getSubAttributes(cpusQuark, false);
-
- Set<Integer> irqNumbers = cpuQuarks.stream()
- .flatMap(quark -> {
- int irqsQuark = ss.getQuarkRelative(quark, Attributes.IRQS);
- List<Integer> irqQuarks = ss.getSubAttributes(irqsQuark, false);
- return irqQuarks.stream()
- .map(irqQuark -> ss.getAttributeName(irqQuark))
- .map(name -> Ints.tryParse(name))
- .filter(Objects::nonNull);
- })
- .collect(Collectors.toSet());
-
- Set<Integer> softIrqNumbers = cpuQuarks.stream()
- .flatMap(quark -> {
- int irqsQuark = ss.getQuarkRelative(quark, Attributes.SOFT_IRQS);
- List<Integer> irqQuarks = ss.getSubAttributes(irqsQuark, false);
- return irqQuarks.stream()
- .map(irqQuark -> ss.getAttributeName(irqQuark))
- .map(name -> Ints.tryParse(name))
- .filter(Objects::nonNull);
- })
- .collect(Collectors.toSet());
-
- int irqsQuark = ss.getQuarkAbsoluteAndAdd(Attributes.IRQS);
- if (irqsQuark == ss.getNbAttributes()) {
- /*
- * FIXME If we just created this attribute, make sure we put a null value into
- * it so that upcoming queries return something. Should be fixed in the state
- * system library.
- */
- ss.modifyAttribute(ss.getStartTime(), TmfStateValue.nullValue(), irqsQuark);
- }
- for (int irqNumber : irqNumbers) {
- int irqQuark = ss.getQuarkRelativeAndAdd(irqsQuark, String.valueOf(irqNumber));
- List<String[]> irqPaths = cpuQuarks.stream()
- .map(quark -> {
- String[] cpuQuarkPath = ss.getFullAttributePathArray(quark);
- String[] irqAttributePath = new String[4];
- irqAttributePath[0] = cpuQuarkPath[0];
- irqAttributePath[1] = cpuQuarkPath[1];
- irqAttributePath[2] = Attributes.IRQS;
- irqAttributePath[3] = String.valueOf(irqNumber);
- return irqAttributePath;
- })
- .collect(Collectors.toList());
-
- IStateAggregationRule rule = new AttributePriorityAggregationRule(ss, irqQuark, irqPaths);
- ss.addAggregationRule(rule);
- }
-
- int softIrqsQuark = ss.getQuarkAbsoluteAndAdd(Attributes.SOFT_IRQS);
- if (softIrqsQuark == ss.getNbAttributes()) {
- /*
- * FIXME If we just created this attribute, make sure we put a null value into
- * it so that upcoming queries return something. Should be fixed in the state
- * system library.
- */
- ss.modifyAttribute(ss.getStartTime(), TmfStateValue.nullValue(), softIrqsQuark);
- }
- for (int softIrqNumber : softIrqNumbers) {
- int softIrqQuark = ss.getQuarkRelativeAndAdd(softIrqsQuark, String.valueOf(softIrqNumber));
- List<String[]> softIrqPaths = cpuQuarks.stream()
- .map(quark -> {
- String[] cpuQuarkPath = ss.getFullAttributePathArray(quark);
- String[] irqAttributePath = new String[4];
- irqAttributePath[0] = cpuQuarkPath[0];
- irqAttributePath[1] = cpuQuarkPath[1];
- irqAttributePath[2] = Attributes.SOFT_IRQS;
- irqAttributePath[3] = String.valueOf(softIrqNumber);
- return irqAttributePath;
- })
- .collect(Collectors.toList());
-
- ss.addAggregationRule(new AttributePriorityAggregationRule(ss, softIrqQuark, softIrqPaths));
- }
-
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014, 2015 École Polytechnique de Montréal
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Geneviève Bastien - Initial API and implementation
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystem;
-import ca.polymtl.dorsal.libdelorean.StateSystemUtils;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-import ca.polymtl.dorsal.libdelorean.exceptions.StateSystemDisposedException;
-import ca.polymtl.dorsal.libdelorean.exceptions.TimeRangeException;
-import ca.polymtl.dorsal.libdelorean.interval.ITmfStateInterval;
-import ca.polymtl.dorsal.libdelorean.statevalue.ITmfStateValue;
-import ca.polymtl.dorsal.libdelorean.statevalue.ITmfStateValue.Type;
-
-/**
- * Information provider utility class that retrieves thread-related information
- * from a Linux Kernel Analysis
- *
- * @author Geneviève Bastien
- */
-public final class KernelThreadInformationProvider {
-
- private KernelThreadInformationProvider() {
- }
-
- /**
- * Get the ID of the thread running on the CPU at time ts
- *
- * TODO: This method may later be replaced by an aspect, when the aspect can
- * resolve to something that is not an event
- *
- * @param module
- * The kernel analysis instance to run this method on
- * @param cpuId
- * The CPU number the process is running on
- * @param ts
- * The timestamp at which we want the running process
- * @return The TID of the thread running on CPU cpuId at time ts or
- * {@code null} if either no thread is running or we do not know.
- */
- public static @Nullable Integer getThreadOnCpu(KernelAnalysisModule module, long cpuId, long ts) {
- ITmfStateSystem ss = module.getStateSystem();
- if (ss == null) {
- return null;
- }
- try {
- int cpuQuark = ss.getQuarkAbsolute(Attributes.CPUS, Long.toString(cpuId), Attributes.CURRENT_THREAD);
- ITmfStateInterval interval = ss.querySingleState(ts, cpuQuark);
- ITmfStateValue val = interval.getStateValue();
- if (val.getType().equals(Type.INTEGER)) {
- return val.unboxInt();
- }
- } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) {
- }
- return null;
- }
-
- /**
- * Get the TIDs of the threads from an analysis
- *
- * @param module
- * The kernel analysis instance to run this method on
- * @return The set of TIDs corresponding to the threads
- */
- public static Collection<Integer> getThreadIds(KernelAnalysisModule module) {
- ITmfStateSystem ss = module.getStateSystem();
- if (ss == null) {
- return Collections.EMPTY_SET;
- }
- int threadQuark;
- try {
- threadQuark = ss.getQuarkAbsolute(Attributes.THREADS);
- Set<@NonNull Integer> tids = new TreeSet<>();
- for (Integer quark : ss.getSubAttributes(threadQuark, false)) {
- final @NonNull String attributeName = ss.getAttributeName(quark);
- tids.add(attributeName.startsWith(Attributes.THREAD_0_PREFIX) ? 0 : Integer.parseInt(attributeName));
- }
- return tids;
- } catch (AttributeNotFoundException e) {
- }
- return Collections.EMPTY_SET;
- }
-
- /**
- * Get the parent process ID of a thread
- *
- * @param module
- * The kernel analysis instance to run this method on
- * @param threadId
- * The thread ID of the process for which to get the parent
- * @param ts
- * The timestamp at which to get the parent
- * @return The parent PID or {@code null} if the PPID is not found.
- */
- public static @Nullable Integer getParentPid(KernelAnalysisModule module, Integer threadId, long ts) {
- ITmfStateSystem ss = module.getStateSystem();
- if (ss == null) {
- return null;
- }
- Integer ppidNode;
- try {
- ppidNode = ss.getQuarkAbsolute(Attributes.THREADS, threadId.toString(), Attributes.PPID);
- ITmfStateInterval ppidInterval = ss.querySingleState(ts, ppidNode);
- ITmfStateValue ppidValue = ppidInterval.getStateValue();
-
- if (ppidValue.getType().equals(Type.INTEGER)) {
- return Integer.valueOf(ppidValue.unboxInt());
- }
- } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) {
- }
- return null;
- }
-
- /**
- * Get the executable name of the thread ID. If the thread ID was used
- * multiple time or the name changed in between, it will return the last
- * name the thread has taken, or {@code null} if no name is found
- *
- * @param module
- * The kernel analysis instance to run this method on
- * @param threadId
- * The thread ID of the process for which to get the name
- * @return The last executable name of this process, or {@code null} if not
- * found
- */
- public static @Nullable String getExecutableName(KernelAnalysisModule module, Integer threadId) {
- ITmfStateSystem ss = module.getStateSystem();
- if (ss == null) {
- return null;
- }
- try {
- Integer execNameNode = ss.getQuarkAbsolute(Attributes.THREADS, threadId.toString(), Attributes.EXEC_NAME);
- List<ITmfStateInterval> execNameIntervals = StateSystemUtils.queryHistoryRange(ss, execNameNode, ss.getStartTime(), ss.getCurrentEndTime());
-
- ITmfStateValue execNameValue;
- String execName = null;
- for (ITmfStateInterval interval : execNameIntervals) {
- execNameValue = interval.getStateValue();
- if (execNameValue.getType().equals(Type.STRING)) {
- execName = execNameValue.unboxStr();
- }
- }
- return execName;
- } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) {
- }
- return null;
- }
-
- /**
- * Get the priority of this thread at time ts
- *
- * @param module
- * The kernel analysis instance to run this method on
- * @param threadId
- * The ID of the thread to query
- * @param ts
- * The timestamp at which to query
- * @return The priority of the thread or <code>-1</code> if not available
- */
- public static int getThreadPriority(KernelAnalysisModule module, int threadId, long ts) {
- ITmfStateSystem ss = module.getStateSystem();
- if (ss == null) {
- return -1;
- }
- try {
- int prioQuark = ss.getQuarkAbsolute(Attributes.THREADS, String.valueOf(threadId), Attributes.PRIO);
- return ss.querySingleState(ts, prioQuark).getStateValue().unboxInt();
- } catch (AttributeNotFoundException | StateSystemDisposedException e) {
- return -1;
- }
- }
- /**
- * Get the status intervals for a given thread with a resolution
- *
- * @param module
- * The kernel analysis instance to run this method on
- * @param threadId
- * The ID of the thread to get the intervals for
- * @param start
- * The start time of the requested range
- * @param end
- * The end time of the requested range
- * @param resolution
- * The resolution or the minimal time between the requested
- * intervals. If interval times are smaller than resolution, only
- * the first interval is returned, the others are ignored.
- * @param monitor
- * A progress monitor for this task
- * @return The list of status intervals for this thread, an empty list is
- * returned if either the state system is {@code null} or the quark
- * is not found
- */
- public static List<ITmfStateInterval> getStatusIntervalsForThread(KernelAnalysisModule module, Integer threadId, long start, long end, long resolution, IProgressMonitor monitor) {
- ITmfStateSystem ss = module.getStateSystem();
- if (ss == null) {
- return Collections.EMPTY_LIST;
- }
-
- try {
- int threadQuark = ss.getQuarkAbsolute(Attributes.THREADS, threadId.toString());
- List<ITmfStateInterval> statusIntervals = StateSystemUtils.queryHistoryRange(ss, threadQuark,
- Math.max(start, ss.getStartTime()), Math.min(end - 1, ss.getCurrentEndTime()), resolution, null);
- return statusIntervals;
- } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) {
- }
- return Collections.EMPTY_LIST;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 EfficiOS Inc., Alexandre Montplaisir
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os;
-
-/**
- * Definitions of values used in the Linux kernel code.
- *
- * Instead of using "magic numbers" in state providers, the definitions should
- * be added here first.
- *
- * @author Alexandre Montplaisir
- */
-public interface LinuxValues {
-
- /**
- * Process states found in scheduler events.
- *
- * From include/linux/sched.h
- *
- * <pre>
- * #define TASK_RUNNING 0
- * #define TASK_INTERRUPTIBLE 1
- * #define TASK_UNINTERRUPTIBLE 2
- * #define __TASK_STOPPED 4
- * #define __TASK_TRACED 8
- * #define EXIT_DEAD 16
- * #define EXIT_ZOMBIE 32
- * #define EXIT_TRACE (EXIT_ZOMBIE | EXIT_DEAD)
- * #define TASK_DEAD 64
- * #define TASK_WAKEKILL 128
- * #define TASK_WAKING 256
- * #define TASK_PARKED 512
- * #define TASK_NOLOAD 1024
- * #define TASK_STATE_MAX 2048
- * </pre>
- */
- /**
- * The task is running normally, can be interrupted, in a syscall or user
- * mode.
- */
- int TASK_STATE_RUNNING = 0;
-
- /**
- * The process is in an interruptible sleep, (waiting for an event to
- * complete)
- */
- int TASK_INTERRUPTIBLE = 1;
-
- /**
- * The process is in an uninteruptible sleep, (usually waiting on IO)
- */
- int TASK_UNINTERRUPTIBLE = 2;
-
- /**
- * The process is stopped, it is waiting for a SIGCONT
- */
- int TASK_STOPPED__ = 4;
-
- /**
- * The process is being monitored by other processes like a debugger
- */
- int TASK_TRACED__ = 8;
-
- /**
- * The task is terminated. It is lingering waiting for a parent to reap it.
- */
- int EXIT_ZOMBIE = 16;
-
- /**
- * The final state, the process reaches this state when being reaped. This
- * state should not be seen.
- */
- int EXIT_DEAD = 32;
-
- /**
- * The task is dead, that means the PID can be re-used.
- */
- int TASK_DEAD = 64;
-
- /**
- * The task will wake up only on kill signals
- */
- int TASK_WAKEKILL = 128;
-
- /**
- * A task is being woken up, should not appear in sched switch, but if we
- * poll.
- */
- int TASK_WAKING = 256;
-
- /**
- * A very deep sleep that can only be woken by an unpark wakeup
- */
- int TASK_PARK = 512;
-
- /**
- * Task that do not contribute to load average (since Linux 4.1)
- */
- int TASK_NOLOAD = 1024;
-
- /**
- * This is the maximum value + 1 that the task state can be. TASK_STATE_MAX
- * - 1 is useful to mask the task state.
- */
- int TASK_STATE_MAX = 2048;
-
- /**
- * Process statuses, used in LTTng statedump events.
- *
- * This is LTTng-specific, but the statedump are handled at this level, so
- * it makes sense to add those definitions here.
- *
- * Taken from lttng-module's lttng-statedump-impl.c:
- *
- * <pre>
- * enum lttng_process_status {
- * LTTNG_UNNAMED = 0,
- * LTTNG_WAIT_FORK = 1,
- * LTTNG_WAIT_CPU = 2,
- * LTTNG_EXIT = 3,
- * LTTNG_ZOMBIE = 4,
- * LTTNG_WAIT = 5,
- * LTTNG_RUN = 6,
- * LTTNG_DEAD = 7,
- * };
- * </pre>
- */
-
- /** Task is initially preempted */
- int STATEDUMP_PROCESS_STATUS_WAIT_CPU = 2;
-
- /** Task is initially blocked */
- int STATEDUMP_PROCESS_STATUS_WAIT = 5;
-
- /**
- * SoftIRQ definitions
- *
- * From linux/interrupt.h
- *
- * <pre>
- * enum
- * {
- * HI_SOFTIRQ=0,
- * TIMER_SOFTIRQ,
- * NET_TX_SOFTIRQ,
- * NET_RX_SOFTIRQ,
- * BLOCK_SOFTIRQ,
- * BLOCK_IOPOLL_SOFTIRQ,
- * TASKLET_SOFTIRQ,
- * SCHED_SOFTIRQ,
- * HRTIMER_SOFTIRQ,
- * RCU_SOFTIRQ,
- * NR_SOFTIRQS // not used as this is the NUMBER of softirqs
- * };
- * </pre>
- */
-
- /** High-priority tasklet */
- int SOFTIRQ_HI = 0;
-
- /** Interrupted because of timer */
- int SOFTIRQ_TIMER = 1;
-
- /** Interrupted because of network transmission */
- int SOFTIRQ_NET_TX = 2;
-
- /** Interrupted because of network reception */
- int SOFTIRQ_NET_RX = 3;
-
- /** Interrupted because of block operation */
- int SOFTIRQ_BLOCK = 4;
-
- /** Interrupted because of block IO */
- int SOFTIRQ_BLOCK_IOPOLL = 5;
-
- /** Tasklet (differed device interrupt) */
- int SOFTIRQ_TASKLET = 6;
-
- /** Interrupted because of the scheduler */
- int SOFTIRQ_SCHED = 7;
-
- /** Interrupted because of HR timer */
- int SOFTIRQ_HRTIMER = 8;
-
- /** Interrupted because of RCU */
- int SOFTIRQ_RCU = 9;
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014, 2015 École Polytechnique de Montréal
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Geneviève Bastien - Initial API and implementation
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Externalized message strings from the LTTng Kernel Analysis
- *
- * @author Geneviève Bastien
- * @noreference Messages class
- */
-@NonNullByDefault({})
-@SuppressWarnings("javadoc")
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = Messages.class.getPackage().getName() + ".messages"; //$NON-NLS-1$
-
- public static String LttngKernelAnalysisModule_Help;
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexandre Montplaisir - Initial API and implementation
- ******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os;
-
-import ca.polymtl.dorsal.libdelorean.statevalue.ITmfStateValue;
-import ca.polymtl.dorsal.libdelorean.statevalue.TmfStateValue;
-
-/**
- * State values that are used in the kernel event handler. It's much better to
- * use integer values whenever possible, since those take much less space in the
- * history file.
- *
- * @author Alexandre Montplaisir
- * @noimplement This interface is not intended to be implemented by clients.
- */
-@SuppressWarnings("javadoc")
-public interface StateValues {
-
- /* Process status */
- int PROCESS_STATUS_UNKNOWN = 0;
- int PROCESS_STATUS_WAIT_BLOCKED = 1;
- int PROCESS_STATUS_RUN_USERMODE = 2;
- int PROCESS_STATUS_RUN_SYSCALL = 3;
- int PROCESS_STATUS_INTERRUPTED = 4;
- int PROCESS_STATUS_WAIT_FOR_CPU = 5;
- int PROCESS_STATUS_WAIT_UNKNOWN = 6;
-
- ITmfStateValue PROCESS_STATUS_UNKNOWN_VALUE = TmfStateValue.newValueInt(PROCESS_STATUS_UNKNOWN);
- ITmfStateValue PROCESS_STATUS_WAIT_UNKNOWN_VALUE = TmfStateValue.newValueInt(PROCESS_STATUS_WAIT_UNKNOWN);
- ITmfStateValue PROCESS_STATUS_WAIT_BLOCKED_VALUE = TmfStateValue.newValueInt(PROCESS_STATUS_WAIT_BLOCKED);
- ITmfStateValue PROCESS_STATUS_RUN_USERMODE_VALUE = TmfStateValue.newValueInt(PROCESS_STATUS_RUN_USERMODE);
- ITmfStateValue PROCESS_STATUS_RUN_SYSCALL_VALUE = TmfStateValue.newValueInt(PROCESS_STATUS_RUN_SYSCALL);
- ITmfStateValue PROCESS_STATUS_INTERRUPTED_VALUE = TmfStateValue.newValueInt(PROCESS_STATUS_INTERRUPTED);
- ITmfStateValue PROCESS_STATUS_WAIT_FOR_CPU_VALUE = TmfStateValue.newValueInt(PROCESS_STATUS_WAIT_FOR_CPU);
-
- /* CPU Status */
- int CPU_STATUS_IDLE = 0;
- /**
- * Soft IRQ raised, could happen in the CPU attribute but should not since
- * this means that the CPU went idle when a softirq was raised.
- */
- int CPU_STATUS_SOFT_IRQ_RAISED = (1 << 0);
- int CPU_STATUS_RUN_USERMODE = (1 << 1);
- int CPU_STATUS_RUN_SYSCALL = (1 << 2);
- int CPU_STATUS_SOFTIRQ = (1 << 3);
- int CPU_STATUS_IRQ = (1 << 4);
-
- ITmfStateValue CPU_STATUS_IDLE_VALUE = TmfStateValue.newValueInt(CPU_STATUS_IDLE);
- ITmfStateValue CPU_STATUS_RUN_USERMODE_VALUE = TmfStateValue.newValueInt(CPU_STATUS_RUN_USERMODE);
- ITmfStateValue CPU_STATUS_RUN_SYSCALL_VALUE = TmfStateValue.newValueInt(CPU_STATUS_RUN_SYSCALL);
- ITmfStateValue CPU_STATUS_IRQ_VALUE = TmfStateValue.newValueInt(CPU_STATUS_IRQ);
- ITmfStateValue CPU_STATUS_SOFTIRQ_VALUE = TmfStateValue.newValueInt(CPU_STATUS_SOFTIRQ);
-
- /** Soft IRQ is raised, CPU is in user mode */
- ITmfStateValue SOFT_IRQ_RAISED_VALUE = TmfStateValue.newValueInt(CPU_STATUS_SOFT_IRQ_RAISED);
-
- /** If the softirq is running and another is raised at the same time. */
- ITmfStateValue SOFT_IRQ_RAISED_RUNNING_VALUE = TmfStateValue.newValueInt(CPU_STATUS_SOFT_IRQ_RAISED | CPU_STATUS_SOFTIRQ);
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2016 Ericsson
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal;
-
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.lttng.scope.lttng.kernel.core.analysis.os.StateValues;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystemBuilder;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-import ca.polymtl.dorsal.libdelorean.statevalue.ITmfStateValue;
-import ca.polymtl.dorsal.libdelorean.statevalue.TmfStateValue;
-
-/**
- * IPI Entry Handler
- *
- * @author Matthew Khouzam
- */
-public class IPIEntryHandler extends KernelEventHandler {
-
- /**
- * Constructor
- *
- * @param layout
- * event layout
- */
- public IPIEntryHandler(ILttngKernelEventLayout layout) {
- super(layout);
- }
-
- @Override
- public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException {
-
- Integer cpu = KernelEventHandlerUtils.getCpu(event);
- if (cpu == null) {
- return;
- }
- Integer irqId = ((Long) event.getContent().getField(getLayout().fieldIPIVector()).getValue()).intValue();
-
- /*
- * Mark this IRQ as active in the resource tree. The state value = the
- * CPU on which this IRQ is sitting
- */
- int quark = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeIRQs(cpu, ss), irqId.toString());
-
- ITmfStateValue value = TmfStateValue.newValueInt(cpu.intValue());
- long timestamp = KernelEventHandlerUtils.getTimestamp(event);
- ss.modifyAttribute(timestamp, value, quark);
-
- /* Change the status of the running process to interrupted */
- quark = KernelEventHandlerUtils.getCurrentThreadNode(cpu, ss);
- value = StateValues.PROCESS_STATUS_INTERRUPTED_VALUE;
- ss.modifyAttribute(timestamp, value, quark);
-
- /* Change the status of the CPU to interrupted */
- quark = KernelEventHandlerUtils.getCurrentCPUNode(cpu, ss);
- value = StateValues.CPU_STATUS_IRQ_VALUE;
- ss.modifyAttribute(timestamp, value, quark);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2016 Ericsson
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal;
-
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystemBuilder;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-import ca.polymtl.dorsal.libdelorean.statevalue.TmfStateValue;
-
-/**
- * IPI Exit Handler
- *
- * @author Matthew Khouzam
- */
-public class IPIExitHandler extends KernelEventHandler {
-
- /**
- * Constructor
- *
- * @param layout
- * event layout
- */
- public IPIExitHandler(ILttngKernelEventLayout layout) {
- super(layout);
- }
-
- @Override
- public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException {
- Integer cpu = KernelEventHandlerUtils.getCpu(event);
- if (cpu == null) {
- return;
- }
- int currentThreadNode = KernelEventHandlerUtils.getCurrentThreadNode(cpu, ss);
- Integer irqId = ((Long) event.getContent().getField(getLayout().fieldIPIVector()).getValue()).intValue();
- /* Put this IRQ back to inactive in the resource tree */
- int quark = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeIRQs(cpu, ss), irqId.toString());
- TmfStateValue value = TmfStateValue.nullValue();
- long timestamp = KernelEventHandlerUtils.getTimestamp(event);
- ss.modifyAttribute(timestamp, value, quark);
-
- /* Set the previous process back to running */
- KernelEventHandlerUtils.setProcessToRunning(timestamp, currentThreadNode, ss);
-
- /* Set the CPU status back to running or "idle" */
- KernelEventHandlerUtils.cpuExitInterrupt(timestamp, cpu, ss);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal;
-
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.lttng.scope.lttng.kernel.core.analysis.os.StateValues;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystemBuilder;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-import ca.polymtl.dorsal.libdelorean.statevalue.ITmfStateValue;
-import ca.polymtl.dorsal.libdelorean.statevalue.TmfStateValue;
-
-/**
- * Irq Entry Handler
- */
-public class IrqEntryHandler extends KernelEventHandler {
-
- /**
- * Constructor
- *
- * @param layout
- * event layout
- */
- public IrqEntryHandler(ILttngKernelEventLayout layout) {
- super(layout);
- }
-
- @Override
- public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException {
-
- Integer cpu = KernelEventHandlerUtils.getCpu(event);
- if (cpu == null) {
- return;
- }
- Integer irqId = ((Long) event.getContent().getField(getLayout().fieldIrq()).getValue()).intValue();
-
- /*
- * Mark this IRQ as active in the resource tree.
- */
- int quark = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeIRQs(cpu, ss), irqId.toString());
-
- ITmfStateValue value = TmfStateValue.newValueInt(StateValues.CPU_STATUS_IRQ);
- long timestamp = KernelEventHandlerUtils.getTimestamp(event);
- ss.modifyAttribute(timestamp, value, quark);
-
- /* Change the status of the running process to interrupted */
- quark = KernelEventHandlerUtils.getCurrentThreadNode(cpu, ss);
- value = StateValues.PROCESS_STATUS_INTERRUPTED_VALUE;
- ss.modifyAttribute(timestamp, value, quark);
-
- /* Change the status of the CPU to interrupted */
- quark = KernelEventHandlerUtils.getCurrentCPUNode(cpu, ss);
- value = StateValues.CPU_STATUS_IRQ_VALUE;
- ss.modifyAttribute(timestamp, value, quark);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal;
-
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystemBuilder;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-import ca.polymtl.dorsal.libdelorean.statevalue.TmfStateValue;
-
-/**
- * Irq Exit handler
- */
-public class IrqExitHandler extends KernelEventHandler {
-
- /**
- * Constructor
- *
- * @param layout
- * event layout
- */
- public IrqExitHandler(ILttngKernelEventLayout layout) {
- super(layout);
- }
-
- @Override
- public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException {
- Integer cpu = KernelEventHandlerUtils.getCpu(event);
- if (cpu == null) {
- return;
- }
- int currentThreadNode = KernelEventHandlerUtils.getCurrentThreadNode(cpu, ss);
- Integer irqId = ((Long) event.getContent().getField(getLayout().fieldIrq()).getValue()).intValue();
- /* Put this IRQ back to inactive in the resource tree */
- int quark = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeIRQs(cpu, ss), irqId.toString());
- TmfStateValue value = TmfStateValue.nullValue();
- long timestamp = KernelEventHandlerUtils.getTimestamp(event);
- ss.modifyAttribute(timestamp, value, quark);
-
- /* Set the previous process back to running */
- KernelEventHandlerUtils.setProcessToRunning(timestamp, currentThreadNode, ss);
-
- /* Set the CPU status back to running or "idle" */
- KernelEventHandlerUtils.cpuExitInterrupt(timestamp, cpu, ss);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal;
-
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystemBuilder;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-
-/**
- * Base class for all kernel event handlers.
- */
-public abstract class KernelEventHandler {
-
- private final ILttngKernelEventLayout fLayout;
-
- /**
- * Constructor
- *
- * @param layout
- * the analysis layout
- */
- public KernelEventHandler(ILttngKernelEventLayout layout) {
- fLayout = layout;
- }
-
- /**
- * Get the analysis layout
- *
- * @return the analysis layout
- */
- protected ILttngKernelEventLayout getLayout() {
- return fLayout;
- }
-
- /**
- * Handle a specific kernel event.
- *
- * @param ss
- * the state system to write to
- * @param event
- * the event
- * @throws AttributeNotFoundException
- * if the attribute is not yet create
- */
- public abstract void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException;
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal;
-
-import java.util.List;
-
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.event.aspect.TmfCpuAspect;
-import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
-import org.lttng.scope.lttng.kernel.core.analysis.os.Attributes;
-import org.lttng.scope.lttng.kernel.core.analysis.os.StateValues;
-
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystemBuilder;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-import ca.polymtl.dorsal.libdelorean.exceptions.StateValueTypeException;
-import ca.polymtl.dorsal.libdelorean.exceptions.TimeRangeException;
-import ca.polymtl.dorsal.libdelorean.statevalue.ITmfStateValue;
-import ca.polymtl.dorsal.libdelorean.statevalue.TmfStateValue;
-
-/**
- * Kernel Event Handler Utils is a collection of static methods to be used in
- * subclasses of IKernelEventHandler.
- *
- * @author Matthew Khouzam
- * @author Francis Giraldeau
- */
-public final class KernelEventHandlerUtils {
-
- private KernelEventHandlerUtils() {
- }
-
- /**
- * Get CPU
- *
- * @param event
- * The event containing the cpu
- *
- * @return the CPU number (null for not set)
- */
- public static @Nullable Integer getCpu(ITmfEvent event) {
- Integer cpuObj = TmfTraceUtils.resolveIntEventAspectOfClassForEvent(event.getTrace(), TmfCpuAspect.class, event);
- if (cpuObj == null) {
- /* We couldn't find any CPU information, ignore this event */
- return null;
- }
- return cpuObj;
- }
-
- /**
- * Gets the current CPU quark
- *
- * @param cpuNumber
- * The cpu number
- * @param ss
- * the state system
- *
- * @return the current CPU quark -1 for not set
- */
- public static int getCurrentCPUNode(Integer cpuNumber, ITmfStateSystemBuilder ss) {
- return ss.getQuarkRelativeAndAdd(getNodeCPUs(ss), cpuNumber.toString());
- }
-
- /**
- * Get the timestamp of the event
- *
- * @param event
- * the event containing the timestamp
- *
- * @return the timestamp in long format
- */
- public static long getTimestamp(ITmfEvent event) {
- return event.getTimestamp().toNanos();
- }
-
- /**
- * Get the current thread node
- *
- * @param cpuNumber
- * The cpu number
- * @param ss
- * the state system
- *
- * @return the current thread node quark
- */
- public static int getCurrentThreadNode(Integer cpuNumber, ITmfStateSystemBuilder ss) {
- /*
- * Shortcut for the "current thread" attribute node. It requires
- * querying the current CPU's current thread.
- */
- int quark = ss.getQuarkRelativeAndAdd(getCurrentCPUNode(cpuNumber, ss), Attributes.CURRENT_THREAD);
- ITmfStateValue value = ss.queryOngoingState(quark);
- int thread = value.isNull() ? -1 : value.unboxInt();
- return ss.getQuarkRelativeAndAdd(getNodeThreads(ss), Attributes.buildThreadAttributeName(thread, cpuNumber));
- }
-
- /**
- * When we want to set a process back to a "running" state, first check its
- * current System_call attribute. If there is a system call active, we put
- * the process back in the syscall state. If not, we put it back in user
- * mode state.
- *
- * @param timestamp
- * the time in the state system of the change
- * @param currentThreadNode
- * The current thread node
- * @param ssb
- * the state system
- * @throws TimeRangeException
- * the time is out of range
- * @throws StateValueTypeException
- * the attribute was not set with int values
- * @throws AttributeNotFoundException
- * If the attribute is invalid
- */
- public static void setProcessToRunning(long timestamp, int currentThreadNode, ITmfStateSystemBuilder ssb)
- throws TimeRangeException, StateValueTypeException, AttributeNotFoundException {
- int quark;
- ITmfStateValue value;
-
- quark = ssb.getQuarkRelativeAndAdd(currentThreadNode, Attributes.SYSTEM_CALL);
- if (ssb.queryOngoingState(quark).isNull()) {
- /* We were in user mode before the interruption */
- value = StateValues.PROCESS_STATUS_RUN_USERMODE_VALUE;
- } else {
- /* We were previously in kernel mode */
- value = StateValues.PROCESS_STATUS_RUN_SYSCALL_VALUE;
- }
- ssb.modifyAttribute(timestamp, value, currentThreadNode);
- }
-
- /**
- * Get the IRQs node
- *
- * @param cpuNumber
- * the cpu core
- * @param ss
- * the state system
- * @return the IRQ node quark
- */
- public static int getNodeIRQs(int cpuNumber, ITmfStateSystemBuilder ss) {
- return ss.getQuarkAbsoluteAndAdd(Attributes.CPUS, Integer.toString(cpuNumber), Attributes.IRQS);
- }
-
- /**
- * Get the CPUs node
- *
- * @param ss
- * the state system
- * @return the CPU node quark
- */
- public static int getNodeCPUs(ITmfStateSystemBuilder ss) {
- return ss.getQuarkAbsoluteAndAdd(Attributes.CPUS);
- }
-
- /**
- * Get the Soft IRQs node
- *
- * @param cpuNumber
- * the cpu core
- * @param ss
- * the state system
- * @return the Soft IRQ node quark
- */
- public static int getNodeSoftIRQs(int cpuNumber, ITmfStateSystemBuilder ss) {
- return ss.getQuarkAbsoluteAndAdd(Attributes.CPUS, Integer.toString(cpuNumber), Attributes.SOFT_IRQS);
- }
-
- /**
- * Get the threads node
- *
- * @param ss
- * the state system
- * @return the threads quark
- */
- public static int getNodeThreads(ITmfStateSystemBuilder ss) {
- return ss.getQuarkAbsoluteAndAdd(Attributes.THREADS);
- }
-
- /**
- * Reset the CPU's status when it's coming out of an interruption.
- *
- * @param timestamp
- * the time when the status of the cpu is "leaving irq"
- * @param cpuNumber
- * the cpu returning to its previous state
- *
- * @param ssb
- * State system
- * @throws StateValueTypeException
- * the attribute is not set as an int
- * @throws TimeRangeException
- * the time is out of range
- * @throws AttributeNotFoundException
- * If the attribute is invalid
- */
- public static void cpuExitInterrupt(long timestamp, Integer cpuNumber, ITmfStateSystemBuilder ssb)
- throws StateValueTypeException, TimeRangeException, AttributeNotFoundException {
- int currentCPUNode = getCurrentCPUNode(cpuNumber, ssb);
-
- ITmfStateValue value = getCpuStatus(ssb, currentCPUNode);
- ssb.modifyAttribute(timestamp, value, currentCPUNode);
- }
-
- /**
- * Get the ongoing Status state of a CPU.
- *
- * This will look through the states of the
- *
- * <ul>
- * <li>IRQ</li>
- * <li>Soft IRQ</li>
- * <li>Process</li>
- * </ul>
- *
- * under the CPU, giving priority to states higher in the list. If the state
- * is a null value, we continue looking down the list.
- *
- * @param ssb
- * The state system
- * @param cpuQuark
- * The *quark* of the CPU we are looking for. Careful, this is
- * NOT the CPU number (or attribute name)!
- * @return The state value that represents the status of the given CPU
- * @throws AttributeNotFoundException
- */
- private static ITmfStateValue getCpuStatus(ITmfStateSystemBuilder ssb, int cpuQuark)
- throws AttributeNotFoundException {
-
- /* Check if there is a IRQ running */
- int irqQuarks = ssb.getQuarkRelativeAndAdd(cpuQuark, Attributes.IRQS);
- List<Integer> irqs = ssb.getSubAttributes(irqQuarks, false);
- for (Integer quark : irqs) {
- final ITmfStateValue irqState = ssb.queryOngoingState(quark.intValue());
- if (!irqState.isNull()) {
- return irqState;
- }
- }
-
- /* Check if there is a soft IRQ running */
- int softIrqQuarks = ssb.getQuarkRelativeAndAdd(cpuQuark, Attributes.SOFT_IRQS);
- List<Integer> softIrqs = ssb.getSubAttributes(softIrqQuarks, false);
- for (Integer quark : softIrqs) {
- final ITmfStateValue softIrqState = ssb.queryOngoingState(quark.intValue());
- if (!softIrqState.isNull()) {
- return softIrqState;
- }
- }
-
- /*
- * Check if there is a thread running. If not, report IDLE. If there is,
- * report the running state of the thread (usermode or system call).
- */
- int currentThreadQuark = ssb.getQuarkRelativeAndAdd(cpuQuark, Attributes.CURRENT_THREAD);
- ITmfStateValue currentThreadState = ssb.queryOngoingState(currentThreadQuark);
- if (currentThreadState.isNull()) {
- return TmfStateValue.nullValue();
- }
- int tid = currentThreadState.unboxInt();
- if (tid == 0) {
- return StateValues.CPU_STATUS_IDLE_VALUE;
- }
- int threadSystemCallQuark = ssb.getQuarkAbsoluteAndAdd(Attributes.THREADS, Integer.toString(tid), Attributes.SYSTEM_CALL);
- return (ssb.queryOngoingState(threadSystemCallQuark).isNull() ? StateValues.CPU_STATUS_RUN_USERMODE_VALUE : StateValues.CPU_STATUS_RUN_SYSCALL_VALUE);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal;
-
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
-import org.lttng.scope.lttng.kernel.core.analysis.os.Attributes;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystemBuilder;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-import ca.polymtl.dorsal.libdelorean.statevalue.ITmfStateValue;
-import ca.polymtl.dorsal.libdelorean.statevalue.TmfStateValue;
-
-/**
- * Set Prio handler
- */
-public class PiSetprioHandler extends KernelEventHandler {
-
- /**
- * Constructor
- * @param layout event layout
- */
- public PiSetprioHandler(ILttngKernelEventLayout layout) {
- super(layout);
- }
-
- @Override
- public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException {
- ITmfEventField content = event.getContent();
- Integer cpu = KernelEventHandlerUtils.getCpu(event);
- Integer tid = ((Long) content.getField(getLayout().fieldTid()).getValue()).intValue();
- Integer prio = ((Long) content.getField(getLayout().fieldNewPrio()).getValue()).intValue();
-
- String threadAttributeName = Attributes.buildThreadAttributeName(tid, cpu);
- if (threadAttributeName == null) {
- return;
- }
-
- Integer updateThreadNode = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeThreads(ss), threadAttributeName);
-
- /* Set the current prio for the new process */
- int quark = ss.getQuarkRelativeAndAdd(updateThreadNode, Attributes.PRIO);
- ITmfStateValue value = TmfStateValue.newValueInt(prio);
- ss.modifyAttribute(KernelEventHandlerUtils.getTimestamp(event), value, quark);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal;
-
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystemBuilder;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-
-/**
- * Process Exit handler
- */
-public class ProcessExitHandler extends KernelEventHandler {
-
- /**
- * Constructor
- *
- * @param layout
- * event layout
- */
- public ProcessExitHandler(ILttngKernelEventLayout layout) {
- super(layout);
- }
-
- @Override
- public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException {
- /* No state modifications tracked atm */
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal;
-
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
-import org.lttng.scope.lttng.kernel.core.analysis.os.Attributes;
-import org.lttng.scope.lttng.kernel.core.analysis.os.StateValues;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystemBuilder;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-import ca.polymtl.dorsal.libdelorean.statevalue.ITmfStateValue;
-import ca.polymtl.dorsal.libdelorean.statevalue.TmfStateValue;
-
-/**
- * Fork Handler
- */
-public class ProcessForkHandler extends KernelEventHandler {
-
- /**
- * Constructor
- *
- * @param layout
- * event layout
- */
- public ProcessForkHandler(ILttngKernelEventLayout layout) {
- super(layout);
- }
-
- @Override
- public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException {
- ITmfEventField content = event.getContent();
- Integer cpu = KernelEventHandlerUtils.getCpu(event);
- String childProcessName = (String) content.getField(getLayout().fieldChildComm()).getValue();
-
- Integer parentTid = ((Long) content.getField(getLayout().fieldParentTid()).getValue()).intValue();
- Integer childTid = ((Long) content.getField(getLayout().fieldChildTid()).getValue()).intValue();
-
- String parentThreadAttributeName = Attributes.buildThreadAttributeName(parentTid, cpu);
- if (parentThreadAttributeName == null) {
- return;
- }
-
- String childThreadAttributeName = Attributes.buildThreadAttributeName(childTid, cpu);
- if (childThreadAttributeName == null) {
- return;
- }
-
- final int threadsNode = KernelEventHandlerUtils.getNodeThreads(ss);
- Integer parentTidNode = ss.getQuarkRelativeAndAdd(threadsNode, parentThreadAttributeName);
- Integer childTidNode = ss.getQuarkRelativeAndAdd(threadsNode, childThreadAttributeName);
-
-
- /* Assign the PPID to the new process */
- int quark = ss.getQuarkRelativeAndAdd(childTidNode, Attributes.PPID);
- ITmfStateValue value = TmfStateValue.newValueInt(parentTid);
- long timestamp = KernelEventHandlerUtils.getTimestamp(event);
- ss.modifyAttribute(timestamp, value, quark);
-
- /* Set the new process' exec_name */
- quark = ss.getQuarkRelativeAndAdd(childTidNode, Attributes.EXEC_NAME);
- value = TmfStateValue.newValueString(childProcessName);
- ss.modifyAttribute(timestamp, value, quark);
-
- /*
- * Set the new process' status, it is initially in a blocked state. A
- * subsequent sched_wakeup_new will schedule it.
- */
- value = StateValues.PROCESS_STATUS_WAIT_BLOCKED_VALUE;
- ss.modifyAttribute(timestamp, value, childTidNode);
-
- /* Set the process' syscall name, to be the same as the parent's */
- quark = ss.getQuarkRelativeAndAdd(parentTidNode, Attributes.SYSTEM_CALL);
- value = ss.queryOngoingState(quark);
- if (!value.isNull()) {
- quark = ss.getQuarkRelativeAndAdd(childTidNode, Attributes.SYSTEM_CALL);
- ss.modifyAttribute(timestamp, value, quark);
- }
-
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal;
-
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.lttng.scope.lttng.kernel.core.analysis.os.Attributes;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystemBuilder;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-
-/**
- * Process free event handler
- */
-public class ProcessFreeHandler extends KernelEventHandler {
-
- /**
- * Constructor
- *
- * @param layout
- * event layout
- */
- public ProcessFreeHandler(ILttngKernelEventLayout layout) {
- super(layout);
- }
-
- @Override
- public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException {
-
- Integer cpu = KernelEventHandlerUtils.getCpu(event);
- Integer tid = ((Long) event.getContent().getField(getLayout().fieldTid()).getValue()).intValue();
-
- String threadAttributeName = Attributes.buildThreadAttributeName(tid, cpu);
- if (threadAttributeName == null) {
- return;
- }
-
- /*
- * Remove the process and all its sub-attributes from the current state
- */
- int quark = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeThreads(ss), threadAttributeName);
- ss.removeAttribute(KernelEventHandlerUtils.getTimestamp(event), quark);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2016 EfficiOS Inc., Alexandre Montplaisir
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal;
-
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.lttng.scope.lttng.kernel.core.analysis.os.Attributes;
-import org.lttng.scope.lttng.kernel.core.analysis.os.StateValues;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystemBuilder;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-import ca.polymtl.dorsal.libdelorean.statevalue.ITmfStateValue;
-import ca.polymtl.dorsal.libdelorean.statevalue.TmfStateValue;
-
-/**
- * Handler for task migration events. Normally moves a (non-running) process
- * from one run queue to another.
- *
- * @author Alexandre Montplaisir
- */
-public class SchedMigrateTaskHandler extends KernelEventHandler {
-
- /**
- * Constructor
- *
- * @param layout
- * The event layout to use
- */
- public SchedMigrateTaskHandler(ILttngKernelEventLayout layout) {
- super(layout);
- }
-
- @Override
- public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException {
- Long tid = event.getContent().getFieldValue(Long.class, getLayout().fieldTid());
- Long destCpu = event.getContent().getFieldValue(Long.class, getLayout().fieldDestCpu());
-
- if (tid == null || destCpu == null) {
- return;
- }
-
- long t = event.getTimestamp().toNanos();
-
- String threadAttributeName = Attributes.buildThreadAttributeName(tid.intValue(), null);
- if (threadAttributeName == null) {
- /* Swapper threads do not get migrated */
- return;
- }
- int threadNode = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeThreads(ss), threadAttributeName);
-
- /*
- * Put the thread in the "wait for cpu" state. Some older versions of
- * the kernel/tracers may not have the corresponding sched_waking events
- * that also does so, so we can set it at the migrate, if applicable.
- */
- ITmfStateValue value = StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE;
- ss.modifyAttribute(t, value, threadNode);
-
- /* Update the thread's running queue to the new one indicated by the event */
- int quark = ss.getQuarkRelativeAndAdd(threadNode, Attributes.CURRENT_CPU_RQ);
- value = TmfStateValue.newValueInt(destCpu.intValue());
- ss.modifyAttribute(t, value, quark);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal;
-
-import static java.util.Objects.requireNonNull;
-
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
-import org.lttng.scope.lttng.kernel.core.analysis.os.Attributes;
-import org.lttng.scope.lttng.kernel.core.analysis.os.LinuxValues;
-import org.lttng.scope.lttng.kernel.core.analysis.os.StateValues;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystemBuilder;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-import ca.polymtl.dorsal.libdelorean.exceptions.StateValueTypeException;
-import ca.polymtl.dorsal.libdelorean.statevalue.ITmfStateValue;
-import ca.polymtl.dorsal.libdelorean.statevalue.TmfStateValue;
-
-/**
- * Scheduler switch event handler
- */
-public class SchedSwitchHandler extends KernelEventHandler {
-
- /**
- * Constructor
- *
- * @param layout
- * event layout
- */
- public SchedSwitchHandler(ILttngKernelEventLayout layout) {
- super(layout);
- }
-
- @Override
- public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException {
- Integer cpu = KernelEventHandlerUtils.getCpu(event);
- if (cpu == null) {
- return;
- }
-
- ITmfEventField content = event.getContent();
- String prevProcessName = requireNonNull((String) content.getField(getLayout().fieldPrevComm()).getValue());
- Integer prevTid = ((Long) content.getField(getLayout().fieldPrevTid()).getValue()).intValue();
- Long prevState = requireNonNull((Long) content.getField(getLayout().fieldPrevState()).getValue());
- Integer prevPrio = ((Long) content.getField(getLayout().fieldPrevPrio()).getValue()).intValue();
- String nextProcessName = requireNonNull((String) content.getField(getLayout().fieldNextComm()).getValue());
- Integer nextTid = ((Long) content.getField(getLayout().fieldNextTid()).getValue()).intValue();
- Integer nextPrio = ((Long) content.getField(getLayout().fieldNextPrio()).getValue()).intValue();
-
- /* Will never return null since "cpu" is null checked */
- String formerThreadAttributeName = Attributes.buildThreadAttributeName(prevTid, cpu);
- String currenThreadAttributeName = Attributes.buildThreadAttributeName(nextTid, cpu);
-
- int nodeThreads = KernelEventHandlerUtils.getNodeThreads(ss);
- int formerThreadNode = ss.getQuarkRelativeAndAdd(nodeThreads, formerThreadAttributeName);
- int newCurrentThreadNode = ss.getQuarkRelativeAndAdd(nodeThreads, currenThreadAttributeName);
-
- long timestamp = KernelEventHandlerUtils.getTimestamp(event);
- /*
- * Set the status of the process that got scheduled out. This will also
- * set it's current CPU run queue accordingly.
- */
- setOldProcessStatus(ss, prevState, formerThreadNode, cpu, timestamp);
-
- /* Set the status of the new scheduled process */
- KernelEventHandlerUtils.setProcessToRunning(timestamp, newCurrentThreadNode, ss);
-
- /*
- * Set the current CPU run queue of the new process. Should be already
- * set if we've seen the previous sched_wakeup, but doesn't hurt to set
- * it here too.
- */
- int quark = ss.getQuarkRelativeAndAdd(newCurrentThreadNode, Attributes.CURRENT_CPU_RQ);
- ITmfStateValue value = TmfStateValue.newValueInt(cpu);
- ss.modifyAttribute(timestamp, value, quark);
-
- /* Set the exec name of the former process */
- setProcessExecName(ss, prevProcessName, formerThreadNode, timestamp);
-
- /* Set the exec name of the new process */
- setProcessExecName(ss, nextProcessName, newCurrentThreadNode, timestamp);
-
- /* Set the current prio for the former process */
- setProcessPrio(ss, prevPrio, formerThreadNode, timestamp);
-
- /* Set the current prio for the new process */
- setProcessPrio(ss, nextPrio, newCurrentThreadNode, timestamp);
-
- /* Set the current scheduled process on the relevant CPU */
- int currentCPUNode = KernelEventHandlerUtils.getCurrentCPUNode(cpu, ss);
- setCpuProcess(ss, nextTid, timestamp, currentCPUNode);
-
- /* Set the status of the CPU itself */
- setCpuStatus(ss, nextTid, newCurrentThreadNode, timestamp, currentCPUNode);
- }
-
- private static void setOldProcessStatus(ITmfStateSystemBuilder ss,
- long prevState, int formerThreadNode, int cpu, long timestamp) {
- ITmfStateValue value;
- boolean staysOnRunQueue = false;
- /*
- * Empirical observations and look into the linux code have
- * shown that the TASK_STATE_MAX flag is used internally and
- * |'ed with other states, most often the running state, so it
- * is ignored from the prevState value.
- *
- * Since Linux 4.1, the TASK_NOLOAD state was created and
- * TASK_STATE_MAX is now 2048. We use TASK_NOLOAD as the new max
- * because it does not modify the displayed state value.
- */
- int state = (int) (prevState & (LinuxValues.TASK_NOLOAD - 1));
-
- if (isRunning(state)) {
- value = StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE;
- staysOnRunQueue = true;
- } else if (isWaiting(state)) {
- value = StateValues.PROCESS_STATUS_WAIT_BLOCKED_VALUE;
- } else if (isDead(state)) {
- value = TmfStateValue.nullValue();
- } else {
- value = StateValues.PROCESS_STATUS_WAIT_UNKNOWN_VALUE;
- }
- ss.modifyAttribute(timestamp, value, formerThreadNode);
-
- int quark = ss.getQuarkRelativeAndAdd(formerThreadNode, Attributes.CURRENT_CPU_RQ);
- if (staysOnRunQueue) {
- /*
- * Set the thread's run queue. This will often be redundant with
- * previous events, but it may be the first time we see the
- * information too.
- */
- value = TmfStateValue.newValueInt(cpu);
- } else {
- value = TmfStateValue.nullValue();
- }
- ss.modifyAttribute(timestamp, value, quark);
- }
-
- private static boolean isDead(int state) {
- return (state & LinuxValues.TASK_DEAD) != 0;
- }
-
- private static boolean isWaiting(int state) {
- return (state & (LinuxValues.TASK_INTERRUPTIBLE | LinuxValues.TASK_UNINTERRUPTIBLE)) != 0;
- }
-
- private static boolean isRunning(int state) {
- // special case, this means ALL STATES ARE 0
- // this is effectively an anti-state
- return state == 0;
- }
-
- private static void setCpuStatus(ITmfStateSystemBuilder ss, Integer nextTid, Integer newCurrentThreadNode, long timestamp, int currentCPUNode)
- throws StateValueTypeException, AttributeNotFoundException {
- int quark;
- ITmfStateValue value;
- if (nextTid > 0) {
- /* Check if the entering process is in kernel or user mode */
- quark = ss.getQuarkRelativeAndAdd(newCurrentThreadNode, Attributes.SYSTEM_CALL);
- ITmfStateValue queryOngoingState = ss.queryOngoingState(quark);
- if (queryOngoingState.isNull()) {
- value = StateValues.CPU_STATUS_RUN_USERMODE_VALUE;
- } else {
- value = StateValues.CPU_STATUS_RUN_SYSCALL_VALUE;
- }
- } else {
- value = StateValues.CPU_STATUS_IDLE_VALUE;
- }
- ss.modifyAttribute(timestamp, value, currentCPUNode);
- }
-
- private static void setCpuProcess(ITmfStateSystemBuilder ss, Integer nextTid, long timestamp, int currentCPUNode)
- throws StateValueTypeException, AttributeNotFoundException {
- int quark;
- ITmfStateValue value;
- quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.CURRENT_THREAD);
- value = TmfStateValue.newValueInt(nextTid);
- ss.modifyAttribute(timestamp, value, quark);
- }
-
- private static void setProcessPrio(ITmfStateSystemBuilder ss, Integer prio, Integer threadNode, long timestamp)
- throws StateValueTypeException, AttributeNotFoundException {
- int quark;
- ITmfStateValue value;
- quark = ss.getQuarkRelativeAndAdd(threadNode, Attributes.PRIO);
- value = TmfStateValue.newValueInt(prio);
- ss.modifyAttribute(timestamp, value, quark);
- }
-
- private static void setProcessExecName(ITmfStateSystemBuilder ss, String processName, Integer threadNode, long timestamp)
- throws StateValueTypeException, AttributeNotFoundException {
- int quark;
- ITmfStateValue value;
- quark = ss.getQuarkRelativeAndAdd(threadNode, Attributes.EXEC_NAME);
- value = TmfStateValue.newValueString(processName);
- ss.modifyAttribute(timestamp, value, quark);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal;
-
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.lttng.scope.lttng.kernel.core.analysis.os.Attributes;
-import org.lttng.scope.lttng.kernel.core.analysis.os.StateValues;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystemBuilder;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-import ca.polymtl.dorsal.libdelorean.statevalue.ITmfStateValue;
-import ca.polymtl.dorsal.libdelorean.statevalue.TmfStateValue;
-
-/**
- * Waking/wakeup handler.
- *
- * "sched_waking" and "sched_wakeup" tracepoints contain the same fields, and
- * apply the same state transitions in our model, so they can both use this
- * handler.
- */
-public class SchedWakeupHandler extends KernelEventHandler {
-
- /**
- * Constructor
- * @param layout event layout
- */
- public SchedWakeupHandler(ILttngKernelEventLayout layout) {
- super(layout);
- }
-
- @Override
- public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException {
- Integer cpu = KernelEventHandlerUtils.getCpu(event);
- final int tid = ((Long) event.getContent().getField(getLayout().fieldTid()).getValue()).intValue();
- final int prio = ((Long) event.getContent().getField(getLayout().fieldPrio()).getValue()).intValue();
- Long targetCpu = event.getContent().getFieldValue(Long.class, getLayout().fieldTargetCpu());
-
- String threadAttributeName = Attributes.buildThreadAttributeName(tid, cpu);
- if (cpu == null || targetCpu == null || threadAttributeName == null) {
- return;
- }
-
- final int threadNode = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeThreads(ss), threadAttributeName);
-
- /*
- * The process indicated in the event's payload is now ready to run.
- * Assign it to the "wait for cpu" state, but only if it was not already
- * running.
- */
- int status = ss.queryOngoingState(threadNode).unboxInt();
- ITmfStateValue value = null;
- long timestamp = KernelEventHandlerUtils.getTimestamp(event);
- if (status != StateValues.PROCESS_STATUS_RUN_SYSCALL &&
- status != StateValues.PROCESS_STATUS_RUN_USERMODE) {
- value = StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE;
- ss.modifyAttribute(timestamp, value, threadNode);
- }
-
- /* Set the thread's target run queue */
- int quark = ss.getQuarkRelativeAndAdd(threadNode, Attributes.CURRENT_CPU_RQ);
- value = TmfStateValue.newValueInt(targetCpu.intValue());
- ss.modifyAttribute(timestamp, value, quark);
-
- /*
- * When a user changes a threads prio (e.g. with pthread_setschedparam),
- * it shows in ftrace with a sched_wakeup.
- */
- quark = ss.getQuarkRelativeAndAdd(threadNode, Attributes.PRIO);
- value = TmfStateValue.newValueInt(prio);
- ss.modifyAttribute(timestamp, value, quark);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal;
-
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.lttng.scope.lttng.kernel.core.analysis.os.StateValues;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystemBuilder;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-import ca.polymtl.dorsal.libdelorean.statevalue.ITmfStateValue;
-
-/**
- * Soft Irq Entry handler
- */
-public class SoftIrqEntryHandler extends KernelEventHandler {
-
- /**
- * Constructor
- *
- * @param layout
- * event layout
- */
- public SoftIrqEntryHandler(ILttngKernelEventLayout layout) {
- super(layout);
- }
-
- @Override
- public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException {
- Integer cpu = KernelEventHandlerUtils.getCpu(event);
- if (cpu == null) {
- return;
- }
-
- long timestamp = KernelEventHandlerUtils.getTimestamp(event);
- Integer softIrqId = ((Long) event.getContent().getField(getLayout().fieldVec()).getValue()).intValue();
- int currentCPUNode = KernelEventHandlerUtils.getCurrentCPUNode(cpu, ss);
- int currentThreadNode = KernelEventHandlerUtils.getCurrentThreadNode(cpu, ss);
-
- /*
- * Mark this SoftIRQ as active in the resource tree.
- */
- int quark = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeSoftIRQs(cpu, ss), softIrqId.toString());
- ITmfStateValue value = StateValues.CPU_STATUS_SOFTIRQ_VALUE;
- ss.modifyAttribute(timestamp, value, quark);
-
- /* Change the status of the running process to interrupted */
- value = StateValues.PROCESS_STATUS_INTERRUPTED_VALUE;
- ss.modifyAttribute(timestamp, value, currentThreadNode);
-
- /* Change the status of the CPU to interrupted */
- value = StateValues.CPU_STATUS_SOFTIRQ_VALUE;
- ss.modifyAttribute(timestamp, value, currentCPUNode);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal;
-
-import java.util.List;
-
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.lttng.scope.lttng.kernel.core.analysis.os.StateValues;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystemBuilder;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-import ca.polymtl.dorsal.libdelorean.statevalue.ITmfStateValue;
-import ca.polymtl.dorsal.libdelorean.statevalue.TmfStateValue;
-
-/**
- * Soft Irq exit handler
- */
-public class SoftIrqExitHandler extends KernelEventHandler {
-
- /**
- * Constructor
- *
- * @param layout
- * event layout
- */
- public SoftIrqExitHandler(ILttngKernelEventLayout layout) {
- super(layout);
- }
-
- @Override
- public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException {
- Integer cpu = KernelEventHandlerUtils.getCpu(event);
- if (cpu == null) {
- return;
- }
-
- Integer softIrqId = ((Long) event.getContent().getField(getLayout().fieldVec()).getValue()).intValue();
- int currentThreadNode = KernelEventHandlerUtils.getCurrentThreadNode(cpu, ss);
- /* Put this SoftIRQ back to inactive (= -1) in the resource tree */
- int quark = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeSoftIRQs(cpu, ss), softIrqId.toString());
- long timestamp = KernelEventHandlerUtils.getTimestamp(event);
- if (isSoftIrqRaised(ss.queryOngoingState(quark))) {
- ss.modifyAttribute(timestamp, StateValues.SOFT_IRQ_RAISED_VALUE, quark);
- } else {
- ss.modifyAttribute(timestamp, TmfStateValue.nullValue(), quark);
- }
- List<Integer> softIrqs = ss.getSubAttributes(ss.getParentAttributeQuark(quark), false);
- /* Only set status to running and no exit if ALL softirqs are exited. */
- for (Integer softIrq : softIrqs) {
- if (!ss.queryOngoingState(softIrq).isNull()) {
- return;
- }
- }
- /* Set the previous process back to running */
- KernelEventHandlerUtils.setProcessToRunning(timestamp, currentThreadNode, ss);
-
- /* Set the CPU status back to "busy" or "idle" */
- KernelEventHandlerUtils.cpuExitInterrupt(timestamp, cpu, ss);
- }
-
- /**
- * This checks if the running <stong>bit</strong> is set
- *
- * @param state
- * the state to check
- * @return true if in a softirq. The softirq may be pre-empted by an irq
- */
- private static boolean isSoftIrqRaised(@Nullable ITmfStateValue state) {
- return (state != null &&
- !state.isNull() &&
- (state.unboxInt() & StateValues.CPU_STATUS_SOFT_IRQ_RAISED) == StateValues.CPU_STATUS_SOFT_IRQ_RAISED);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal;
-
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.lttng.scope.lttng.kernel.core.analysis.os.StateValues;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystemBuilder;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-import ca.polymtl.dorsal.libdelorean.statevalue.ITmfStateValue;
-
-/**
- * Raise a soft irq event
- */
-public class SoftIrqRaiseHandler extends KernelEventHandler {
-
- /**
- * Constructor
- *
- * @param layout
- * event layout
- */
- public SoftIrqRaiseHandler(ILttngKernelEventLayout layout) {
- super(layout);
- }
-
- @Override
- public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException {
- Integer softIrqId = ((Long) event.getContent().getField(getLayout().fieldVec()).getValue()).intValue();
- Integer cpu = KernelEventHandlerUtils.getCpu(event);
- if (cpu == null) {
- return;
- }
- /*
- * Mark this SoftIRQ as *raised* in the resource tree.
- */
- int quark = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeSoftIRQs(cpu, ss), softIrqId.toString());
-
- ITmfStateValue value = (isInSoftirq(ss.queryOngoingState(quark)) ?
- StateValues.SOFT_IRQ_RAISED_RUNNING_VALUE :
- StateValues.SOFT_IRQ_RAISED_VALUE);
- ss.modifyAttribute(KernelEventHandlerUtils.getTimestamp(event), value, quark);
-
- }
-
- private static boolean isInSoftirq(@Nullable ITmfStateValue state) {
- return (state != null &&
- !state.isNull() &&
- (state.unboxInt() & StateValues.CPU_STATUS_SOFTIRQ) == StateValues.CPU_STATUS_SOFTIRQ);
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal;
-
-import static java.util.Objects.requireNonNull;
-
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
-import org.lttng.scope.lttng.kernel.core.analysis.os.Attributes;
-import org.lttng.scope.lttng.kernel.core.analysis.os.LinuxValues;
-import org.lttng.scope.lttng.kernel.core.analysis.os.StateValues;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystemBuilder;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-import ca.polymtl.dorsal.libdelorean.exceptions.StateValueTypeException;
-import ca.polymtl.dorsal.libdelorean.statevalue.ITmfStateValue;
-import ca.polymtl.dorsal.libdelorean.statevalue.TmfStateValue;
-
-/**
- * LTTng Specific state dump event handler
- */
-public class StateDumpHandler extends KernelEventHandler {
-
- /**
- * Constructor
- *
- * @param layout
- * event layout
- */
- public StateDumpHandler(ILttngKernelEventLayout layout) {
- super(layout);
- }
-
- @Override
- public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException {
- ITmfEventField content = event.getContent();
- Integer eventCpu = KernelEventHandlerUtils.getCpu(event);
- int tid = ((Long) content.getField("tid").getValue()).intValue(); //$NON-NLS-1$
- int pid = ((Long) content.getField("pid").getValue()).intValue(); //$NON-NLS-1$
- int ppid = ((Long) content.getField("ppid").getValue()).intValue(); //$NON-NLS-1$
- int status = ((Long) content.getField("status").getValue()).intValue(); //$NON-NLS-1$
- String name = requireNonNull((String) content.getField("name").getValue()); //$NON-NLS-1$
- /* Only present in LTTng 2.10+ */
- @Nullable Long cpuField = content.getFieldValue(Long.class, "cpu"); //$NON-NLS-1$
- /*
- * "mode" could be interesting too, but it doesn't seem to be populated
- * with anything relevant for now.
- */
-
- String threadAttributeName = Attributes.buildThreadAttributeName(tid, eventCpu);
- if (threadAttributeName == null) {
- return;
- }
-
- int curThreadNode = ss.getQuarkRelativeAndAdd(KernelEventHandlerUtils.getNodeThreads(ss), threadAttributeName);
- long timestamp = KernelEventHandlerUtils.getTimestamp(event);
- /* Set the process' name */
- setProcessName(ss, name, curThreadNode, timestamp);
-
- /* Set the process' PPID */
- setPpid(ss, tid, pid, ppid, curThreadNode, timestamp);
-
- /* Set the process' status */
- setStatus(ss, status, curThreadNode, cpuField, timestamp);
- }
-
- private static void setStatus(ITmfStateSystemBuilder ss, int status, int curThreadNode, @Nullable Long cpu, long timestamp) {
- ITmfStateValue value;
- if (ss.queryOngoingState(curThreadNode).isNull()) {
- switch (status) {
- case LinuxValues.STATEDUMP_PROCESS_STATUS_WAIT_CPU:
- value = StateValues.PROCESS_STATUS_WAIT_FOR_CPU_VALUE;
- setRunQueue(ss, curThreadNode, cpu, timestamp);
- break;
- case LinuxValues.STATEDUMP_PROCESS_STATUS_WAIT:
- /*
- * We have no information on what the process is waiting on
- * (unlike a sched_switch for example), so we will use the
- * WAIT_UNKNOWN state instead of the "normal" WAIT_BLOCKED
- * state.
- */
- value = StateValues.PROCESS_STATUS_WAIT_UNKNOWN_VALUE;
- break;
- default:
- value = StateValues.PROCESS_STATUS_UNKNOWN_VALUE;
- }
- ss.modifyAttribute(timestamp, value, curThreadNode);
- }
- }
-
- private static void setRunQueue(ITmfStateSystemBuilder ss, int curThreadNode, @Nullable Long cpu, long timestamp) {
- if (cpu != null) {
- int quark = ss.getQuarkRelativeAndAdd(curThreadNode, Attributes.CURRENT_CPU_RQ);
- ITmfStateValue value = TmfStateValue.newValueInt(cpu.intValue());
- ss.modifyAttribute(timestamp, value, quark);
- }
- }
-
- private static void setPpid(ITmfStateSystemBuilder ss, int tid, int pid, int ppid, int curThreadNode, long timestamp)
- throws StateValueTypeException, AttributeNotFoundException {
- ITmfStateValue value;
- int quark;
- quark = ss.getQuarkRelativeAndAdd(curThreadNode, Attributes.PPID);
- if (ss.queryOngoingState(quark).isNull()) {
- if (pid == tid) {
- /* We have a process. Use the 'PPID' field. */
- value = TmfStateValue.newValueInt(ppid);
- } else {
- /* We have a thread, use the 'PID' field for the parent. */
- value = TmfStateValue.newValueInt(pid);
- }
- ss.modifyAttribute(timestamp, value, quark);
- }
- }
-
- private static void setProcessName(ITmfStateSystemBuilder ss, String name, int curThreadNode, long timestamp)
- throws StateValueTypeException, AttributeNotFoundException {
- ITmfStateValue value;
- int quark = ss.getQuarkRelativeAndAdd(curThreadNode, Attributes.EXEC_NAME);
- if (ss.queryOngoingState(quark).isNull()) {
- /* If the value didn't exist previously, set it */
- value = TmfStateValue.newValueString(name);
- ss.modifyAttribute(timestamp, value, quark);
- }
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal;
-
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.lttng.scope.lttng.kernel.core.analysis.os.Attributes;
-import org.lttng.scope.lttng.kernel.core.analysis.os.StateValues;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystemBuilder;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-import ca.polymtl.dorsal.libdelorean.statevalue.ITmfStateValue;
-import ca.polymtl.dorsal.libdelorean.statevalue.TmfStateValue;
-
-/**
- * System call entry handler
- */
-public class SysEntryHandler extends KernelEventHandler {
-
- /**
- * Constructor
- *
- * @param layout
- * event layout
- */
- public SysEntryHandler(ILttngKernelEventLayout layout) {
- super(layout);
- }
-
- @Override
- public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException {
- Integer cpu = KernelEventHandlerUtils.getCpu(event);
- if (cpu == null) {
- return;
- }
- /* Assign the new system call to the process */
- int currentThreadNode = KernelEventHandlerUtils.getCurrentThreadNode(cpu, ss);
- int quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.SYSTEM_CALL);
- ITmfStateValue value = TmfStateValue.newValueString(event.getName());
- long timestamp = KernelEventHandlerUtils.getTimestamp(event);
- ss.modifyAttribute(timestamp, value, quark);
-
- /* Put the process in system call mode */
- value = StateValues.PROCESS_STATUS_RUN_SYSCALL_VALUE;
- ss.modifyAttribute(timestamp, value, currentThreadNode);
-
- /* Put the CPU in system call (kernel) mode */
- int currentCPUNode = KernelEventHandlerUtils.getCurrentCPUNode(cpu, ss);
- value = StateValues.CPU_STATUS_RUN_SYSCALL_VALUE;
- ss.modifyAttribute(timestamp, value, currentCPUNode);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal;
-
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.lttng.scope.lttng.kernel.core.analysis.os.Attributes;
-import org.lttng.scope.lttng.kernel.core.analysis.os.StateValues;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystemBuilder;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-import ca.polymtl.dorsal.libdelorean.statevalue.ITmfStateValue;
-import ca.polymtl.dorsal.libdelorean.statevalue.TmfStateValue;
-
-/**
- * System call exit handler
- */
-public class SysExitHandler extends KernelEventHandler {
-
- /**
- * Constructor
- *
- * @param layout
- * event layout
- */
- public SysExitHandler(ILttngKernelEventLayout layout) {
- super(layout);
- }
-
- @Override
- public void handleEvent(ITmfStateSystemBuilder ss, ITmfEvent event) throws AttributeNotFoundException {
- Integer cpu = KernelEventHandlerUtils.getCpu(event);
- if (cpu == null) {
- return;
- }
- /* Assign the new system call to the process */
- int currentThreadNode = KernelEventHandlerUtils.getCurrentThreadNode(cpu, ss);
- int quark = ss.getQuarkRelativeAndAdd(currentThreadNode, Attributes.SYSTEM_CALL);
- ITmfStateValue value = TmfStateValue.nullValue();
- long timestamp = KernelEventHandlerUtils.getTimestamp(event);
- ss.modifyAttribute(timestamp, value, quark);
-
- /* Put the process in system call mode */
- value = StateValues.PROCESS_STATUS_RUN_USERMODE_VALUE;
- ss.modifyAttribute(timestamp, value, currentThreadNode);
-
- /* Put the CPU in system call (kernel) mode */
- int currentCPUNode = KernelEventHandlerUtils.getCurrentCPUNode(cpu, ss);
- value = StateValues.CPU_STATUS_RUN_USERMODE_VALUE;
- ss.modifyAttribute(timestamp, value, currentCPUNode);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ericsson - Initial API and implementation
- *******************************************************************************/
-
-@org.eclipse.jdt.annotation.NonNullByDefault
-package org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal;
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2015 Ericsson
- * Copyright (c) 2010, 2011 École Polytechnique de Montréal
- * Copyright (c) 2010, 2011 Alexandre Montplaisir <alexandre.montplaisir@gmail.com>
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.analysis.os.internal;
-
-import static java.util.Objects.requireNonNull;
-
-import java.util.Map;
-
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.statesystem.AbstractTmfStateProvider;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.lttng.scope.lttng.kernel.core.activator.internal.Activator;
-import org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal.IPIEntryHandler;
-import org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal.IPIExitHandler;
-import org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal.IrqEntryHandler;
-import org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal.IrqExitHandler;
-import org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal.KernelEventHandler;
-import org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal.PiSetprioHandler;
-import org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal.ProcessExitHandler;
-import org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal.ProcessForkHandler;
-import org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal.ProcessFreeHandler;
-import org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal.SchedMigrateTaskHandler;
-import org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal.SchedSwitchHandler;
-import org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal.SchedWakeupHandler;
-import org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal.SoftIrqEntryHandler;
-import org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal.SoftIrqExitHandler;
-import org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal.SoftIrqRaiseHandler;
-import org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal.StateDumpHandler;
-import org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal.SysEntryHandler;
-import org.lttng.scope.lttng.kernel.core.analysis.os.handlers.internal.SysExitHandler;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-
-import com.google.common.collect.ImmutableMap;
-
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystemBuilder;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-import ca.polymtl.dorsal.libdelorean.exceptions.StateValueTypeException;
-import ca.polymtl.dorsal.libdelorean.exceptions.TimeRangeException;
-
-/**
- * This is the state change input plugin for the state system which handles the
- * kernel traces.
- *
- * Attribute tree:
- *
- * <pre>
- * |- CPUs
- * | |- <CPU number> -> CPU Status
- * | | |- CURRENT_THREAD
- * | | |- SOFT_IRQS
- * | | | |- <Soft IRQ number> -> Soft IRQ Status
- * | | |- IRQS
- * | | | |- <IRQ number> -> IRQ Status
- * |- THREADS
- * | |- <Thread number> -> Thread Status
- * | | |- PPID
- * | | |- EXEC_NAME
- * | | |- PRIO
- * | | |- SYSTEM_CALL
- * | | |- CURRENT_CPU_RQ
- * </pre>
- *
- * @author Alexandre Montplaisir
- */
-public class KernelStateProvider extends AbstractTmfStateProvider {
-
- // ------------------------------------------------------------------------
- // Static fields
- // ------------------------------------------------------------------------
-
- /**
- * Version number of this state provider. Please bump this if you modify the
- * contents of the generated state history in some way.
- */
- private static final int VERSION = 27;
-
- // ------------------------------------------------------------------------
- // Fields
- // ------------------------------------------------------------------------
-
- private final Map<String, KernelEventHandler> fEventNames;
- private final ILttngKernelEventLayout fLayout;
-
- private final KernelEventHandler fSysEntryHandler;
- private final KernelEventHandler fSysExitHandler;
-
- // ------------------------------------------------------------------------
- // Constructor
- // ------------------------------------------------------------------------
-
- /**
- * Instantiate a new state provider plugin.
- *
- * @param trace
- * The LTTng 2.0 kernel trace directory
- * @param layout
- * The event layout to use for this state provider. Usually
- * depending on the tracer implementation.
- */
- public KernelStateProvider(ITmfTrace trace, ILttngKernelEventLayout layout) {
- super(trace, "Kernel"); //$NON-NLS-1$
- fLayout = layout;
- fEventNames = buildEventNames(layout);
-
- fSysEntryHandler = new SysEntryHandler(fLayout);
- fSysExitHandler = new SysExitHandler(fLayout);
- }
-
- // ------------------------------------------------------------------------
- // Event names management
- // ------------------------------------------------------------------------
-
- private static Map<String, KernelEventHandler> buildEventNames(ILttngKernelEventLayout layout) {
- ImmutableMap.Builder<String, KernelEventHandler> builder = ImmutableMap.builder();
-
- builder.put(layout.eventIrqHandlerEntry(), new IrqEntryHandler(layout));
- builder.put(layout.eventIrqHandlerExit(), new IrqExitHandler(layout));
- builder.put(layout.eventSoftIrqEntry(), new SoftIrqEntryHandler(layout));
- builder.put(layout.eventSoftIrqExit(), new SoftIrqExitHandler(layout));
- builder.put(layout.eventSoftIrqRaise(), new SoftIrqRaiseHandler(layout));
- builder.put(layout.eventSchedSwitch(), new SchedSwitchHandler(layout));
- builder.put(layout.eventSchedPiSetprio(), new PiSetprioHandler(layout));
- builder.put(layout.eventSchedProcessFork(), new ProcessForkHandler(layout));
- builder.put(layout.eventSchedProcessExit(), new ProcessExitHandler(layout));
- builder.put(layout.eventSchedProcessFree(), new ProcessFreeHandler(layout));
- builder.put(layout.eventSchedProcessWaking(), new SchedWakeupHandler(layout));
- builder.put(layout.eventSchedMigrateTask(), new SchedMigrateTaskHandler(layout));
-
- for (String s : layout.getIPIIrqVectorsEntries()) {
- builder.put(s, new IPIEntryHandler(layout));
- }
- for (String s : layout.getIPIIrqVectorsExits()) {
- builder.put(s, new IPIExitHandler(layout));
- }
-
- final String eventStatedumpProcessState = layout.eventStatedumpProcessState();
- if (eventStatedumpProcessState != null) {
- builder.put(eventStatedumpProcessState, new StateDumpHandler(layout));
- }
-
- for (String eventSchedWakeup : layout.eventsSchedWakeup()) {
- builder.put(eventSchedWakeup, new SchedWakeupHandler(layout));
- }
-
- return builder.build();
- }
-
- // ------------------------------------------------------------------------
- // IStateChangeInput
- // ------------------------------------------------------------------------
-
- @Override
- public int getVersion() {
- return VERSION;
- }
-
- @Override
- public KernelStateProvider getNewInstance() {
- return new KernelStateProvider(this.getTrace(), fLayout);
- }
-
- @Override
- protected void eventHandle(@Nullable ITmfEvent event) {
- if (event == null) {
- return;
- }
-
- final String eventName = event.getName();
-
- try {
- final ITmfStateSystemBuilder ss = requireNonNull(getStateSystemBuilder());
- /*
- * Feed event to the history system if it's known to cause a state
- * transition.
- */
- KernelEventHandler handler = fEventNames.get(eventName);
- if (handler == null) {
- if (isSyscallExit(eventName)) {
- handler = fSysExitHandler;
- } else if (isSyscallEntry(eventName)) {
- handler = fSysEntryHandler;
- }
- }
- if (handler != null) {
- handler.handleEvent(ss, event);
- }
-
- } catch (AttributeNotFoundException ae) {
- /*
- * This would indicate a problem with the logic of the manager here,
- * so it shouldn't happen.
- */
- Activator.instance().logError("Attribute not found: " + ae.getMessage(), ae); //$NON-NLS-1$
-
- } catch (TimeRangeException tre) {
- /*
- * This would happen if the events in the trace aren't ordered
- * chronologically, which should never be the case ...
- */
- Activator.instance().logError("TimeRangeExcpetion caught in the state system's event manager.\n" + //$NON-NLS-1$
- "Are the events in the trace correctly ordered?\n" + tre.getMessage(), tre); //$NON-NLS-1$
-
- } catch (StateValueTypeException sve) {
- /*
- * This would happen if we were trying to push/pop attributes not of
- * type integer. Which, once again, should never happen.
- */
- Activator.instance().logError("State value error: " + sve.getMessage(), sve); //$NON-NLS-1$
- }
- }
-
- private boolean isSyscallEntry(String eventName) {
- return (eventName.startsWith(fLayout.eventSyscallEntryPrefix())
- || eventName.startsWith(fLayout.eventCompatSyscallEntryPrefix()));
- }
-
- private boolean isSyscallExit(String eventName) {
- return (eventName.startsWith(fLayout.eventSyscallExitPrefix()) ||
- eventName.startsWith(fLayout.eventCompatSyscallExitPrefix()));
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ericsson - Initial API and implementation
- *******************************************************************************/
-
-@org.eclipse.jdt.annotation.NonNullByDefault
-package org.lttng.scope.lttng.kernel.core.analysis.os.internal;
+++ /dev/null
-###############################################################################
-# Copyright (c) 2014, 2015 École Polytechnique de Montréal
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Geneviève Bastien - Initial API and implementation
-###############################################################################
-
-LttngKernelAnalysisModule_Help=Builds the LTTng2 kernel state system to populate the Control Flow view and the Resources View
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ericsson - Initial API and implementation
- *******************************************************************************/
-
-@org.eclipse.jdt.annotation.NonNullByDefault
-package org.lttng.scope.lttng.kernel.core.analysis.os;
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 École Polytechnique de Montréal
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Geneviève Bastien - Initial API and implementation
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.event.aspect;
-
-import static org.lttng.scope.common.core.NonNullUtils.nullToEmptyString;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
-import org.eclipse.tracecompass.tmf.core.event.aspect.TmfCpuAspect;
-import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
-import org.lttng.scope.lttng.kernel.core.analysis.os.KernelAnalysisModule;
-import org.lttng.scope.lttng.kernel.core.analysis.os.KernelThreadInformationProvider;
-
-/**
- * This aspect finds the ID of the thread running from this event using the
- * {@link KernelAnalysisModule}.
- *
- * @author Geneviève Bastien
- */
-public final class KernelTidAspect implements ITmfEventAspect<Integer> {
-
- /** The singleton instance */
- public static final KernelTidAspect INSTANCE = new KernelTidAspect();
-
- private static final IProgressMonitor NULL_MONITOR = new NullProgressMonitor();
-
- private KernelTidAspect() {
- }
-
- @Override
- public String getName() {
- return nullToEmptyString(Messages.KernelTidAspect_Name);
- }
-
- @Override
- public String getHelpText() {
- return nullToEmptyString(Messages.KernelTidAspect_HelpText);
- }
-
- @Override
- public @Nullable Integer resolve(ITmfEvent event) {
- return resolve(event, false, NULL_MONITOR);
- }
-
- @Override
- public @Nullable Integer resolve(@NonNull ITmfEvent event, boolean block, final IProgressMonitor monitor) {
- /* Find the CPU this event is run on */
- Integer cpu = TmfTraceUtils.resolveIntEventAspectOfClassForEvent(event.getTrace(),
- TmfCpuAspect.class, event);
- if (cpu == null) {
- return null;
- }
-
- /* Find the analysis module for the trace */
- KernelAnalysisModule analysis = TmfTraceUtils.getAnalysisModuleOfClass(event.getTrace(),
- KernelAnalysisModule.class, KernelAnalysisModule.ID);
- if (analysis == null) {
- return null;
- }
- long ts = event.getTimestamp().toNanos();
- while (block && !analysis.isQueryable(ts) && !monitor.isCanceled()) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- return KernelThreadInformationProvider.getThreadOnCpu(analysis, cpu, ts);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 École Polytechnique de Montréal
- *
- * All rights reserved. This program and the accompanying materials are made
- * available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Geneviève Bastien - Initial API and implementation
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.event.aspect;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * @noreference Messages class
- */
-@NonNullByDefault({})
-@SuppressWarnings("javadoc")
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = Messages.class.getPackage().getName() + ".messages"; //$NON-NLS-1$
-
- public static String ThreadPriorityAspect_Name;
- public static String ThreadPriorityAspect_HelpText;
-
- public static String KernelTidAspect_Name;
- public static String KernelTidAspect_HelpText;
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Keba AG
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Christian Mansky - Initial implementation
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.event.aspect;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
-import org.eclipse.tracecompass.tmf.core.event.aspect.TmfCpuAspect;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
-import org.lttng.scope.common.core.NonNullUtils;
-import org.lttng.scope.lttng.kernel.core.analysis.os.Attributes;
-import org.lttng.scope.lttng.kernel.core.analysis.os.KernelAnalysisModule;
-
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystem;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-import ca.polymtl.dorsal.libdelorean.exceptions.StateSystemDisposedException;
-import ca.polymtl.dorsal.libdelorean.exceptions.TimeRangeException;
-import ca.polymtl.dorsal.libdelorean.interval.ITmfStateInterval;
-import ca.polymtl.dorsal.libdelorean.statevalue.ITmfStateValue;
-
-/**
- * This aspect finds the priority of the thread running from this event using
- * the {@link KernelAnalysisModule}.
- *
- * @author Christian Mansky
- */
-public final class ThreadPriorityAspect implements ITmfEventAspect<Integer> {
-
- /** The singleton instance */
- public static final ThreadPriorityAspect INSTANCE = new ThreadPriorityAspect();
-
- private ThreadPriorityAspect() {
- }
-
- @Override
- public final String getName() {
- return NonNullUtils.nullToEmptyString(Messages.ThreadPriorityAspect_Name);
- }
-
- @Override
- public final String getHelpText() {
- return NonNullUtils.nullToEmptyString(Messages.ThreadPriorityAspect_HelpText);
- }
-
- @Override
- public @Nullable Integer resolve(ITmfEvent event) {
- final @NonNull ITmfTrace trace = event.getTrace();
- KernelAnalysisModule kernelAnalysis = TmfTraceUtils.getAnalysisModuleOfClass(trace, KernelAnalysisModule.class, KernelAnalysisModule.ID);
- if (kernelAnalysis == null) {
- return null;
- }
-
- ITmfStateSystem ss = kernelAnalysis.getStateSystem();
- if (ss == null) {
- return null;
- }
-
- Integer tid = KernelTidAspect.INSTANCE.resolve(event);
- if (tid == null) {
- return null;
- }
-
- final long ts = event.getTimestamp().getValue();
- Integer execPrio = null;
- try {
- Integer cpu = 0;
- if (tid == 0) {
- /* Find the CPU this event is run on */
- cpu = TmfTraceUtils.resolveIntEventAspectOfClassForEvent(trace, TmfCpuAspect.class, event);
- }
- int execPrioQuark = ss.getQuarkAbsolute(Attributes.THREADS, Attributes.buildThreadAttributeName(tid, cpu), Attributes.PRIO);
- ITmfStateInterval interval = ss.querySingleState(ts, execPrioQuark);
- ITmfStateValue prioValue = interval.getStateValue();
- /* We know the prio must be an Integer */
- execPrio = prioValue.unboxInt();
- } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) {
- }
- return execPrio;
- }
-}
+++ /dev/null
-###############################################################################
-# Copyright (c) 2015 École Polytechnique de Montréal
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# École Polytechnique de Montréal - Initial API and implementation
-###############################################################################
-
-ThreadPriorityAspect_Name = Prio
-ThreadPriorityAspect_HelpText = The priority of the thread this event belongs to
-
-KernelTidAspect_Name = TID
-KernelTidAspect_HelpText = The TID of the thread this event belongs to
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 École Polytechnique de Montréal
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * École Polytechnique de Montréal - Initial API and implementation
- *******************************************************************************/
-
-@org.eclipse.jdt.annotation.NonNullByDefault
-package org.lttng.scope.lttng.kernel.core.event.aspect;
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexandre Montplaisir - Initial API and implementation
- ******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.trace;
-
-import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-
-/**
- * Trace type that represents a Linux kernel trace.
- *
- * Any trace implementing the interface should be able to run the different
- * Linux kernel analyses in this plugin.
- *
- * @author Alexandre Montplaisir
- */
-@NonNullByDefault
-public interface IKernelTrace extends ITmfTrace {
-
- /**
- * Get the event layout of this trace. Many known concepts from the Linux
- * kernel may be exported under different names, depending on the tracer.
- *
- * @return The event layout
- */
- ILttngKernelEventLayout getKernelEventLayout();
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexandre Montplaisir - Initial API and implementation
- * Matthew Khouzam - Improved validation
- ******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.trace;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.tmf.core.event.CtfTmfEventType;
-import org.eclipse.tracecompass.ctf.tmf.core.trace.CtfTmfTrace;
-import org.eclipse.tracecompass.ctf.tmf.core.trace.CtfTraceValidationStatus;
-import org.eclipse.tracecompass.ctf.tmf.core.trace.CtfUtils;
-import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.eclipse.tracecompass.tmf.core.event.aspect.ITmfEventAspect;
-import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.tracecompass.tmf.core.trace.TraceValidationStatus;
-import org.lttng.scope.lttng.kernel.core.activator.internal.Activator;
-import org.lttng.scope.lttng.kernel.core.event.aspect.KernelTidAspect;
-import org.lttng.scope.lttng.kernel.core.event.aspect.ThreadPriorityAspect;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-import org.lttng.scope.lttng.kernel.core.trace.layout.internal.Lttng26EventLayout;
-import org.lttng.scope.lttng.kernel.core.trace.layout.internal.Lttng27EventLayout;
-import org.lttng.scope.lttng.kernel.core.trace.layout.internal.Lttng28EventLayout;
-import org.lttng.scope.lttng.kernel.core.trace.layout.internal.Lttng29EventLayout;
-import org.lttng.scope.lttng.kernel.core.trace.layout.internal.LttngEventLayout;
-import org.lttng.scope.lttng.kernel.core.trace.layout.internal.PerfEventLayout;
-
-import com.google.common.collect.ImmutableSet;
-
-/**
- * This is the specification of CtfTmfTrace for use with LTTng 2.x kernel
- * traces.
- *
- * @author Alexandre Montplaisir
- */
-public class LttngKernelTrace extends CtfTmfTrace implements IKernelTrace {
-
- /**
- * Supported Linux kernel tracers
- */
- private enum OriginTracer {
- LTTNG(LttngEventLayout.getInstance()),
- LTTNG26(Lttng26EventLayout.getInstance()),
- LTTNG27(Lttng27EventLayout.getInstance()),
- LTTNG28(Lttng28EventLayout.getInstance()),
- LTTNG29(Lttng29EventLayout.getInstance()),
- PERF(PerfEventLayout.getInstance());
-
- private final @NonNull ILttngKernelEventLayout fLayout;
-
- private OriginTracer(@NonNull ILttngKernelEventLayout layout) {
- fLayout = layout;
- }
- }
-
- /**
- * Event aspects available for all Lttng Kernel traces
- */
- private static final @NonNull Collection<ITmfEventAspect<?>> LTTNG_KERNEL_ASPECTS;
-
- static {
- ImmutableSet.Builder<ITmfEventAspect<?>> builder = ImmutableSet.builder();
- builder.addAll(CtfTmfTrace.CTF_ASPECTS);
- builder.add(KernelTidAspect.INSTANCE);
- builder.add(ThreadPriorityAspect.INSTANCE);
- LTTNG_KERNEL_ASPECTS = builder.build();
- }
-
- /**
- * CTF metadata identifies trace type and tracer version pretty well, we are
- * quite confident in the inferred trace type.
- */
- private static final int CONFIDENCE = 100;
-
- /** The tracer which originated this trace */
- private OriginTracer fOriginTracer = null;
-
- /**
- * Default constructor
- */
- public LttngKernelTrace() {
- super();
- }
-
- @Override
- public @NonNull ILttngKernelEventLayout getKernelEventLayout() {
- OriginTracer tracer = fOriginTracer;
- if (tracer == null) {
- throw new IllegalStateException("Cannot get the layout of a non-initialized trace!"); //$NON-NLS-1$
- }
- return tracer.fLayout;
- }
-
- @Override
- public void initTrace(IResource resource, String path,
- Class<? extends ITmfEvent> eventType) throws TmfTraceException {
- super.initTrace(resource, path, eventType);
- fOriginTracer = getTracerFromEnv();
- }
-
- /**
- * Identify which tracer generated a trace from its metadata.
- */
- private OriginTracer getTracerFromEnv() {
- String tracerName = CtfUtils.getTracerName(this);
- int tracerMajor = CtfUtils.getTracerMajorVersion(this);
- int tracerMinor = CtfUtils.getTracerMinorVersion(this);
-
- if ("perf".equals(tracerName)) { //$NON-NLS-1$
- return OriginTracer.PERF;
-
- } else if ("lttng-modules".equals(tracerName)) { //$NON-NLS-1$
- /* Look for specific versions of LTTng */
- if (tracerMajor >= 2) {
- if (tracerMinor >= 9) {
- return OriginTracer.LTTNG29;
- } else if (tracerMinor >= 8) {
- return OriginTracer.LTTNG28;
- } else if (tracerMinor >= 7) {
- return OriginTracer.LTTNG27;
- } else if (tracerMinor >= 6) {
- return OriginTracer.LTTNG26;
- }
- }
- }
-
- /* Use base LTTng layout as default */
- return OriginTracer.LTTNG;
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * This implementation sets the confidence to 100 if the trace is a valid
- * CTF trace in the "kernel" domain.
- */
- @Override
- public IStatus validate(final IProject project, final String path) {
- IStatus status = super.validate(project, path);
- if (status instanceof CtfTraceValidationStatus) {
- Map<String, String> environment = ((CtfTraceValidationStatus) status).getEnvironment();
- /* Make sure the domain is "kernel" in the trace's env vars */
- String domain = environment.get("domain"); //$NON-NLS-1$
- if (domain == null || !domain.equals("\"kernel\"")) { //$NON-NLS-1$
- return new Status(IStatus.ERROR, Activator.instance().getPluginId(), Messages.LttngKernelTrace_DomainError);
- }
- return new TraceValidationStatus(CONFIDENCE, Activator.instance().getPluginId());
- }
- return status;
- }
-
- @Override
- public Iterable<ITmfEventAspect<?>> getEventAspects() {
- return LTTNG_KERNEL_ASPECTS;
- }
-
- /*
- * Needs explicit @NonNull generic type annotation. Can be removed once this
- * class becomes @NonNullByDefault.
- */
- @Override
- public @NonNull Set<@NonNull CtfTmfEventType> getContainedEventTypes() {
- return super.getContainedEventTypes();
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Matthew Khouzam - Initial API and implementation
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.trace;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Message bundle for lttng2.kernel.core.trace
- *
- * @author Matthew Khouzam
- * @noreference Messages class
- */
-@SuppressWarnings("javadoc")
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = Messages.class.getPackage().getName() + ".messages"; //$NON-NLS-1$
-
- public static String LttngKernelTrace_DomainError;
- public static String LttngKernelTrace_MalformedTrace;
- public static String LttngKernelTrace_TraceReadError;
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014, 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexandre Montplaisir - Initial API and implementation
- ******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.trace.layout;
-
-import java.util.Collection;
-import java.util.Collections;
-
-import org.eclipse.jdt.annotation.Nullable;
-
-/**
- * Interface to define "concepts" present in the Linux kernel (represented by
- * its tracepoints), that can then be exposed by different tracers under
- * different names.
- *
- * @author Alexandre Montplaisir
- * @author Matthew Khouzam - Javadoc
- */
-public interface ILttngKernelEventLayout {
-
- // ------------------------------------------------------------------------
- // Common definitions
- // ------------------------------------------------------------------------
-
- /**
- * Whenever a process appears for the first time in a trace, we assume it
- * starts inside this system call. (The syscall prefix is defined by the
- * implementer of this interface.)
- *
- * TODO Change to a default method with Java 8?
- */
- String INITIAL_SYSCALL_NAME = "clone"; //$NON-NLS-1$
-
- // ------------------------------------------------------------------------
- // Event names
- // ------------------------------------------------------------------------
-
- /**
- * The system has just entered an interrupt handler or interrupt service
- * routine. On some systems, this is known as the first level interrupt
- * handler.
- *
- * @return the event name
- */
- String eventIrqHandlerEntry();
-
- /**
- * The system will soon return from an interrupt handler or interrupt
- * service routine.
- *
- * @return the event name
- */
- String eventIrqHandlerExit();
-
- /**
- * Whenever a system call is about to return to userspace, or a hardware
- * interrupt handler exits, any 'software interrupts' which are marked
- * pending (usually by hardware interrupts) are run. Much of the real
- * interrupt handling work is done here. The soft IRQ is also known as a
- * deferred IRQ in windows. An event identifying as this needs to occur as
- * the system is beginning to process the interrupt.
- *
- * @return the event name
- */
- String eventSoftIrqEntry();
-
- /**
- * Whenever a system call is about to return to userspace, or a hardware
- * interrupt handler exits, any 'software interrupts' which are marked
- * pending (usually by hardware interrupts) are run Much of the real
- * interrupt handling work is done here. The soft IRQ is also known as a
- * deferred IRQ in windows. An event identifying as this needs to occur as
- * the system is returning from the interrupt.
- *
- * @return the event name
- */
- String eventSoftIrqExit();
-
- /**
- * Whenever a system call is about to return to userspace, or a hardware
- * interrupt handler exits, any 'software interrupts' which are marked
- * pending (usually by hardware interrupts) are run Much of the real
- * interrupt handling work is done here. The soft IRQ is also known as a
- * deferred IRQ in windows. An event identifying as this needs to occur as
- * the system is signaling the need to enter the interrupt.
- *
- * @return the event name
- */
- String eventSoftIrqRaise();
-
- /**
- * The scheduler will call a scheduler switch event when it is removing a
- * task from a cpu and placing another one in its place. Which task and when
- * depend on the scheduling strategy and the task priorities. This is a
- * context switch.
- *
- * @return the event name
- */
- String eventSchedSwitch();
-
- /**
- * sched_PI_setprio is a tracepoint called often when the schedulder
- * priorities for a given task changes.
- *
- * @return the event name
- */
- String eventSchedPiSetprio();
-
- /**
- * Scheduler is waking up a task. this happens before it is executed, and
- * the data is loaded in memory if needed.
- *
- * @return the event names, as there are often several different ways to
- * wake up
- */
- Collection<String> eventsSchedWakeup();
-
- /**
- * Scheduler just forked a process, that means it has duplicated the program
- * and assigned it a different process ID. This event is often followed by
- * an {@link #eventSchedProcessExec()}. In windows, this is part of the
- * "spawn" process.
- *
- * @return the event name
- */
- String eventSchedProcessFork();
-
- /**
- * The process has finished running and the scheduler takes its TID back.
- *
- * @return the event name
- */
- String eventSchedProcessExit();
-
- /**
- * The process free tracepoint is called when a process has finished running
- * and the scheduler retrieves it's process ID.
- *
- * @return the event name
- */
- String eventSchedProcessFree();
-
- /**
- * Optional event used by some tracers to deliver an initial state.
- *
- * @return the event name
- */
- @Nullable String eventStatedumpProcessState();
-
- /**
- * System call entry prefix, something like "sys_open" or just "sys".
- *
- * @return the event name
- */
- String eventSyscallEntryPrefix();
-
- /**
- * System call compatibility layer entry prefix, something like
- * "compat_sys".
- *
- * @return the event name
- */
- String eventCompatSyscallEntryPrefix();
-
- /**
- * System call exit prefix, something like "sys_exit".
- *
- * @return the event name
- */
- String eventSyscallExitPrefix();
-
- /**
- * System call compatibility layer exit prefix, something like
- * "compat_syscall_exit".
- *
- * @return the event name
- */
- String eventCompatSyscallExitPrefix();
-
- /**
- * The scheduler replaced the current process image with a new one. The
- * process should also be renamed at this point. In windows, this is part of
- * the spawn process as well as fork.
- *
- * @return the event name
- */
- String eventSchedProcessExec();
-
- /**
- * The scheduler calls wakeup on a sleeping process. The process will
- * probably soon be scheduled in.
- *
- * @return the event name
- */
- String eventSchedProcessWakeup();
-
- /**
- * The scheduler calls wakeup on a sleeping process. The process will
- * probably soon be scheduled in. The new wakeup knows who triggered the
- * wakeup.
- *
- * @return the event name
- */
- String eventSchedProcessWakeupNew();
-
- /**
- * Event called when waking a task; this event is guaranteed to be called
- * from the waking context.
- *
- * @return The name of the event
- */
- default String eventSchedProcessWaking() {
- return "sched_waking"; //$NON-NLS-1$
- }
-
- /**
- * Migration event, moving a non-running thread from one CPU's run queue to
- * another.
- *
- * @return The event name
- */
- String eventSchedMigrateTask();
-
- /**
- * Starting the high resolution timer
- * <p>
- * In Linux, High resolution timers are used in the following:
- * <ul>
- * <li>nanosleep</li>
- * <li>itimers</li>
- * <li>posix timers</li>
- * </ul>
- *
- * @return the event name
- */
- String eventHRTimerStart();
-
- /**
- * Canceling the high resolution timer
- * <p>
- * In Linux, High resolution timers are used in the following:
- * <ul>
- * <li>nanosleep</li>
- * <li>itimers</li>
- * <li>posix timers</li>
- * </ul>
- *
- * @return the event name
- */
- String eventHRTimerCancel();
-
- /**
- * Entering the high resolution timer expired handler.
- * <p>
- * In Linux, High resolution timers are used in the following:
- * <ul>
- * <li>nanosleep</li>
- * <li>itimers</li>
- * <li>posix timers</li>
- * </ul>
- *
- * @return the event name
- */
- String eventHRTimerExpireEntry();
-
- /**
- * Exiting the high resolution timer expired handler.
- * <p>
- * In Linux, High resolution timers are used in the following:
- * <ul>
- * <li>nanosleep</li>
- * <li>itimers</li>
- * <li>posix timers</li>
- * </ul>
- *
- * @return the event name
- */
- String eventHRTimerExpireExit();
-
- /**
- * The kernel just allocated a page of memory.
- * <p>
- * In Linux, this typically means a user space application just got a page
- * of ram.
- *
- * @return the event name
- */
- String eventKmemPageAlloc();
-
- /**
- * The kernel just deallocated a page of memory.
- * <p>
- * In Linux, this typically means a page of ram was just freed
- *
- * @return the event name
- */
- String eventKmemPageFree();
-
- /**
- * <em>Interprocessor interrupts</em> (IPIs) are special types of interrupts by which
- * one processor will interrupt another in a multi-core and multi-cpu system. They are
- * typically used for
- * <ol>
- * <li>cache flushes</li>
- * <li>shutdowns</li>
- * <ol>
- * They are not logged with standard events, but rather events looking like
- * "x86_irq_vectors_thermal_apic_exit".
- * <p>
- * This event describes the entries into IPIs.
- *
- * @return the IPI list
- */
- default Collection<String> getIPIIrqVectorsEntries() {
- return Collections.emptyList();
- }
-
- /**
- * <em>Interprocessor interrupts</em> (IPIs) are special types of interrupts by which
- * one processor will interrupt another in a multi-core and multi-cpu system. They are
- * typically used for
- * <ol>
- * <li>cache flushes</li>
- * <li>shutdowns</li>
- * <ol>
- * They are not logged with standard events, but rather events looking like
- * "x86_irq_vectors_thermal_apic_exit".
- * <p>
- * This event describes the exits into IPIs.
- *
- * @return the IPI list
- */
- default Collection<String> getIPIIrqVectorsExits() {
- return Collections.emptyList();
- }
-
- // ------------------------------------------------------------------------
- // Event field names
- // ------------------------------------------------------------------------
-
- /**
- * The field with the IRQ number. This is used in irq_handlers (entry and
- * exit). For soft IRQs see {@link #fieldVec}.
- *
- * @return the name of the field with the IRQ number
- */
- String fieldIrq();
-
- /**
- * The field with the vector. This is the soft IRQ vector field used in soft
- * IRQ raise, entry and exit. For hardware IRQs see {@link #fieldIrq}.
- *
- * @return the name of the field with the soft IRQ vector name
- */
- String fieldVec();
-
- /**
- * The field with the thread ID. This is often used in scheduler calls to
- * know which thread is being affected. (normally not in switch, but in
- * priority and wakeup calls).
- *
- * @return the name of the field with the thread ID
- */
- String fieldTid();
-
- /**
- * The field with the previous thread id. This is used in switching
- * operations of a scheduler, when a thread is scheduled out for another,
- * this field shows the thread id being scheduled out.
- *
- * @return The name of the field with the ID of the previous thread
- */
- String fieldPrevTid();
-
- /**
- * The field with the state of the previous thread. This is used in
- * switching operations of a scheduler, when a thread is scheduled out for
- * another, this field shows the state of the thread being scheduled out.
- *
- * @return the name of the field of the previous thread's state
- */
- String fieldPrevState();
-
- /**
- * The field with the next command to be run. This is used in switching
- * operations of a scheduler, when a thread is scheduled out for another,
- * this field shows the command being scheduled in. A command's value is
- * often a String like "ls" or "hl3.exe".
- *
- * @return the name of the field with the next command to be run
- */
- String fieldNextComm();
-
- /**
- * The field with the next thread ID. This is used in switching operations
- * of a scheduler, when a thread is scheduled out for another, this field
- * shows the thread being scheduled in.
- *
- * @return the name of the field with the next thread ID
- */
- String fieldNextTid();
-
- /**
- * The field with the child command. This field is used in clone and spawn
- * activities, to know which executable the clone is running.
- *
- * @return the name of the field with the child command
- */
- String fieldChildComm();
-
- /**
- * The field with the parent thread ID. This field is used in clone and
- * spawn activities, to know which thread triggered the clone.
- *
- * @return the name of the field with the parent thread ID
- */
- String fieldParentTid();
-
- /**
- * The field with the child thread ID. This field is used in clone and spawn
- * activities, to know which thread is the clone.
- *
- * @return the name of the field with the child thread ID
- */
- String fieldChildTid();
-
- /**
- * The field with the command. This is used in scheduling tracepoints that
- * are not switches, and show the current process name. It is often a string
- * like "zsh" or "cmd.exe".
- *
- * @return the name of the command field
- */
- String fieldComm();
-
- /**
- * The field with the name. The name field is used in several disjoint
- * events.
- * <p>
- * Examples include:
- * <ul>
- * <li>writeback_* - the name of the io device, often "(unknown)"</li>
- * <li>module_* - the name of the module such as "binfmt_misc"</li>
- * <li>irq_handler_entry - the field describes the name of the handler such
- * as "i915"</li>
- * <ul>
- *
- * @return the name of the field with a name
- */
- String fieldName();
-
- /**
- * The field with the status. Often functions like a return value before we
- * hit an exit.
- * <p>
- * Examples include:
- * <ul>
- * <li>ext4* - status</li>
- * <li>asoc_snd_soc_cache_sync</li>
- * <li>rpc_*</li>
- * <li>state dumps</li>
- * </ul>
- *
- * @return The name of the field with a status
- */
- String fieldStatus();
-
- /**
- * The field with the last command to be run. This is often a string
- * representing the command of the thread being scheduled out from a
- * scheduler switch operation.
- *
- * @return the name of the field with the last command to be run
- */
- String fieldPrevComm();
-
- /**
- * The field with the file name field. This is a string used mostly with
- * file operations. These operations are often wrapped in system calls and
- * can be:
- * <ul>
- * <li>open</li>
- * <li>change mode</li>
- * <li>change directory</li>
- * <li>stat</li>
- * </ul>
- * It can also be used in exec commands to see what the command name should
- * be.
- * <p>
- * Please note that file read and write often do not use the file name, they
- * just use the file handle.
- *
- * @return the name of the field with the file name
- */
- String fieldFilename();
-
- /**
- * The field with the priority. The priority of a given process is used by
- * most scheduler events. The major exception is the switching operation as
- * it has two processes so it has a previous and next priority.
- *
- * @return the name of the field with the thread or process' priority
- */
- String fieldPrio();
-
- /**
- * The field with the new priority. This is used in the scheduler's
- * pi_setprio event event to show the new priority of the thread or process.
- *
- * @return the name of the field with the thread or process' new priority
- */
- String fieldNewPrio();
-
- /**
- * The field with the prev priority. This is used in the scheduler's switch
- * event to show the priority of the thread being scheduled out.
- *
- * @return the name of the field with the priority of the previous thread
- */
- String fieldPrevPrio();
-
- /**
- * The field with the next priority. This is used in the scheduler's switch
- * event to show the priority of the next thread or process.
- *
- * @return the name of the field with the thread or process' next priority
- */
- String fieldNextPrio();
-
- /**
- * The field with the hrtimer. The hrtimer holds the timer instance.
- *
- * @return the name of the hrTimer field
- */
- String fieldHRtimer();
-
- /**
- * The field with the expires value. The expires field holds the expiry
- * time. of the hrtimer.
- *
- * @return the name of the expires field
- */
- String fieldHRtimerExpires();
-
- /**
- * Gets the field name with the softexpires value. The softexpire value is
- * the absolute earliest expiry time of the hrtimer.
- *
- * @return the name of the softexpires field
- */
- String fieldHRtimerSoftexpires();
-
- /**
- * The field of the function address value. The function field holds timer
- * expiry callback function.
- *
- * @return the name of the function field
- */
- String fieldHRtimerFunction();
-
- /**
- * The field of the now value. The now field holds the current time.
- *
- * @return the name of the now field (hrtimer)
- */
- String fieldHRtimerNow();
-
- /**
- * The field containing the return value of a system call exit.
- *
- * @return The name of return field
- */
- default String fieldSyscallRet() {
- return "ret"; //$NON-NLS-1$
- }
-
- /**
- * Field indicating the upcoming CPU of sched_wakeup and sched_waking
- * events.
- *
- * @return The field name
- */
- default String fieldTargetCpu() {
- return "target_cpu"; //$NON-NLS-1$
- }
-
- /**
- * Field of scheduler migration events, indicating the destination CPU of a
- * thread being migrated.
- *
- * @return The field name
- */
- default String fieldDestCpu() {
- return "dest_cpu"; //$NON-NLS-1$
- }
-
- // ------------------------------------------------------------------------
- // I/O events and fields
- // ------------------------------------------------------------------------
-
- /**
- * A request to a block IO has just been inserted in the waiting queue.
- *
- * @return The name of the event
- */
- default String eventBlockRqInsert() {
- return "block_rq_insert"; //$NON-NLS-1$
- }
-
- /**
- * A request to a block IO has just been issued and passed from the waiting
- * queue to the driver queue. It is being served.
- *
- * @return The name of the event
- */
- default String eventBlockRqIssue() {
- return "block_rq_issue"; //$NON-NLS-1$
- }
-
- /**
- * A request to a block IO has just been completed.
- *
- * @return The name of the event
- */
- default String eventBlockRqComplete() {
- return "block_rq_complete"; //$NON-NLS-1$
- }
-
- /**
- * A BIO operation is being merged at the front of a waiting request
- *
- * @return The name of the event
- */
- default String eventBlockBioFrontmerge() {
- return "block_bio_frontmerge"; //$NON-NLS-1$
- }
-
- /**
- * A BIO operation is being merged at the back of a waiting request
- *
- * @return The name of the event
- */
- default String eventBlockBioBackmerge() {
- return "block_bio_backmerge"; //$NON-NLS-1$
- }
-
- /**
- * 2 requests previously inserted in the waiting queue are being merged
- *
- * @return The name of the event
- */
- default String eventBlockRqMerge() {
- return "block_rq_merge"; //$NON-NLS-1$
- }
-
- /**
- * Optional event used by some tracers to associate the name of the block
- * device to a device ID
- *
- * @return The name of the event
- */
- default @Nullable String eventStatedumpBlockDevice() {
- return null;
- }
-
- /**
- * The field containing the device ID
- *
- * @return The name of the field
- */
- default String fieldBlockDeviceId() {
- return "dev"; //$NON-NLS-1$
- }
-
- /**
- * The field with the first sector of a block operation
- *
- * @return The name of the field
- */
- default String fieldBlockSector() {
- return "sector"; //$NON-NLS-1$
- }
-
- /**
- * The field with the number of sectors involved in a block operation
- *
- * @return The name of the field
- */
- default String fieldBlockNrSector() {
- return "nr_sector"; //$NON-NLS-1$
- }
-
- /**
- * The field containing the read/write flag of a block operation
- *
- * @return The name of the field
- */
- default String fieldBlockRwbs() {
- return "rwbs"; //$NON-NLS-1$
- }
-
- /**
- * The field with the first sector of a request in which another block
- * operation is being merged
- *
- * @return The name of the field
- */
- default String fieldBlockRqSector() {
- return "rq_sector"; //$NON-NLS-1$
- }
-
- /**
- * The field with the sector of the request being merged in another one
- *
- * @return The name of the field
- */
- default String fieldBlockNextRqSector() {
- return "nextrq_sector"; //$NON-NLS-1$
- }
-
- /**
- * The field containing the name of the disk
- *
- * @return The name of the field
- */
- default String fieldDiskname() {
- return "diskname"; //$NON-NLS-1$
- }
-
- /**
- * The field with the IRQ number. This is used in IPI handlers (entry and
- * exit).
- *
- * @return the name of the field with the IRQ number
- */
- default String fieldIPIVector() {
- return "vector"; //$NON-NLS-1$
- }
-
-
- /**
- * Get the name of the 'order' field from memory page allocation events.
- *
- * The 'order' of a page allocation is it's logarithm to the base 2, and the
- * size of the allocation is 2^order, an integral power-of-2 number of
- * pages. 'Order' ranges from from 0 to MAX_ORDER-1.
- *
- * The smallest - and most frequent - page allocation is 2^0 or 1 page. The
- * maximum allocation possible is 2^(MAX_ORDER-1) pages. MAX_ORDER is
- * assigned a default value of 11 - resulting in a maximum allocation of
- * 2^10 or 1024 pages. However it may be redefined at kernel configuration
- * time with the option CONFIG_FORCE_MAX_ZONEORDER.
- *
- * @return the name of the order field
- */
- default @Nullable String fieldOrder() {
- return null;
- }
-
- // ------------------------------------------------------------------------
- // Network events and fields
- // ------------------------------------------------------------------------
-
- /**
- * Get the list of events indicating that a packet is sent on the network
- *
- * @return The name of the packet send event
- */
- default Collection<String> eventsNetworkSend() {
- return Collections.EMPTY_SET;
- }
-
- /**
- * Get the list of events indicating that a packet is received from the
- * network
- *
- * @return The collection of names of the packet receive event
- */
- default Collection<String> eventsNetworkReceive() {
- return Collections.EMPTY_SET;
- }
-
- /**
- * The path of the field corresponding to the sequence number field of a TCP
- * header
- *
- * @return The path of the sequence number field in the TCP header of a
- * network packet
- */
- default String[] fieldPathTcpSeq() {
- return new String[] { "seq" }; //$NON-NLS-1$
- }
-
- /**
- * The path of the field corresponding to the acknowledgment number field of
- * a TCP header
- *
- * @return The name of the acknowledgment number field in the TCP header of
- * a network packet
- */
- default String[] fieldPathTcpAckSeq() {
- return new String[] { "ack_seq" }; //$NON-NLS-1$
- }
-
- /**
- * The path of the field corresponding to the flags field of a TCP header
- *
- * @return The path of the flags field in the TCP header of a network packet
- */
- default String[] fieldPathTcpFlags() {
- return new String[] { "flags" }; //$NON-NLS-1$
- }
-
- // ------------------------------------------------------------------------
- // VirtualMachine events : kvm entry/exit events
- // ------------------------------------------------------------------------
-
- /**
- * KVM kernel event indicating that virtual machine code is being run
- *
- * @return The name of the kvm entry event
- */
- default Collection<String> eventsKVMEntry() {
- return Collections.EMPTY_SET;
- }
-
- /**
- * KVM kernel event indicating that virtual machine code is not run anymore,
- * but rather hypervisor-specific code
- *
- * @return The name of the kvm exit event
- */
- default Collection<String> eventsKVMExit() {
- return Collections.EMPTY_SET;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexandre Montplaisir - Initial API and implementation
- ******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.trace.layout.internal;
-
-/**
- * This file defines all the known event and field names for LTTng kernel
- * traces, for versions of lttng-modules 2.6 and above.
- *
- * @author Alexandre Montplaisir
- */
-public class Lttng26EventLayout extends LttngEventLayout {
-
- /**
- * Constructor
- */
- protected Lttng26EventLayout() {}
-
- private static final Lttng26EventLayout INSTANCE = new Lttng26EventLayout();
-
- public static Lttng26EventLayout getInstance() {
- return INSTANCE;
- }
-
- // ------------------------------------------------------------------------
- // New event names in these versions
- // ------------------------------------------------------------------------
-
- @Override
- public String eventSyscallEntryPrefix() {
- return "syscall_entry_"; //$NON-NLS-1$
- }
-
- @Override
- public String eventCompatSyscallEntryPrefix() {
- return "compat_syscall_entry_"; //$NON-NLS-1$
- }
-
- @Override
- public String eventSyscallExitPrefix() {
- return "syscall_exit_"; //$NON-NLS-1$
- }
-
- @Override
- public String eventCompatSyscallExitPrefix() {
- return "compat_syscall_exit_"; //$NON-NLS-1$
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson, École Polytechnique de Montréal
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Sebastien Lorrain - Initial API and implementation
- ******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.trace.layout.internal;
-
-import java.util.Collection;
-import java.util.Collections;
-
-import org.eclipse.jdt.annotation.NonNull;
-
-import com.google.common.collect.ImmutableSet;
-
-/**
- * This file defines all the known event and field names for LTTng kernel
- * traces, for versions of lttng-modules 2.7 and above.
- *
- * @author Sebastien Lorrain
- */
-@SuppressWarnings("javadoc")
-public class Lttng27EventLayout extends Lttng26EventLayout {
-
- private static final String X86_IRQ_VECTORS_LOCAL_TIMER_ENTRY = "x86_irq_vectors_local_timer_entry"; //$NON-NLS-1$
- private static final String X86_IRQ_VECTORS_LOCAL_TIMER_EXIT = "x86_irq_vectors_local_timer_exit"; //$NON-NLS-1$
- private static final String X86_IRQ_VECTORS_RESCHEDULE_ENTRY = "x86_irq_vectors_reschedule_entry"; //$NON-NLS-1$
- private static final String X86_IRQ_VECTORS_RESCHEDULE_EXIT = "x86_irq_vectors_reschedule_exit"; //$NON-NLS-1$
- private static final String X86_IRQ_VECTORS_SPURIOUS_ENTRY = "x86_irq_vectors_spurious_apic_entry"; //$NON-NLS-1$
- private static final String X86_IRQ_VECTORS_SPURIOUS_EXIT = "x86_irq_vectors_spurious_apic_exit"; //$NON-NLS-1$
- private static final String X86_IRQ_VECTORS_ERROR_APIC_ENTRY = "x86_irq_vectors_error_apic_entry"; //$NON-NLS-1$
- private static final String X86_IRQ_VECTORS_ERROR_APIC_EXIT = "x86_irq_vectors_error_apic_exit"; //$NON-NLS-1$
- private static final String X86_IRQ_VECTORS_IPI_ENTRY = "x86_irq_vectors_ipi_entry"; //$NON-NLS-1$
- private static final String X86_IRQ_VECTORS_IPI_EXIT = "x86_irq_vectors_ipi_exit"; //$NON-NLS-1$
- private static final String X86_IRQ_VECTORS_IRQ_WORK_ENTRY = "x86_irq_vectors_irq_work_entry"; //$NON-NLS-1$
- private static final String X86_IRQ_VECTORS_IRQ_WORK_EXIT = "x86_irq_vectors_irq_work_exit"; //$NON-NLS-1$
- private static final String X86_IRQ_VECTORS_CALL_FUNCTION_ENTRY = "x86_irq_vectors_call_function_entry"; //$NON-NLS-1$
- private static final String X86_IRQ_VECTORS_CALL_FUNCTION_EXIT = "x86_irq_vectors_call_function_exit"; //$NON-NLS-1$
- private static final String X86_IRQ_VECTORS_CALL_FUNCTION_SINGLE_ENTRY = "x86_irq_vectors_call_function_single_entry"; //$NON-NLS-1$
- private static final String X86_IRQ_VECTORS_CALL_FUNCTION_SINGLE_EXIT = "x86_irq_vectors_call_function_single_exit"; //$NON-NLS-1$
- private static final String X86_IRQ_VECTORS_THRESHOLD_APIC_ENTRY = "x86_irq_vectors_threshold_apic_entry"; //$NON-NLS-1$
- private static final String X86_IRQ_VECTORS_THRESHOLD_APIC_EXIT = "x86_irq_vectors_threshold_apic_exit"; //$NON-NLS-1$
- private static final String X86_IRQ_VECTORS_DEFERRED_ERROR_APIC_ENTRY = "x86_irq_vectors_deferred_error_apic_entry"; //$NON-NLS-1$
- private static final String X86_IRQ_VECTORS_DEFERRED_ERROR_APIC_EXIT = "x86_irq_vectors_deferred_error_apic_exit"; //$NON-NLS-1$
- private static final String X86_IRQ_VECTORS_THERMAL_APIC_ENTRY = "x86_irq_vectors_thermal_apic_entry"; //$NON-NLS-1$
- private static final String X86_IRQ_VECTORS_THERMAL_APIC_EXIT = "x86_irq_vectors_thermal_apic_exit"; //$NON-NLS-1$
- /* Network event */
- private static final Collection<String> EVENTS_NETWORK_RECEIVE = Collections.singleton("net_if_receive_skb"); //$NON-NLS-1$
- /* KVM events */
- private static final Collection<String> KVM_ENTRY_EVENTS = Collections.singleton("kvm_x86_entry"); //$NON-NLS-1$
- private static final Collection<String> KVM_EXIT_EVENTS = Collections.singleton("kvm_x86_exit"); //$NON-NLS-1$
-
- private static final Collection<String> IPI_ENTRY_SET = ImmutableSet.of(
- X86_IRQ_VECTORS_LOCAL_TIMER_ENTRY,
- X86_IRQ_VECTORS_RESCHEDULE_ENTRY,
- X86_IRQ_VECTORS_SPURIOUS_ENTRY,
- X86_IRQ_VECTORS_ERROR_APIC_ENTRY,
- X86_IRQ_VECTORS_IPI_ENTRY,
- X86_IRQ_VECTORS_IRQ_WORK_ENTRY,
- X86_IRQ_VECTORS_CALL_FUNCTION_ENTRY,
- X86_IRQ_VECTORS_CALL_FUNCTION_SINGLE_ENTRY,
- X86_IRQ_VECTORS_THRESHOLD_APIC_ENTRY,
- X86_IRQ_VECTORS_DEFERRED_ERROR_APIC_ENTRY,
- X86_IRQ_VECTORS_THERMAL_APIC_ENTRY);
-
- private static final Collection<String> IPI_EXIT_SET = ImmutableSet.of(
- X86_IRQ_VECTORS_LOCAL_TIMER_EXIT,
- X86_IRQ_VECTORS_RESCHEDULE_EXIT,
- X86_IRQ_VECTORS_SPURIOUS_EXIT,
- X86_IRQ_VECTORS_ERROR_APIC_EXIT,
- X86_IRQ_VECTORS_IPI_EXIT,
- X86_IRQ_VECTORS_IRQ_WORK_EXIT,
- X86_IRQ_VECTORS_CALL_FUNCTION_EXIT,
- X86_IRQ_VECTORS_CALL_FUNCTION_SINGLE_EXIT,
- X86_IRQ_VECTORS_THRESHOLD_APIC_EXIT,
- X86_IRQ_VECTORS_DEFERRED_ERROR_APIC_EXIT,
- X86_IRQ_VECTORS_THERMAL_APIC_EXIT);
-
- /**
- * Constructor
- */
- protected Lttng27EventLayout() {}
-
- private static final Lttng27EventLayout INSTANCE = new Lttng27EventLayout();
-
- public static Lttng27EventLayout getInstance() {
- return INSTANCE;
- }
-
- // ------------------------------------------------------------------------
- // New event definition in LTTng 2.7
- // ------------------------------------------------------------------------
-
- @Override
- public String eventHRTimerStart() {
- return "timer_hrtimer_start"; //$NON-NLS-1$
- }
-
- @Override
- public String eventHRTimerCancel() {
- return "timer_hrtimer_cancel"; //$NON-NLS-1$
- }
-
- @Override
- public String eventHRTimerExpireEntry() {
- return "timer_hrtimer_expire_entry"; //$NON-NLS-1$
- }
-
- @Override
- public String eventHRTimerExpireExit() {
- return "timer_hrtimer_expire_exit"; //$NON-NLS-1$
- }
-
- @Override
- public String eventSoftIrqRaise() {
- return "irq_softirq_raise"; //$NON-NLS-1$
- }
-
- @Override
- public String eventSoftIrqEntry() {
- return "irq_softirq_entry"; //$NON-NLS-1$
- }
-
- @Override
- public String eventSoftIrqExit() {
- return "irq_softirq_exit"; //$NON-NLS-1$
- }
-
- @Override
- public String eventKmemPageAlloc() {
- return "kmem_mm_page_alloc"; //$NON-NLS-1$
- }
-
- @Override
- public String eventKmemPageFree() {
- return "kmem_mm_page_free"; //$NON-NLS-1$
- }
-
- public String x86IrqVectorsLocalTimerEntry() {
- return X86_IRQ_VECTORS_LOCAL_TIMER_ENTRY;
- }
-
- public String x86IrqVectorsLocalTimerExit() {
- return X86_IRQ_VECTORS_LOCAL_TIMER_EXIT;
- }
-
- public String x86IrqVectorsRescheduleEntry() {
- return X86_IRQ_VECTORS_RESCHEDULE_ENTRY;
- }
-
- public String x86IrqVectorsRescheduleExit() {
- return X86_IRQ_VECTORS_RESCHEDULE_EXIT;
- }
-
- public String x86IrqVectorsSpuriousApicEntry() {
- return X86_IRQ_VECTORS_SPURIOUS_ENTRY;
- }
-
- public String x86IrqVectorsSpuriousApicExit() {
- return X86_IRQ_VECTORS_SPURIOUS_EXIT;
- }
-
- public String x86IrqVectorsErrorApicEntry() {
- return X86_IRQ_VECTORS_ERROR_APIC_ENTRY;
- }
-
- public String x86IrqVectorsErrorApicExit() {
- return X86_IRQ_VECTORS_ERROR_APIC_EXIT;
- }
-
- public String x86IrqVectorsIpiEntry() {
- return X86_IRQ_VECTORS_IPI_ENTRY;
- }
-
- public String x86IrqVectorsIpiExit() {
- return X86_IRQ_VECTORS_IPI_EXIT;
- }
-
- public String x86IrqVectorsIrqWorkEntry() {
- return X86_IRQ_VECTORS_IRQ_WORK_ENTRY;
- }
-
- public String x86IrqVectorsIrqWorkExit() {
- return X86_IRQ_VECTORS_IRQ_WORK_EXIT;
- }
-
- public String x86IrqVectorsCallFunctionEntry() {
- return X86_IRQ_VECTORS_CALL_FUNCTION_ENTRY;
- }
-
- public String x86IrqVectorsCallFunctionExit() {
- return X86_IRQ_VECTORS_CALL_FUNCTION_EXIT;
- }
-
- public String x86IrqVectorsCallFunctionSingleEntry() {
- return X86_IRQ_VECTORS_CALL_FUNCTION_SINGLE_ENTRY;
- }
-
- public String x86IrqVectorsCallFunctionSingleExit() {
- return X86_IRQ_VECTORS_CALL_FUNCTION_SINGLE_EXIT;
- }
-
- public String x86IrqVectorsThresholdApicEntry() {
- return X86_IRQ_VECTORS_THRESHOLD_APIC_ENTRY;
- }
-
- public String x86IrqVectorsThresholdApicExit() {
- return X86_IRQ_VECTORS_THRESHOLD_APIC_EXIT;
- }
-
- public String x86IrqVectorsDeferredErrorApicEntry() {
- return X86_IRQ_VECTORS_DEFERRED_ERROR_APIC_ENTRY;
- }
-
- public String x86IrqVectorsDeferredErrorApicExit() {
- return X86_IRQ_VECTORS_DEFERRED_ERROR_APIC_EXIT;
- }
-
- public String x86IrqVectorsThermalApicEntry() {
- return X86_IRQ_VECTORS_THERMAL_APIC_ENTRY;
- }
-
- public String x86IrqVectorsThermalApicExit() {
- return X86_IRQ_VECTORS_THERMAL_APIC_EXIT;
- }
-
- @Override
- public @NonNull Collection<@NonNull String> eventsKVMEntry() {
- return KVM_ENTRY_EVENTS;
- }
-
- @Override
- public @NonNull Collection<@NonNull String> eventsKVMExit() {
- return KVM_EXIT_EVENTS;
- }
-
- @Override
- public @NonNull Collection<@NonNull String> getIPIIrqVectorsEntries() {
- return IPI_ENTRY_SET;
- }
-
- @Override
- public @NonNull Collection<@NonNull String> getIPIIrqVectorsExits() {
- return IPI_EXIT_SET;
- }
-
- // ------------------------------------------------------------------------
- // New field definitions in LTTng 2.7
- // ------------------------------------------------------------------------
-
- public String fieldParentNSInum() {
- return "parent_ns_inum"; //$NON-NLS-1$
- }
-
- public String fieldChildNSInum() {
- return "child_ns_inum"; //$NON-NLS-1$
- }
-
- public String fieldChildVTids() {
- return "vtids"; //$NON-NLS-1$
- }
-
- public String fieldNSInum() {
- return "ns_inum"; //$NON-NLS-1$
- }
-
- public String fieldVTid() {
- return "vtid"; //$NON-NLS-1$
- }
-
- public String fieldPPid() {
- return "ppid"; //$NON-NLS-1$
- }
-
- public String fieldNSLevel() {
- return "ns_level"; //$NON-NLS-1$
- }
-
- @Override
- public Collection<String> eventsNetworkReceive() {
- return EVENTS_NETWORK_RECEIVE;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2015 Ericsson, École Polytechnique de Montréal
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- ******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.trace.layout.internal;
-
-/**
- * This file defines all the known event and field names for LTTng kernel
- * traces, for versions of lttng-modules 2.8 and above.
- *
- * @author Francis Giraldeau
- */
-public class Lttng28EventLayout extends Lttng27EventLayout {
-
- /**
- * Constructor
- */
- protected Lttng28EventLayout() {
- }
-
- private static final Lttng28EventLayout INSTANCE = new Lttng28EventLayout();
-
- public static Lttng28EventLayout getInstance() {
- return INSTANCE;
- }
-
- // ------------------------------------------------------------------------
- // New definitions in LTTng 2.8
- // ------------------------------------------------------------------------
-
- @Override
- public String eventSchedProcessWaking() {
- return "sched_waking"; //$NON-NLS-1$
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2016 École Polytechnique de Montréal
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.trace.layout.internal;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.tmf.core.event.CtfTmfEventField;
-
-/**
- * This file defines all the known event and field names for LTTng kernel
- * traces, for versions of lttng-modules 2.9 and above.
- *
- * @author Geneviève Bastien
- */
-public class Lttng29EventLayout extends Lttng28EventLayout {
-
- private static final String[] TCP_SEQ_FIELD = { "network_header", CtfTmfEventField.FIELD_VARIANT_SELECTED, "transport_header", "tcp", "seq" }; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- private static final String[] TCP_ACK_FIELD = { "network_header", CtfTmfEventField.FIELD_VARIANT_SELECTED, "transport_header", "tcp", "ack_seq" }; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- private static final String[] TCP_FLAGS_FIELD = { "network_header", CtfTmfEventField.FIELD_VARIANT_SELECTED, "transport_header", "tcp", "flags" }; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- /**
- * Constructor
- */
- protected Lttng29EventLayout() {
- }
-
- private static final Lttng29EventLayout INSTANCE = new Lttng29EventLayout();
-
- public static Lttng29EventLayout getInstance() {
- return INSTANCE;
- }
-
- @Override
- public String @NonNull [] fieldPathTcpSeq() {
- return TCP_SEQ_FIELD;
- }
-
- @Override
- public String @NonNull [] fieldPathTcpAckSeq() {
- return TCP_ACK_FIELD;
- }
-
- @Override
- public String @NonNull [] fieldPathTcpFlags() {
- return TCP_FLAGS_FIELD;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexandre Montplaisir - Initial API and implementation
- ******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.trace.layout.internal;
-
-import java.util.Collection;
-import java.util.Collections;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * This file defines all the known event and field names for LTTng kernel
- * traces, for versions of lttng-modules up to 2.5.
- *
- * These should not be externalized, since they need to match exactly what the
- * tracer outputs. If you want to localize them in a view, you should do a
- * mapping in the view itself.
- *
- * @author Alexandre Montplaisir
- */
-@SuppressWarnings("nls")
-public class LttngEventLayout implements ILttngKernelEventLayout {
-
- /* Event names */
- private static final String IRQ_HANDLER_ENTRY = "irq_handler_entry";
- private static final String IRQ_HANDLER_EXIT = "irq_handler_exit";
- private static final String SOFTIRQ_ENTRY = "softirq_entry";
- private static final String SOFTIRQ_EXIT = "softirq_exit";
- private static final String SOFTIRQ_RAISE = "softirq_raise";
- private static final String HRTIMER_START = "hrtimer_start";
- private static final String HRTIMER_CANCEL = "hrtimer_cancel";
- private static final String HRTIMER_EXPIRE_ENTRY = "hrtimer_expire_entry";
- private static final String HRTIMER_EXPIRE_EXIT = "hrtimer_expire_exit";
- private static final String SCHED_SWITCH = "sched_switch";
- private static final String SCHED_PI_SETPRIO = "sched_pi_setprio";
-
- private static final String SCHED_TTWU = "sched_ttwu";
- private static final String SCHED_WAKEUP = "sched_wakeup";
- private static final String SCHED_WAKEUP_NEW = "sched_wakeup_new";
- private static final Collection<String> SCHED_WAKEUP_EVENTS =
- ImmutableList.of(SCHED_WAKEUP, SCHED_WAKEUP_NEW);
-
- private static final String SCHED_PROCESS_FORK = "sched_process_fork";
- private static final String SCHED_PROCESS_EXIT = "sched_process_exit";
- private static final String SCHED_PROCESS_FREE = "sched_process_free";
- private static final String SCHED_PROCESS_EXEC = "sched_process_exec";
- private static final String STATEDUMP_PROCESS_STATE = "lttng_statedump_process_state";
-
- private static final String SYSCALL_ENTRY_PREFIX = "sys_";
- private static final String COMPAT_SYSCALL_ENTRY_PREFIX = "compat_sys_";
- private static final String SYSCALL_EXIT_PREFIX = "exit_syscall";
-
- private static final String BLOCK_RQ_INSERT= "block_rq_insert";
- private static final String BLOCK_RQ_ISSUE= "block_rq_issue";
- private static final String ELV_MERGE_REQUESTS= "addons_elv_merge_requests";
- private static final String BLOCK_RQ_COMPLETE= "block_rq_complete";
- private static final String LTTNG_STATEDUMP_BLOCK_DEVICE= "lttng_statedump_block_device";
- private static final String BLOCK_BIO_FRONTMERGE = "block_bio_frontmerge";
- private static final String BLOCK_BIO_BACKMERGE = "block_bio_backmerge";
-
- /* Field names */
- private static final String IRQ = "irq";
- private static final String TID = "tid";
- private static final String VEC = "vec";
- private static final String PREV_TID = "prev_tid";
- private static final String PREV_STATE = "prev_state";
- private static final String NEXT_COMM = "next_comm";
- private static final String NEXT_TID = "next_tid";
- private static final String PARENT_TID = "parent_tid";
- private static final String CHILD_COMM = "child_comm";
- private static final String CHILD_TID = "child_tid";
- private static final String PRIO = "prio";
- private static final String PREV_PRIO = "prev_prio";
- private static final String NEXT_PRIO = "next_prio";
- private static final String NEW_PRIO = "newprio";
- private static final String COMM = "comm";
- private static final String NAME = "name";
- private static final String STATUS = "status";
- private static final String PREV_COMM = "prev_comm";
- private static final String FILENAME = "filename";
- private static final String HRTIMER = "hrtimer";
- private static final String HRTIMER_FUNCTION = "function";
- private static final String HRTIMER_EXPIRES = "expires";
- private static final String HRTIMER_NOW = "now";
- private static final String HRTIMER_SOFT_EXPIRES = "softexpires";
- private static final String KMEM_ALLOC = "mm_page_alloc";
- private static final String KMEM_FREE = "mm_page_free";
- private static final String SYSCALL_RET = "ret";
- private static final String RWBS="rwbs";
- private static final String DISKNAME="diskname";
- private static final String BLOCK_DEV="dev";
- private static final String SECTOR="sector";
- private static final String NR_SECTOR="nr_sector";
- private static final String RQ_SECTOR= "rq_sector";
- private static final String NEXTRQ_SECTOR= "nextrq_sector";
- private static final String ORDER = "order";
-
- /* Network events and field names */
- private static final Collection<String> EVENTS_NETWORK_SEND = Collections.singleton("net_dev_queue");
- private static final Collection<String> EVENTS_NETWORK_RECEIVE = Collections.singleton("netif_receive_skb");
- private static final String[] TCP_SEQ_FIELD = { "transport_fields", "thtype_tcp", "seq" };
- private static final String[] TCP_ACK_FIELD = { "transport_fields", "thtype_tcp", "ack_seq" };
- private static final String[] TCP_FLAGS_FIELD = { "transport_fields", "thtype_tcp", "flags" };
-
- /* KVM events */
- private static final Collection<String> KVM_ENTRY_EVENTS = Collections.singleton("kvm_entry");
- private static final Collection<String> KVM_EXIT_EVENTS = Collections.singleton("kvm_exit");
-
- /** All instances are the same. Only provide a static instance getter */
- protected LttngEventLayout() {
- }
-
- private static final ILttngKernelEventLayout INSTANCE = new LttngEventLayout();
-
- /**
- * Get an instance of this event layout
- *
- * This object is completely immutable, so no need to create additional
- * instances via the constructor.
- *
- * @return The instance
- */
- public static ILttngKernelEventLayout getInstance() {
- return INSTANCE;
- }
-
- // ------------------------------------------------------------------------
- // Event names
- // ------------------------------------------------------------------------
-
- @Override
- public String eventIrqHandlerEntry() {
- return IRQ_HANDLER_ENTRY;
- }
-
- @Override
- public String eventIrqHandlerExit() {
- return IRQ_HANDLER_EXIT;
- }
-
- @Override
- public String eventSoftIrqEntry() {
- return SOFTIRQ_ENTRY;
- }
-
- @Override
- public String eventSoftIrqExit() {
- return SOFTIRQ_EXIT;
- }
-
- @Override
- public String eventSoftIrqRaise() {
- return SOFTIRQ_RAISE;
- }
-
- @Override
- public String eventSchedSwitch() {
- return SCHED_SWITCH;
- }
-
- @Override
- public String eventSchedPiSetprio() {
- return SCHED_PI_SETPRIO;
- }
-
- @Override
- public Collection<String> eventsSchedWakeup() {
- return SCHED_WAKEUP_EVENTS;
- }
-
- @Override
- public String eventSchedProcessFork() {
- return SCHED_PROCESS_FORK;
- }
-
- @Override
- public String eventSchedProcessExit() {
- return SCHED_PROCESS_EXIT;
- }
-
- @Override
- public String eventSchedProcessFree() {
- return SCHED_PROCESS_FREE;
- }
-
- @Override
- public @NonNull String eventStatedumpProcessState() {
- return STATEDUMP_PROCESS_STATE;
- }
-
- @Override
- public String eventSyscallEntryPrefix() {
- return SYSCALL_ENTRY_PREFIX;
- }
-
- @Override
- public String eventCompatSyscallEntryPrefix() {
- return COMPAT_SYSCALL_ENTRY_PREFIX;
- }
-
- @Override
- public String eventSyscallExitPrefix() {
- return SYSCALL_EXIT_PREFIX;
- }
-
- @Override
- public String eventCompatSyscallExitPrefix() {
- /*
- * In LTTng < 2.6, the same generic event name is used for both standard
- * and compat syscalls.
- */
- return SYSCALL_EXIT_PREFIX;
- }
-
- @Override
- public String eventKmemPageAlloc() {
- return KMEM_ALLOC;
- }
-
- @Override
- public String eventKmemPageFree() {
- return KMEM_FREE;
- }
-
- // ------------------------------------------------------------------------
- // Event field names
- // ------------------------------------------------------------------------
-
- @Override
- public String fieldIrq() {
- return IRQ;
- }
-
- @Override
- public String fieldVec() {
- return VEC;
- }
-
- @Override
- public String fieldTid() {
- return TID;
- }
-
- @Override
- public String fieldPrevTid() {
- return PREV_TID;
- }
-
- @Override
- public String fieldPrevState() {
- return PREV_STATE;
- }
-
- @Override
- public String fieldNextComm() {
- return NEXT_COMM;
- }
-
- @Override
- public String fieldNextTid() {
- return NEXT_TID;
- }
-
- @Override
- public String fieldChildComm() {
- return CHILD_COMM;
- }
-
- @Override
- public String fieldParentTid() {
- return PARENT_TID;
- }
-
- @Override
- public String fieldChildTid() {
- return CHILD_TID;
- }
-
- @Override
- public String fieldPrio() {
- return PRIO;
- }
-
- @Override
- public String fieldNewPrio() {
- return NEW_PRIO;
- }
-
- @Override
- public String fieldPrevPrio() {
- return PREV_PRIO;
- }
-
- @Override
- public String fieldNextPrio() {
- return NEXT_PRIO;
- }
-
- @Override
- public String fieldComm() {
- return COMM;
- }
-
- @Override
- public String fieldName() {
- return NAME;
- }
-
- @Override
- public String fieldStatus() {
- return STATUS;
- }
-
- @Override
- public String fieldPrevComm() {
- return PREV_COMM;
- }
-
- @Override
- public String fieldFilename() {
- return FILENAME;
- }
-
- @Override
- public String eventSchedProcessExec() {
- return SCHED_PROCESS_EXEC;
- }
-
- @Override
- public String eventSchedProcessWakeup() {
- return SCHED_WAKEUP;
- }
-
- @Override
- public String eventSchedProcessWakeupNew() {
- return SCHED_WAKEUP_NEW;
- }
-
- @Override
- public String eventSchedMigrateTask() {
- return "sched_migrate_task"; //$NON-NLS-1$
- }
-
- @Override
- public String eventHRTimerStart() {
- return HRTIMER_START;
- }
-
- @Override
- public String eventHRTimerCancel() {
- return HRTIMER_CANCEL;
- }
-
- @Override
- public String eventHRTimerExpireEntry() {
- return HRTIMER_EXPIRE_ENTRY;
- }
-
- @Override
- public String eventHRTimerExpireExit() {
- return HRTIMER_EXPIRE_EXIT;
- }
-
- /**
- * Event indicating the source of the wakeup signal.
- *
- * @return The name of the event
- */
- public String eventSchedProcessTTWU() {
- return SCHED_TTWU;
- }
-
- @Override
- public String fieldHRtimer() {
- return HRTIMER;
- }
- @Override
- public String fieldHRtimerFunction() {
- return HRTIMER_FUNCTION;
- }
-
- @Override
- public String fieldHRtimerExpires() {
- return HRTIMER_EXPIRES;
- }
-
- @Override
- public String fieldHRtimerSoftexpires() {
- return HRTIMER_SOFT_EXPIRES;
- }
- @Override
- public String fieldHRtimerNow() {
- return HRTIMER_NOW;
- }
-
- @Override
- public String fieldSyscallRet() {
- return SYSCALL_RET;
- }
-
- // ------------------------------------------------------------------------
- // I/O events and fields
- // ------------------------------------------------------------------------
-
- @Override
- public String eventBlockRqInsert() {
- return BLOCK_RQ_INSERT;
- }
-
- @Override
- public String eventBlockRqIssue() {
- return BLOCK_RQ_ISSUE;
- }
-
- @Override
- public String eventBlockRqComplete() {
- return BLOCK_RQ_COMPLETE;
- }
-
- @Override
- public String eventBlockBioFrontmerge() {
- return BLOCK_BIO_FRONTMERGE;
- }
-
- @Override
- public String eventBlockBioBackmerge() {
- return BLOCK_BIO_BACKMERGE;
- }
-
- @Override
- public String eventBlockRqMerge() {
- return ELV_MERGE_REQUESTS;
- }
-
- @Override
- public @NonNull String eventStatedumpBlockDevice() {
- return LTTNG_STATEDUMP_BLOCK_DEVICE;
- }
-
- @Override
- public String fieldBlockDeviceId() {
- return BLOCK_DEV;
- }
-
- @Override
- public String fieldBlockSector() {
- return SECTOR;
- }
-
- @Override
- public String fieldBlockNrSector() {
- return NR_SECTOR;
- }
-
- @Override
- public String fieldBlockRwbs() {
- return RWBS;
- }
-
- @Override
- public String fieldBlockRqSector() {
- return RQ_SECTOR;
- }
-
- @Override
- public String fieldBlockNextRqSector() {
- return NEXTRQ_SECTOR;
- }
-
- @Override
- public String fieldDiskname() {
- return DISKNAME;
- }
-
- @Override
- public Collection<String> eventsNetworkSend() {
- return EVENTS_NETWORK_SEND;
- }
-
- @Override
- public Collection<String> eventsNetworkReceive() {
- return EVENTS_NETWORK_RECEIVE;
- }
-
- @Override
- public String @NonNull [] fieldPathTcpSeq() {
- return TCP_SEQ_FIELD;
- }
-
- @Override
- public String @NonNull [] fieldPathTcpAckSeq() {
- return TCP_ACK_FIELD;
- }
-
- @Override
- public String @NonNull [] fieldPathTcpFlags() {
- return TCP_FLAGS_FIELD;
- }
-
- @Override
- public @NonNull String fieldOrder() {
- return ORDER;
- }
-
- // ------------------------------------------------------------------------
- // VirtualMachine events : kvm entry/exit events
- // ------------------------------------------------------------------------
-
- @Override
- public @NonNull Collection<@NonNull String> eventsKVMEntry() {
- return KVM_ENTRY_EVENTS;
- }
-
- @Override
- public @NonNull Collection<@NonNull String> eventsKVMExit() {
- return KVM_EXIT_EVENTS;
- }
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2012, 2015 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Alexandre Montplaisir - Initial API and implementation
- ******************************************************************************/
-
-package org.lttng.scope.lttng.kernel.core.trace.layout.internal;
-
-import java.util.Collection;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.lttng.scope.lttng.kernel.core.trace.layout.ILttngKernelEventLayout;
-
-import com.google.common.collect.ImmutableList;
-
-/**
- * Event and field definitions for perf traces in CTF format.
- *
- * @author Alexandre Montplaisir
- */
-public final class PerfEventLayout implements ILttngKernelEventLayout {
-
- private PerfEventLayout() {
- }
-
- private static final PerfEventLayout INSTANCE = new PerfEventLayout();
-
- /**
- * Get the singleton instance of this event layout object.
- *
- * @return The instance
- */
- public static PerfEventLayout getInstance() {
- return INSTANCE;
- }
-
- // ------------------------------------------------------------------------
- // Event names
- // ------------------------------------------------------------------------
-
- @Override
- public String eventIrqHandlerEntry() {
- return "irq:irq_handler_entry"; //$NON-NLS-1$
- }
-
- @Override
- public String eventIrqHandlerExit() {
- return "irq:irq_handler_exit"; //$NON-NLS-1$
- }
-
- @Override
- public String eventSoftIrqEntry() {
- return "irq:softirq_entry"; //$NON-NLS-1$
- }
-
- @Override
- public String eventSoftIrqExit() {
- return "irq:softirq_exit"; //$NON-NLS-1$
- }
-
- @Override
- public String eventSoftIrqRaise() {
- return "irq:softirq_raise"; //$NON-NLS-1$
- }
-
- @Override
- public String eventSchedSwitch() {
- return "sched:sched_switch"; //$NON-NLS-1$
- }
-
- @Override
- public String eventSchedPiSetprio() {
- return "sched:sched_pi_setprio"; //$NON-NLS-1$
- }
-
- private static final Collection<String> WAKEUP_EVENTS = ImmutableList.of("sched:sched_wakeup", "sched:sched_wakeup_new"); //$NON-NLS-1$ //$NON-NLS-2$
-
- @Override
- public Collection<String> eventsSchedWakeup() {
- return WAKEUP_EVENTS;
- }
-
- @Override
- public String eventSchedProcessFork() {
- return "sched:sched_process_fork"; //$NON-NLS-1$
- }
-
- @Override
- public String eventSchedProcessExit() {
- return "sched:sched_process_exit"; //$NON-NLS-1$
- }
-
- @Override
- public String eventSchedProcessFree() {
- return "sched:sched_process_free"; //$NON-NLS-1$
- }
-
- @Override
- public @Nullable String eventStatedumpProcessState() {
- /* Not present in perf traces */
- return null;
- }
-
- @Override
- public String eventSyscallEntryPrefix() {
- return "raw_syscalls:sys_enter"; //$NON-NLS-1$
- }
-
- @Override
- public String eventCompatSyscallEntryPrefix() {
- return eventSyscallEntryPrefix();
- }
-
- @Override
- public String eventSyscallExitPrefix() {
- return "raw_syscalls:sys_exit"; //$NON-NLS-1$
- }
-
- @Override
- public String eventCompatSyscallExitPrefix() {
- return eventSyscallExitPrefix();
- }
-
- @Override
- public String eventSchedProcessExec() {
- return "sched:sched_process_exec"; //$NON-NLS-1$
- }
-
- @Override
- public String eventSchedProcessWakeup() {
- return "sched:sched_process_wakeup"; //$NON-NLS-1$
- }
-
- @Override
- public String eventSchedProcessWakeupNew() {
- return "sched:process_wakeup_new"; //$NON-NLS-1$
- }
-
- @Override
- public String eventSchedProcessWaking() {
- return "sched:sched_waking"; //$NON-NLS-1$
- }
-
- @Override
- public String eventSchedMigrateTask() {
- return "sched:sched_migrate_task"; //$NON-NLS-1$
- }
-
- @Override
- public String eventHRTimerStart() {
- return "timer:hrtimer_start"; //$NON-NLS-1$
- }
-
- @Override
- public String eventHRTimerCancel() {
- return "timer:hrtimer_cancel"; //$NON-NLS-1$
- }
-
- @Override
- public String eventHRTimerExpireEntry() {
- return "timer:hrtimer_expire_entry"; //$NON-NLS-1$
- }
-
- @Override
- public String eventHRTimerExpireExit() {
- return "timer:hrtimer_expire_exit"; //$NON-NLS-1$
- }
-
- @Override
- public String eventKmemPageAlloc() {
- return "kmem:page_alloc"; //$NON-NLS-1$
- }
-
- @Override
- public String eventKmemPageFree() {
- return "kmem:page_free"; //$NON-NLS-1$
- }
-
- // ------------------------------------------------------------------------
- // Field names
- // ------------------------------------------------------------------------
-
- @Override
- public String fieldIrq() {
- return "irq"; //$NON-NLS-1$
- }
-
- @Override
- public String fieldVec() {
- return "vec"; //$NON-NLS-1$
- }
-
- @Override
- public String fieldTid() {
- return "pid"; //$NON-NLS-1$
- }
-
- @Override
- public String fieldPrevTid() {
- return "prev_pid"; //$NON-NLS-1$
- }
-
- @Override
- public String fieldPrevState() {
- return "prev_state"; //$NON-NLS-1$
- }
-
- @Override
- public String fieldNextComm() {
- return "next_comm"; //$NON-NLS-1$
- }
-
- @Override
- public String fieldNextTid() {
- return "next_pid"; //$NON-NLS-1$
- }
-
- @Override
- public String fieldChildComm() {
- return "child_comm"; //$NON-NLS-1$
- }
-
- @Override
- public String fieldParentTid() {
- return "parent_pid"; //$NON-NLS-1$
- }
-
- @Override
- public String fieldChildTid() {
- return "child_pid"; //$NON-NLS-1$
- }
-
- @Override
- public String fieldPrio() {
- return "prio"; //$NON-NLS-1$
- }
-
- @Override
- public String fieldNewPrio() {
- return "newprio"; //$NON-NLS-1$
- }
-
- @Override
- public String fieldPrevPrio() {
- return "prev_prio"; //$NON-NLS-1$
- }
-
- @Override
- public String fieldNextPrio() {
- return "next_prio"; //$NON-NLS-1$
- }
-
- @Override
- public String fieldComm() {
- return "comm"; //$NON-NLS-1$
- }
-
- @Override
- public String fieldName() {
- return "name"; //$NON-NLS-1$
- }
-
- @Override
- public String fieldStatus() {
- return "status"; //$NON-NLS-1$
- }
-
- @Override
- public String fieldPrevComm() {
- return "prev_comm"; //$NON-NLS-1$
- }
-
- @Override
- public String fieldFilename() {
- return "filename"; //$NON-NLS-1$
- }
-
- @Override
- public String fieldHRtimer() {
- return "hrtimer"; //$NON-NLS-1$
- }
-
- @Override
- public String fieldHRtimerFunction() {
- return "function"; //$NON-NLS-1$
- }
-
- @Override
- public String fieldHRtimerExpires() {
- return "expires"; //$NON-NLS-1$
- }
-
- @Override
- public String fieldHRtimerSoftexpires() {
- return "softexpires"; //$NON-NLS-1$
- }
-
- @Override
- public String fieldHRtimerNow() {
- return "now"; //$NON-NLS-1$
- }
-
- @Override
- public @NonNull String fieldOrder() {
- return "order"; //$NON-NLS-1$
- }
-
- // ------------------------------------------------------------------------
- // I/O events and fields
- // ------------------------------------------------------------------------
-
- @Override
- public String eventBlockRqInsert() {
- return "block:block_rq_insert"; //$NON-NLS-1$
- }
-
- @Override
- public String eventBlockRqIssue() {
- return "block:block_rq_issue"; //$NON-NLS-1$
- }
-
- @Override
- public String eventBlockRqComplete() {
- return "block:block_rq_complete"; //$NON-NLS-1$
- }
-
- @Override
- public String eventBlockBioFrontmerge() {
- return "block:block_bio_frontmerge"; //$NON-NLS-1$
- }
-
- @Override
- public String eventBlockBioBackmerge() {
- return "block:block_bio_backmerge"; //$NON-NLS-1$
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2014 Ericsson
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Ericsson - Initial API and implementation
- *******************************************************************************/
-
-@org.eclipse.jdt.annotation.NonNullByDefault
-package org.lttng.scope.lttng.kernel.core.trace.layout.internal;
+++ /dev/null
-/*
- * Copyright (C) 2017 EfficiOS Inc., Alexandre Montplaisir <alexmonthy@efficios.com>
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- */
-
-@org.eclipse.jdt.annotation.NonNullByDefault
-package org.lttng.scope.lttng.kernel.core.trace.layout;
+++ /dev/null
-###############################################################################
-# Copyright (c) 2013, 2014 Ericsson
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Ericsson - Initial API and implementation
-###############################################################################
-
-LttngKernelTrace_DomainError=Domain mismatch, the environment should be 'kernel'.
-LttngKernelTrace_MalformedTrace=Buffer overflow exception, trace is malformed
-LttngKernelTrace_TraceReadError=Lttng trace read error
import java.util.function.Function;
import java.util.function.Supplier;
-import org.lttng.scope.lttng.kernel.core.analysis.os.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
import org.lttng.scope.lttng.kernel.core.views.timegraph.resources.elements.ResourcesIrqTreeElement;
import org.lttng.scope.lttng.kernel.core.views.timegraph.resources.elements.ResourcesIrqTreeElement.IrqType;
import org.lttng.scope.tmf2.views.core.timegraph.model.provider.states.ITimeGraphModelStateProvider;
import java.util.function.Function;
import java.util.stream.Collectors;
-import org.lttng.scope.lttng.kernel.core.analysis.os.Attributes;
+import org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
import org.lttng.scope.lttng.kernel.core.views.timegraph.resources.elements.ResourcesCpuTreeElement;
import org.lttng.scope.lttng.kernel.core.views.timegraph.resources.elements.ResourcesIrqTreeElement;
import org.lttng.scope.lttng.kernel.core.views.timegraph.resources.elements.ResourcesIrqTreeElement.IrqType;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.primitives.Ints;
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystem;
-
/**
* View model for a Resources view, showing CPUs as the first level, then
* per-cpu IRQs as the second level.
List<ResourcesIrqTreeElement> children = new LinkedList<>();
/* Add the "IRQ" children. */
- int irqsQuark = ss.getQuarkRelative(cpuQuark, Attributes.IRQS);
+ int irqsQuark = ss.optQuarkRelative(cpuQuark, Attributes.IRQS);
for (int irqQuark : ss.getSubAttributes(irqsQuark, false)) {
int irqNumber = Ints.tryParse(ss.getAttributeName(irqQuark));
children.add(new ResourcesIrqTreeElement(IrqType.IRQ, irqNumber, irqQuark));
}
/* Add the "SoftIRQ" children. */
- int softIrqsQuark = ss.getQuarkRelative(cpuQuark, Attributes.SOFT_IRQS);
+ int softIrqsQuark = ss.optQuarkRelative(cpuQuark, Attributes.SOFT_IRQS);
for (int softIrqQuark : ss.getSubAttributes(softIrqsQuark, false)) {
int irqNumber = Ints.tryParse(ss.getAttributeName(softIrqQuark));
children.add(new ResourcesIrqTreeElement(IrqType.SOFTIRQ, irqNumber, softIrqQuark));
import java.util.List;
import java.util.function.Function;
-import org.lttng.scope.lttng.kernel.core.analysis.os.Attributes;
+import org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
import org.lttng.scope.lttng.kernel.core.views.timegraph.resources.elements.ResourcesIrqTreeElement;
import org.lttng.scope.lttng.kernel.core.views.timegraph.resources.elements.ResourcesIrqTreeElement.IrqType;
import org.lttng.scope.tmf2.views.core.timegraph.model.render.tree.TimeGraphTreeElement;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.primitives.Ints;
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystem;
-
/**
* View model for a Resources view showing IRQs and SoftIRQs.
*
import java.util.function.Function;
import org.eclipse.jdt.annotation.Nullable;
-import org.lttng.scope.lttng.kernel.core.analysis.os.KernelAnalysisModule;
-import org.lttng.scope.lttng.kernel.core.analysis.os.StateValues;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.StateValues;
+import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
+import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
import org.lttng.scope.lttng.kernel.core.views.timegraph.KernelAnalysisStateDefinitions;
import org.lttng.scope.tmf2.views.core.config.ConfigOption;
import org.lttng.scope.tmf2.views.core.timegraph.model.provider.statesystem.StateSystemModelStateProvider;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
-import ca.polymtl.dorsal.libdelorean.exceptions.StateValueTypeException;
-import ca.polymtl.dorsal.libdelorean.statevalue.ITmfStateValue;
-
/**
* State provider of the Resources time graph.
*
import java.util.function.Predicate;
import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.ctf.tmf.core.event.CtfTmfEvent;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
import org.lttng.scope.tmf2.views.core.timegraph.model.provider.statesystem.StateSystemTimeGraphTreeElement;
import org.lttng.scope.tmf2.views.core.timegraph.model.render.tree.TimeGraphTreeElement;
package org.lttng.scope.lttng.kernel.core.views.timegraph.threads;
-import static org.lttng.scope.common.core.NonNullUtils.nullToEmptyString;
+import static org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString;
import org.lttng.scope.tmf2.views.core.timegraph.model.provider.ITimeGraphModelProvider.FilterMode;
import org.lttng.scope.tmf2.views.core.timegraph.model.provider.ITimeGraphModelProvider.SortingMode;
import java.util.concurrent.FutureTask;
import org.eclipse.jdt.annotation.Nullable;
-import org.lttng.scope.lttng.kernel.core.analysis.os.Attributes;
-import org.lttng.scope.lttng.kernel.core.analysis.os.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
+import org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
+import org.eclipse.tracecompass.statesystem.core.StateSystemUtils;
+import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
+import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
+import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
import org.lttng.scope.tmf2.views.core.TimeRange;
import org.lttng.scope.tmf2.views.core.timegraph.model.provider.statesystem.StateSystemModelArrowProvider;
import org.lttng.scope.tmf2.views.core.timegraph.model.render.FlatUIColors;
import com.google.common.collect.Iterables;
import com.google.common.primitives.Ints;
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystem;
-import ca.polymtl.dorsal.libdelorean.StateSystemUtils;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-import ca.polymtl.dorsal.libdelorean.exceptions.StateSystemDisposedException;
-import ca.polymtl.dorsal.libdelorean.interval.ITmfStateInterval;
-
public class ThreadsModelArrowProviderCpus extends StateSystemModelArrowProvider {
private static final TimeGraphArrowSeries ARROW_SERIES = new TimeGraphArrowSeries(
List<List<TimeGraphArrow>> allArrows = new LinkedList<>();
try {
for (int threadLineQuark : threadLineQuarks) {
- List<ITmfStateInterval> intervals = StateSystemUtils.queryHistoryRange(ss, threadLineQuark, timeRange.getStart(), timeRange.getEnd(), 1, task);
+ List<ITmfStateInterval> intervals = StateSystemUtils.queryHistoryRange(ss, threadLineQuark, timeRange.getStart(), timeRange.getEnd(), 1, null);
if (task != null && task.isCancelled()) {
return TimeGraphArrowRender.EMPTY_RENDER;
}
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import org.lttng.scope.lttng.kernel.core.analysis.os.Attributes;
-import org.lttng.scope.lttng.kernel.core.analysis.os.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
+import org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
+import org.eclipse.tracecompass.statesystem.core.StateSystemUtils;
+import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
+import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
import org.lttng.scope.tmf2.views.core.timegraph.model.provider.arrows.ITimeGraphModelArrowProvider;
import org.lttng.scope.tmf2.views.core.timegraph.model.provider.states.ITimeGraphModelStateProvider;
import org.lttng.scope.tmf2.views.core.timegraph.model.provider.statesystem.StateSystemModelProvider;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
-import ca.polymtl.dorsal.libdelorean.ITmfStateSystem;
-import ca.polymtl.dorsal.libdelorean.StateSystemUtils;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-import ca.polymtl.dorsal.libdelorean.interval.ITmfStateInterval;
-
public class ThreadsModelProvider extends StateSystemModelProvider {
private static final Supplier<ITimeGraphModelStateProvider> STATE_PROVIDER = () -> {
import java.util.function.Function;
import org.eclipse.jdt.annotation.Nullable;
-import org.lttng.scope.lttng.kernel.core.analysis.os.Attributes;
-import org.lttng.scope.lttng.kernel.core.analysis.os.KernelAnalysisModule;
-import org.lttng.scope.lttng.kernel.core.analysis.os.StateValues;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.StateValues;
+import org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.Attributes;
+import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
+import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
+import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
+import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
import org.lttng.scope.lttng.kernel.core.views.timegraph.KernelAnalysisStateDefinitions;
import org.lttng.scope.tmf2.views.core.config.ConfigOption;
import org.lttng.scope.tmf2.views.core.timegraph.model.provider.statesystem.StateSystemModelStateProvider;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import ca.polymtl.dorsal.libdelorean.exceptions.AttributeNotFoundException;
-import ca.polymtl.dorsal.libdelorean.exceptions.StateValueTypeException;
-import ca.polymtl.dorsal.libdelorean.statevalue.ITmfStateValue;
-
public class ThreadsModelStateProvider extends StateSystemModelStateProvider {
// ------------------------------------------------------------------------
private static final Function<StateIntervalContext, @Nullable String> LABEL_MAPPING_FUNCTION = ssCtx -> {
int statusQuark = ssCtx.baseTreeElement.getSourceQuark();
long startTime = ssCtx.sourceInterval.getStartTime();
- ITmfStateValue val = ssCtx.ss.querySingleState(startTime, statusQuark).getStateValue();
-
- /* If the status is "syscall", use the name of the syscall as label */
- if (!val.equals(StateValues.PROCESS_STATUS_RUN_SYSCALL_VALUE)) {
- return null;
- }
-
String syscallName;
try {
+ ITmfStateValue val = ssCtx.ss.querySingleState(startTime, statusQuark).getStateValue();
+
+ /* If the status is "syscall", use the name of the syscall as label */
+ if (!val.equals(StateValues.PROCESS_STATUS_RUN_SYSCALL_VALUE)) {
+ return null;
+ }
+
int syscallQuark = ssCtx.ss.getQuarkRelative(statusQuark, Attributes.SYSTEM_CALL);
syscallName = ssCtx.ss.querySingleState(startTime, syscallQuark).getStateValue().unboxStr();
- } catch (AttributeNotFoundException | StateValueTypeException e) {
+ } catch (AttributeNotFoundException | StateValueTypeException | StateSystemDisposedException e) {
return null;
}
/*
- * Strip the "syscall" prefix part if there is one, it's not useful in
- * the label.
+ * Strip the "syscall" prefix part if there is one, it's not useful in the
+ * label.
*/
for (String sysPrefix : SYSCALL_PREFIXES) {
if (syscallName.startsWith(sysPrefix)) {
int baseQuark = ssCtx.baseTreeElement.getSourceQuark();
long startTime = ssCtx.sourceInterval.getStartTime();
- String cpu;
- try {
- int cpuQuark = ssCtx.ss.getQuarkRelative(baseQuark, Attributes.CURRENT_CPU_RQ);
- ITmfStateValue sv = ssCtx.ss.querySingleState(startTime, cpuQuark).getStateValue();
- cpu = (sv.isNull() ? requireNonNull(Messages.propertyNotAvailable) : String.valueOf(sv.unboxInt()));
- } catch (AttributeNotFoundException e) {
- cpu = requireNonNull(Messages.propertyNotAvailable);
- }
+ // FIXME The Kernel analysis in TraceCompass does not include the CPUs' run
+ // queues.
+ String cpu = requireNonNull(Messages.propertyNotAvailable);
+// try {
+// int cpuQuark = ssCtx.ss.getQuarkRelative(baseQuark, Attributes.CURRENT_CPU_RQ);
+// ITmfStateValue sv = ssCtx.fullQueryAtIntervalStart.get(cpuQuark).getStateValue();
+// cpu = (sv.isNull() ? requireNonNull(Messages.propertyNotAvailable) : String.valueOf(sv.unboxInt()));
+// } catch (AttributeNotFoundException e) {
+// cpu = requireNonNull(Messages.propertyNotAvailable);
+// }
String syscall;
try {
int syscallNameQuark = ssCtx.ss.getQuarkRelative(baseQuark, Attributes.SYSTEM_CALL);
ITmfStateValue sv = ssCtx.ss.querySingleState(startTime, syscallNameQuark).getStateValue();
syscall = (sv.isNull() ? requireNonNull(Messages.propertyNotAvailable) : sv.unboxStr());
- } catch (AttributeNotFoundException e) {
+ } catch (AttributeNotFoundException | StateSystemDisposedException e) {
syscall = requireNonNull(Messages.propertyNotAvailable);
}
import java.util.function.Predicate;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.ctf.tmf.core.event.CtfTmfEvent;
+import org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelTidAspect;
+import org.eclipse.tracecompass.internal.analysis.os.linux.core.kernel.Attributes;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
-import org.lttng.scope.lttng.kernel.core.analysis.os.Attributes;
-import org.lttng.scope.lttng.kernel.core.event.aspect.KernelTidAspect;
+import org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent;
import org.lttng.scope.tmf2.views.core.timegraph.model.provider.statesystem.StateSystemTimeGraphTreeElement;
import org.lttng.scope.tmf2.views.core.timegraph.model.render.tree.TimeGraphTreeElement;