lttng: Add CPU field in control flow view tooltip
authorFrançois Rajotte <francois.rajotte@polymtl.ca>
Fri, 20 Jul 2012 20:07:56 +0000 (16:07 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Mon, 23 Jul 2012 14:50:42 +0000 (10:50 -0400)
References bug #385656

Change-Id: I101d05b4d4150e2b071e9f9005d5a475d106f8af
Signed-off-by: François Rajotte <francois.rajotte@polymtl.ca>
Reviewed-on: https://git.eclipse.org/r/6903
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
IP-Clean: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Tested-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/Messages.java
org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/messages.properties
org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowPresentationProvider.java

index 4782fcd9a1ecae071de13e4edaab4ed9eeb0c533..6fa7d7867d4a446d0d7a60829507229135bd5555 100644 (file)
@@ -19,6 +19,7 @@ public class Messages extends NLS {
     public static String ControlFlowView_previousProcessActionToolTipText;\r
 \r
     public static String ControlFlowView_attributeSyscallName;\r
+    public static String ControlFlowView_attributeCpuName;\r
 \r
     public static String ResourcesView_stateTypeName;\r
     public static String ResourcesView_nextResourceActionNameText;\r
index cd1eec55a0c5833e0c6f2ec379103012c3136c12..27ff12516c7c1a426d45e3524f84736c776b2acd 100644 (file)
@@ -11,6 +11,7 @@ ControlFlowView_previousProcessActionNameText=Previous Process
 ControlFlowView_previousProcessActionToolTipText=Select Previous Process\r
 \r
 ControlFlowView_attributeSyscallName=System Call\r
+ControlFlowView_attributeCpuName=CPU\r
 \r
 ResourcesView_stateTypeName=Resource\r
 ResourcesView_nextResourceActionNameText=Next Resource\r
index e0f790de41c8fcbcf97c02c58d5e582655d98f77..7e2e9e5551c7d891c8048a4f6abd14d3c6317069 100644 (file)
 \r
 package org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.controlflow;\r
 \r
-import java.util.HashMap;\r
+import java.util.LinkedHashMap;\r
+import java.util.List;\r
 import java.util.Map;\r
 \r
 import org.eclipse.linuxtools.internal.lttng2.kernel.core.Attributes;\r
 import org.eclipse.linuxtools.internal.lttng2.kernel.core.StateValues;\r
 import org.eclipse.linuxtools.internal.lttng2.kernel.ui.Messages;\r
 import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;\r
+import org.eclipse.linuxtools.tmf.core.exceptions.StateValueTypeException;\r
 import org.eclipse.linuxtools.tmf.core.exceptions.TimeRangeException;\r
 import org.eclipse.linuxtools.tmf.core.interval.ITmfStateInterval;\r
 import org.eclipse.linuxtools.tmf.core.statesystem.IStateSystemQuerier;\r
@@ -98,12 +100,38 @@ public class ControlFlowPresentationProvider extends TimeGraphPresentationProvid
 \r
     @Override\r
     public Map<String, String> getEventHoverToolTipInfo(ITimeEvent event) {\r
-        Map<String, String> retMap = new HashMap<String, String>();\r
+        Map<String, String> retMap = new LinkedHashMap<String, String>();\r
         if (event instanceof ControlFlowEvent) {\r
+            ControlFlowEntry entry = (ControlFlowEntry) event.getEntry();\r
+            IStateSystemQuerier ssq = entry.getTrace().getStateSystem();\r
+            int tid = entry.getThreadId();\r
+\r
+            try {\r
+                //Find every CPU first, then get the current thread\r
+                int cpusQuark = ssq.getQuarkAbsolute(Attributes.CPUS);\r
+                List<Integer> cpuQuarks = ssq.getSubAttributes(cpusQuark, false);\r
+                for (Integer cpuQuark : cpuQuarks) {\r
+                    int currentThreadQuark = ssq.getQuarkRelative(cpuQuark, Attributes.CURRENT_THREAD);\r
+                    ITmfStateInterval interval = ssq.querySingleState(event.getTime(), currentThreadQuark);\r
+                    if (!interval.getStateValue().isNull()) {\r
+                        ITmfStateValue state = interval.getStateValue();\r
+                        int currentThreadId = state.unboxInt();\r
+                        if (tid == currentThreadId) {\r
+                            retMap.put(Messages.ControlFlowView_attributeCpuName, ssq.getAttributeName(cpuQuark));\r
+                            break;\r
+                        }\r
+                    }\r
+                }\r
+\r
+            } catch (AttributeNotFoundException e) {\r
+                e.printStackTrace();\r
+            } catch (TimeRangeException e) {\r
+                e.printStackTrace();\r
+            } catch (StateValueTypeException e) {\r
+                e.printStackTrace();\r
+            }\r
             int status = ((ControlFlowEvent) event).getStatus();\r
             if (status == StateValues.PROCESS_STATUS_RUN_SYSCALL) {\r
-                ControlFlowEntry entry = (ControlFlowEntry) event.getEntry();\r
-                IStateSystemQuerier ssq = entry.getTrace().getStateSystem();\r
                 try {\r
                     int syscallQuark = ssq.getQuarkRelative(entry.getThreadQuark(), Attributes.SYSTEM_CALL);\r
                     ITmfStateInterval value = ssq.querySingleState(event.getTime(), syscallQuark);\r
This page took 0.03091 seconds and 5 git commands to generate.