Analysis: Bug 453362 - Display Soft IRQ names in Resources View
authorMatthew Khouzam <matthew.khouzam@ericsson.com>
Mon, 19 Oct 2015 03:15:56 +0000 (23:15 -0400)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Wed, 21 Oct 2015 01:05:39 +0000 (21:05 -0400)
Softirqs have pre-defined names in the Linux kernel, this patch displays
a description based on them in a the Resources View.

Change-Id: I0f8d301967f34d327e7a8e487619d10c3152b3ba
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/58411
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-by: Hudson CI
analysis/org.eclipse.tracecompass.analysis.os.linux.ui/META-INF/MANIFEST.MF
analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/analysis/os/linux/ui/views/resources/ResourcesEntry.java
analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/resources/Messages.java [new file with mode: 0644]
analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/resources/SoftIrqLabelProvider.java [new file with mode: 0644]
analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/resources/messages.properties [new file with mode: 0644]

index 9a471769d45e658825a0f10cbea65839adfa29f6..de2cdd7a68ec01be9142d9e4dfef325b2563e0fb 100644 (file)
@@ -24,4 +24,5 @@ Export-Package: org.eclipse.tracecompass.analysis.os.linux.ui.views.controlflow,
  org.eclipse.tracecompass.analysis.os.linux.ui.views.cpuusage,
  org.eclipse.tracecompass.analysis.os.linux.ui.views.resources,
  org.eclipse.tracecompass.internal.analysis.os.linux.ui;x-internal:=true,
- org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.latency;x-internal:=true
+ org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.latency;x-internal:=true,
+ org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.resources;x-internal:=true
index 92d606778f133525b7ab471aab75f68375315ce6..5a6be09c2cf6e8cb008048b60b73d0e1a68e21e2 100644 (file)
@@ -14,6 +14,7 @@
 package org.eclipse.tracecompass.analysis.os.linux.ui.views.resources;
 
 import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.resources.SoftIrqLabelProvider;
 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
 import org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry;
@@ -106,7 +107,14 @@ public class ResourcesEntry extends TimeGraphEntry implements Comparable<ITimeGr
      */
     public ResourcesEntry(int quark, @NonNull ITmfTrace trace,
             long startTime, long endTime, Type type, int id) {
-        this(quark, trace, type.toString() + " " + id, startTime, endTime, type, id); //$NON-NLS-1$
+        this(quark, trace, computeEntryName(type, id), startTime, endTime, type, id);
+    }
+
+    private static String computeEntryName(Type type, int id) {
+        if (Type.SOFT_IRQ.equals(type)) {
+            return type.toString() + ' ' + id + ' ' + SoftIrqLabelProvider.getSoftIrq(id);
+        }
+        return type.toString() + ' ' + id;
     }
 
     /**
@@ -156,7 +164,9 @@ public class ResourcesEntry extends TimeGraphEntry implements Comparable<ITimeGr
     @Override
     public int compareTo(ITimeGraphEntry other) {
         if (!(other instanceof ResourcesEntry)) {
-            /* Should not happen, but if it does, put those entries at the end */
+            /*
+             * Should not happen, but if it does, put those entries at the end
+             */
             return -1;
         }
         ResourcesEntry o = (ResourcesEntry) other;
