Skip to contentSkip to conversation

rcutorture: Copy out ftrace into its own console file

PATCH Superseded Joel Fernandes (Google) 2 participants 4 messages Aug 13, 2023

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rcutorture: Copy out ftrace into its own console file

From: Joel <[email protected]>

Often times it is difficult to jump to the ftrace buffers and treat it independently during debugging. Copy the contents of the buffers into its own file.

---
 .../selftests/rcutorture/bin/functions.sh     | 24 +++++++++++++++++++
 .../selftests/rcutorture/bin/parse-console.sh |  7 ++++++
 2 files changed, 31 insertions(+)
 mode change 100644 => 100755 tools/testing/selftests/rcutorture/bin/functions.sh
tools/testing/selftests/rcutorture/bin/functions.sh +24 -0
old mode 100644
new mode 100755
index b8e2ea23cb3f..2ec4ab87a7f0
@@ -331,3 +331,27 @@ specify_qemu_net () {
 		echo $1 -net none
 	fi
 }
+
+# Extract the ftrace output from the console log output
+# The ftrace output looks in the logs looks like:
+# Dumping ftrace buffer:
+# ---------------------------------
+# [...]
+# ---------------------------------
+extract_ftrace_from_console() {
+        awk '
+        /Dumping ftrace buffer:/ {
+        capture = 1
+        next
+    }
+    /---------------------------------/ {
+        if(capture == 1) {
+            capture = 2
+            next
+        } else if(capture == 2) {
+            capture = 0
+        }
+    }
+    capture == 2
+    ' "$1";
+}
tools/testing/selftests/rcutorture/bin/parse-console.sh +7 -0
index 9ab0f6bc172c..e3d2f69ec0fb 100755
@@ -182,3 +182,10 @@ if ! test -s $file.diags
 then
 	rm -f $file.diags
 fi
+
+# Call extract_ftrace_from_console function, if the output is empty,
+# don't create $file.ftrace. Otherwise output the results to $file.ftrace
+extract_ftrace_from_console $file > $file.ftrace
+if [ ! -s $file.ftrace ]; then
+	rm -f $file.ftrace
+fi
Signature · 1 line
2.41.0.640.ga95def55d0-goog
#1 lore raw
Quoted 2 lines · Joel Fernandes (Google)

From: Joel <[email protected]>

Sheesh, 'From' got messed up with my other email address. I can resend unless Paul is OK with the patch and can fixup my From (appreciate the help!).

- Joel

Quoted 64 lines

Often times it is difficult to jump to the ftrace buffers and treat it independently during debugging. Copy the contents of the buffers into its own file.

---
 .../selftests/rcutorture/bin/functions.sh     | 24 +++++++++++++++++++
 .../selftests/rcutorture/bin/parse-console.sh |  7 ++++++
 2 files changed, 31 insertions(+)
 mode change 100644 => 100755 tools/testing/selftests/rcutorture/bin/functions.sh
tools/testing/selftests/rcutorture/bin/functions.sh +24 -0
old mode 100644
new mode 100755
index b8e2ea23cb3f..2ec4ab87a7f0
@@ -331,3 +331,27 @@ specify_qemu_net () {
                echo $1 -net none
        fi
 }
+
+# Extract the ftrace output from the console log output
+# The ftrace output looks in the logs looks like:
+# Dumping ftrace buffer:
+# ---------------------------------
+# [...]
+# ---------------------------------
+extract_ftrace_from_console() {
+        awk '
+        /Dumping ftrace buffer:/ {
+        capture = 1
+        next
+    }
+    /---------------------------------/ {
+        if(capture == 1) {
+            capture = 2
+            next
+        } else if(capture == 2) {
+            capture = 0
+        }
+    }
+    capture == 2
+    ' "$1";
+}
tools/testing/selftests/rcutorture/bin/parse-console.sh +7 -1
index 9ab0f6bc172c..e3d2f69ec0fb 100755
@@ -182,3 +182,10 @@ if ! test -s $file.diags
 then
        rm -f $file.diags
 fi
+
+# Call extract_ftrace_from_console function, if the output is empty,
+# don't create $file.ftrace. Otherwise output the results to $file.ftrace
+extract_ftrace_from_console $file > $file.ftrace
+if [ ! -s $file.ftrace ]; then
+       rm -f $file.ftrace
+fi
--

2.41.0.640.ga95def55d0-goog

#3 lore raw
Quoted 11 lines · Greg KH
Quoted 7 lines · Joel Fernandes (Google)

From: Joel <[email protected]>

Often times it is difficult to jump to the ftrace buffers and treat it independently during debugging. Copy the contents of the buffers into its own file.

"From:" doesn't match the signed-off-by :(

Yeah I suck. Apparently I still don't know how to send a patch after 13 years.