summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorFran├žois Rajotte2012-07-20 16:07:56 (EDT)
committer Alexandre Montplaisir2012-07-23 10:50:42 (EDT)
commit401669a5168ecbf49932b15629103b349c880de9 (patch)
treef8cbb18fc05a7aeb79a95815deb5c5582b953f38
parentac6b3ffacebdf64ddc43eb583a3367cbc464bd56 (diff)
downloadorg.eclipse.linuxtools-401669a5168ecbf49932b15629103b349c880de9.zip
org.eclipse.linuxtools-401669a5168ecbf49932b15629103b349c880de9.tar.gz
org.eclipse.linuxtools-401669a5168ecbf49932b15629103b349c880de9.tar.bz2
lttng: Add CPU field in control flow view tooltip
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>
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/Messages.java1
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/messages.properties1
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowPresentationProvider.java36
3 files changed, 34 insertions, 4 deletions
diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/Messages.java b/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/Messages.java
index 4782fcd..6fa7d78 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/Messages.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/Messages.java
@@ -19,6 +19,7 @@ public class Messages extends NLS {
public static String ControlFlowView_previousProcessActionToolTipText;
public static String ControlFlowView_attributeSyscallName;
+ public static String ControlFlowView_attributeCpuName;
public static String ResourcesView_stateTypeName;
public static String ResourcesView_nextResourceActionNameText;
diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/messages.properties b/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/messages.properties
index cd1eec5..27ff125 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/messages.properties
+++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/messages.properties
@@ -11,6 +11,7 @@ ControlFlowView_previousProcessActionNameText=Previous Process
ControlFlowView_previousProcessActionToolTipText=Select Previous Process
ControlFlowView_attributeSyscallName=System Call
+ControlFlowView_attributeCpuName=CPU
ResourcesView_stateTypeName=Resource
ResourcesView_nextResourceActionNameText=Next Resource
diff --git a/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowPresentationProvider.java b/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowPresentationProvider.java
index e0f790d..7e2e9e5 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowPresentationProvider.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.kernel.ui/src/org/eclipse/linuxtools/internal/lttng2/kernel/ui/views/controlflow/ControlFlowPresentationProvider.java
@@ -12,13 +12,15 @@
package org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.controlflow;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
import java.util.Map;
import org.eclipse.linuxtools.internal.lttng2.kernel.core.Attributes;
import org.eclipse.linuxtools.internal.lttng2.kernel.core.StateValues;
import org.eclipse.linuxtools.internal.lttng2.kernel.ui.Messages;
import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
+import org.eclipse.linuxtools.tmf.core.exceptions.StateValueTypeException;
import org.eclipse.linuxtools.tmf.core.exceptions.TimeRangeException;
import org.eclipse.linuxtools.tmf.core.interval.ITmfStateInterval;
import org.eclipse.linuxtools.tmf.core.statesystem.IStateSystemQuerier;
@@ -98,12 +100,38 @@ public class ControlFlowPresentationProvider extends TimeGraphPresentationProvid
@Override
public Map<String, String> getEventHoverToolTipInfo(ITimeEvent event) {
- Map<String, String> retMap = new HashMap<String, String>();
+ Map<String, String> retMap = new LinkedHashMap<String, String>();
if (event instanceof ControlFlowEvent) {
+ ControlFlowEntry entry = (ControlFlowEntry) event.getEntry();
+ IStateSystemQuerier ssq = entry.getTrace().getStateSystem();
+ int tid = entry.getThreadId();
+
+ try {
+ //Find every CPU first, then get the current thread
+ int cpusQuark = ssq.getQuarkAbsolute(Attributes.CPUS);
+ List<Integer> cpuQuarks = ssq.getSubAttributes(cpusQuark, false);
+ for (Integer cpuQuark : cpuQuarks) {
+ int currentThreadQuark = ssq.getQuarkRelative(cpuQuark, Attributes.CURRENT_THREAD);
+ ITmfStateInterval interval = ssq.querySingleState(event.getTime(), currentThreadQuark);
+ if (!interval.getStateValue().isNull()) {
+ ITmfStateValue state = interval.getStateValue();
+ int currentThreadId = state.unboxInt();
+ if (tid == currentThreadId) {
+ retMap.put(Messages.ControlFlowView_attributeCpuName, ssq.getAttributeName(cpuQuark));
+ break;
+ }
+ }
+ }
+
+ } catch (AttributeNotFoundException e) {
+ e.printStackTrace();
+ } catch (TimeRangeException e) {
+ e.printStackTrace();
+ } catch (StateValueTypeException e) {
+ e.printStackTrace();
+ }
int status = ((ControlFlowEvent) event).getStatus();
if (status == StateValues.PROCESS_STATUS_RUN_SYSCALL) {
- ControlFlowEntry entry = (ControlFlowEntry) event.getEntry();
- IStateSystemQuerier ssq = entry.getTrace().getStateSystem();
try {
int syscallQuark = ssq.getQuarkRelative(entry.getThreadQuark(), Attributes.SYSTEM_CALL);
ITmfStateInterval value = ssq.querySingleState(event.getTime(), syscallQuark);