Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Champagne2018-04-13 16:41:39 -0400
committerMatthew Khouzam2018-07-19 15:53:57 -0400
commitd2b94fadf319c2c7ce2de60e22a4042f4b24d118 (patch)
tree052d8e6e67fb04f0934c6f9c13f2ebfa36557452
parent34a392a8d2f8acb589a8ee1f1eb9ccdfddddf669 (diff)
downloadorg.eclipse.tracecompass.incubator-dev.tar.gz
org.eclipse.tracecompass.incubator-dev.tar.xz
org.eclipse.tracecompass.incubator-dev.zip
ftrace: Adjust parsing for trace-cmd formatdev
There are minor diffrences in the format between using trace-cmd report -R and copying the ftrace text buffer (/sys/kernel/debug/tracing/trace) The prev_state is a number instead of a letter and a field parent_tid exists. Change-Id: Id521224bb7ca2d2b1c6a42064aedde7e93f9df99 Signed-off-by: Guillaume Champagne <guillaume.champagne@polymtl.ca> Signed-off-by: Alexis-Maurer Fortin <alexis-maurer.fortin@polymtl.ca> Signed-off-by: Hugo Genesse <hugo.genesse@polymtl.ca> Signed-off-by: Pierre-Yves Lajoie<pierre-yves.lajoie@polymtl.ca> Signed-off-by: Eva Terriault <eva.terriault@polymtl.ca> Reviewed-on: https://git.eclipse.org/r/121168 Reviewed-by: Genevieve Bastien <gbastien+lttng@versatic.net> Tested-by: Genevieve Bastien <gbastien+lttng@versatic.net> Tested-by: CI Bot Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
-rw-r--r--tracetypes/org.eclipse.tracecompass.incubator.ftrace.core/src/org/eclipse/tracecompass/incubator/internal/ftrace/core/event/GenericFtraceField.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/tracetypes/org.eclipse.tracecompass.incubator.ftrace.core/src/org/eclipse/tracecompass/incubator/internal/ftrace/core/event/GenericFtraceField.java b/tracetypes/org.eclipse.tracecompass.incubator.ftrace.core/src/org/eclipse/tracecompass/incubator/internal/ftrace/core/event/GenericFtraceField.java
index c6d3b0c7..0dc4c7a3 100644
--- a/tracetypes/org.eclipse.tracecompass.incubator.ftrace.core/src/org/eclipse/tracecompass/incubator/internal/ftrace/core/event/GenericFtraceField.java
+++ b/tracetypes/org.eclipse.tracecompass.incubator.ftrace.core/src/org/eclipse/tracecompass/incubator/internal/ftrace/core/event/GenericFtraceField.java
@@ -133,8 +133,11 @@ public class GenericFtraceField {
if (value != null) {
// This is a temporary solution. Refactor suggestions are welcome.
if (key.equals("prev_state")) { //$NON-NLS-1$
- fields.put(key, PREV_STATE_LUT.getOrDefault(value.charAt(0), 0L));
+ fields.put(key, parsePrevStateValue(value));
} else if (StringUtils.isNumeric(value)) {
+ if (key.equals("parent_pid") && name.equals("sched_process_fork")) {//$NON-NLS-1$ //$NON-NLS-2$
+ key = "pid"; //$NON-NLS-1$
+ }
fields.put(key, Long.parseUnsignedLong(value));
} else {
fields.put(key, decodeString(value));
@@ -251,4 +254,20 @@ public class GenericFtraceField {
public Integer getCpu() {
return fCpu;
}
+
+ /**
+ * Parse the prev_state field on sched_switch event depending on wether it is a number or a character.
+ *
+ *
+ * @return the state as a Long
+ */
+ private static Long parsePrevStateValue(String value) {
+ Long state = 0L;
+ if (StringUtils.isNumeric(value)) {
+ state = Long.parseUnsignedLong(value);
+ } else {
+ state = PREV_STATE_LUT.getOrDefault(value.charAt(0), 0L);
+ }
+ return state;
+ }
}

Back to the top