summaryrefslogtreecommitdiff
path: root/util/genprof/log2dress
diff options
context:
space:
mode:
authorRudolf Marek <r.marek@assembler.cz>2011-09-02 23:34:15 +0200
committerStefan Reinauer <stefan.reinauer@coreboot.org>2011-09-07 01:27:57 +0200
commit8679e52b9632254c247db31020d09e877071366e (patch)
treee86c734a8b11aa60f0f72612b848640ddd51c204 /util/genprof/log2dress
parent7f0e93060e720149bb59023d608a67cfc21542b1 (diff)
Add support utils for tracing
Following patch adds a userspace util genprof which is able to convert the console printed traces to gmon.out file used by gprof & friends. The log2dress will replace the adresses in logfile with a line numbers. Change-Id: I9f716f3ff2522a24fbc844a1dd5e32ef49b540c5 Signed-off-by: Rudolf Marek <r.marek@assembler.cz> Reviewed-on: http://review.coreboot.org/179 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'util/genprof/log2dress')
-rwxr-xr-xutil/genprof/log2dress20
1 files changed, 20 insertions, 0 deletions
diff --git a/util/genprof/log2dress b/util/genprof/log2dress
new file mode 100755
index 0000000000..429f8461d1
--- /dev/null
+++ b/util/genprof/log2dress
@@ -0,0 +1,20 @@
+#!/bin/bash
+#Parse a log and get back the function names and line numbers
+#Provide a log file as first argument
+
+#Please rewrite to something more saner !
+
+cat $1 | while read line ; do
+A=`echo $line | cut -c 1`
+
+if [ "$A" = '~' ] ; then
+FROM=`echo $line | tr \~ \( | tr \) \( | awk -F\( '{print $3}'`
+TO=`echo $line | tr \~ \( | tr \) \(|awk -F\( '{print $2}'`
+addr2line -e ../../build/coreboot_ram.debug "$FROM" | tr -d "\n"
+echo -n " calls "
+addr2line -e ../../build/coreboot_ram.debug "$TO"
+else
+echo "$line"
+fi
+
+done