diff --git a/analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/resources/Messages.java b/analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/resources/Messages.java
new file mode 100644 (file)
index 0000000..67519c4
--- /dev/null
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * 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.eclipse.tracecompass.internal.analysis.os.linux.ui.views.resources;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Softirq names. Not the C style ones, but descriptive ones
+ *
+ * @author Matthew Khouzam
+ */
+public class Messages extends NLS {
+    private static final String BUNDLE_NAME = "org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.resources.messages"; //$NON-NLS-1$
+    /** softirq 0 */
+    public static String SoftIrqLabelProvider_softIrq0;
+    /** softirq 1 */
+    public static String SoftIrqLabelProvider_softIrq1;
+    /** softirq 2 */
+    public static String SoftIrqLabelProvider_softIrq2;
+    /** softirq 3 */
+    public static String SoftIrqLabelProvider_softIrq3;
+    /** softirq 4 */
+    public static String SoftIrqLabelProvider_softIrq4;
+    /** softirq 5 */
+    public static String SoftIrqLabelProvider_softIrq5;
+    /** softirq 6 */
+    public static String SoftIrqLabelProvider_softIrq6;
+    /** softirq 7 */
+    public static String SoftIrqLabelProvider_softIrq7;
+    /** softirq 8 */
+    public static String SoftIrqLabelProvider_softIrq8;
+    /** softirq 9 */
+    public static String SoftIrqLabelProvider_softIrq9;
+    /** other softirq */
+    public static String SoftIrqLabelProvider_Unknown;
+
+    static {
+        // initialize resource bundle
+        NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+    }
+
+    private Messages() {
+    }
+}
diff --git a/analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/resources/SoftIrqLabelProvider.java b/analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/resources/SoftIrqLabelProvider.java
new file mode 100644 (file)
index 0000000..2fd4782
--- /dev/null
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * 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.eclipse.tracecompass.internal.analysis.os.linux.ui.views.resources;
+
+import static org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString;
+
+import org.eclipse.jdt.annotation.NonNull;
+
+/**
+ * SoftIRQ definitions are hard-coded to the following
+ *
+ * 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>
+ *
+ * @author Matthew Khouzam
+ */
+public final class SoftIrqLabelProvider {
+
+    private SoftIrqLabelProvider() {
+        // do nothing
+    }
+
+    /**
+     * Gets a human readable name for a softirq
+     *
+     * @param irqNumber
+     *            the number of the softirq
+     * @return a human readable string, cannot be null, may be empty
+     */
+    public static @NonNull String getSoftIrq(int irqNumber) {
+        switch (irqNumber) {
+        case 0:
+            return nullToEmptyString(Messages.SoftIrqLabelProvider_softIrq0);
+        case 1:
+            return nullToEmptyString(Messages.SoftIrqLabelProvider_softIrq1);
+        case 2:
+            return nullToEmptyString(Messages.SoftIrqLabelProvider_softIrq2);
+        case 3:
+            return nullToEmptyString(Messages.SoftIrqLabelProvider_softIrq3);
+        case 4:
+            return nullToEmptyString(Messages.SoftIrqLabelProvider_softIrq4);
+        case 5:
+            return nullToEmptyString(Messages.SoftIrqLabelProvider_softIrq5);
+        case 6:
+            return nullToEmptyString(Messages.SoftIrqLabelProvider_softIrq6);
+        case 7:
+            return nullToEmptyString(Messages.SoftIrqLabelProvider_softIrq7);
+        case 8:
+            return nullToEmptyString(Messages.SoftIrqLabelProvider_softIrq8);
+        case 9:
+            return nullToEmptyString(Messages.SoftIrqLabelProvider_softIrq9);
+        default:
+            return nullToEmptyString(Messages.SoftIrqLabelProvider_Unknown);
+        }
+    }
+}
diff --git a/analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/resources/messages.properties b/analysis/org.eclipse.tracecompass.analysis.os.linux.ui/src/org/eclipse/tracecompass/internal/analysis/os/linux/ui/views/resources/messages.properties
new file mode 100644 (file)
index 0000000..40f0a78
--- /dev/null
@@ -0,0 +1,23 @@
+###############################################################################
+# 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
+###############################################################################
+
+SoftIrqLabelProvider_softIrq0=High priority tasklet
+SoftIrqLabelProvider_softIrq1=Timer
+SoftIrqLabelProvider_softIrq2=Network TX
+SoftIrqLabelProvider_softIrq3=Network RX
+SoftIrqLabelProvider_softIrq4=Block device
+SoftIrqLabelProvider_softIrq5=Block device IO Poll
+SoftIrqLabelProvider_softIrq6=Tasklet
+SoftIrqLabelProvider_softIrq7=Scheduler
+SoftIrqLabelProvider_softIrq8=High res timer
+SoftIrqLabelProvider_softIrq9=RCU data
+SoftIrqLabelProvider_Unknown=unknown
This page took 0.029951 seconds and 5 git commands to generate.