From 8c99c27df10f6c5a120e41ffb0948e357f5a2d20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Fri, 24 Jul 2020 15:54:31 +0300 Subject: lib/trace: Remove TRACE support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Looks like the option is generally not compatible with garbage collections. Nothing gets inlined, for example is_smp_boot() no longer evaluates to constant false and thus the symbols from secondary.S would need to be present for the build to pass even if we set SMP=n. Also the addresses of relocatable ramstage are currently not normalised on the logs, so util/genprof would be unable dress those. Change-Id: I0b6f310e15e6f4992cd054d288903fea8390e5cf Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/45757 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons Reviewed-by: Nico Huber --- util/genprof/.gitignore | 1 - util/genprof/Makefile | 12 ----- util/genprof/README | 31 ------------ util/genprof/description.md | 1 - util/genprof/genprof.c | 114 -------------------------------------------- util/genprof/log2dress | 20 -------- 6 files changed, 179 deletions(-) delete mode 100644 util/genprof/.gitignore delete mode 100644 util/genprof/Makefile delete mode 100644 util/genprof/README delete mode 100644 util/genprof/description.md delete mode 100644 util/genprof/genprof.c delete mode 100755 util/genprof/log2dress (limited to 'util') diff --git a/util/genprof/.gitignore b/util/genprof/.gitignore deleted file mode 100644 index 612ef67372..0000000000 --- a/util/genprof/.gitignore +++ /dev/null @@ -1 +0,0 @@ -genprof diff --git a/util/genprof/Makefile b/util/genprof/Makefile deleted file mode 100644 index 2ec77c918a..0000000000 --- a/util/genprof/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -CC=gcc -CFLAGS=-O2 -Wall - -all: genprof - -genprof: genprof.o - $(CC) $(CFLAGS) -o genprof $^ - -clean: - rm -f genprof *.o *~ - -distclean: clean diff --git a/util/genprof/README b/util/genprof/README deleted file mode 100644 index d4159c2fd6..0000000000 --- a/util/genprof/README +++ /dev/null @@ -1,31 +0,0 @@ -Function tracing ----------------- - -Enable CONFIG_TRACE in debug menu. Run the compiled image on target. You will get -a log with a lot of lines like: - -... -~0x001072e8(0x00100099) -~0x00108bc0(0x0010730a) -... - -First address is address of function which was just entered, the second address -is address of functions which call that. - -You can use the log2dress to dress the log again: - -... -src/arch/x86/lib/c_start.S:85 calls /home/ruik/coreboot/src/boot/selfboot.c:367 -/home/ruik/coreboot/src/boot/selfboot.c:370 calls /home/ruik/coreboot/src/device/device.c:325 -... - -Alternatively, you can use genprof to generate a gmon.out file, which can be used -by gprof to show the call traces. You will need to install uthash library to compile -that. - -Great use is: - -make -./genprof /tmp/yourlog ; gprof ../../build/ramstage | ./gprof2dot.py -e0 -n0 | dot -Tpng -o output.png - -Which generates a PNG with a call graph. diff --git a/util/genprof/description.md b/util/genprof/description.md deleted file mode 100644 index 84618a4187..0000000000 --- a/util/genprof/description.md +++ /dev/null @@ -1 +0,0 @@ -Format function tracing logs `Bash` `C` diff --git a/util/genprof/genprof.c b/util/genprof/genprof.c deleted file mode 100644 index f4dd4cb7c1..0000000000 --- a/util/genprof/genprof.c +++ /dev/null @@ -1,114 +0,0 @@ -#include -#include -#include -#include - -#define GMON_SEC "seconds s" -uint32_t mineip = 0xffffffff; -uint32_t maxeip = 0; - -/* a hash structure to hold the arc */ -struct arec { - uint32_t eip; - uint32_t from; - uint32_t count; - UT_hash_handle hh; -}; - -struct arec *arc = NULL; - -void note_arc(uint32_t eip, uint32_t from) -{ - struct arec *s; - - HASH_FIND_INT(arc, &eip, s); - if (s == NULL) { - s = malloc(sizeof(struct arec)); - s->eip = eip; - s->from = from; - s->count = 1; - if (eip > maxeip) - maxeip = eip; - if (eip < mineip) - maxeip = eip; - - HASH_ADD_INT(arc, eip, s); - } else { - s->count++; - } -} - -int main(int argc, char* argv[]) -{ - FILE *f, *fo; - struct arec *s; - uint32_t eip, from, tmp; - uint8_t tag; - uint16_t hit; - - if (argc != 2) { - fprintf(stderr, "Please specify the coreboot trace log as parameter\n"); - return 1; - } - - f = fopen(argv[1], "r"); - if (f == NULL) { - perror("Unable to open the input file"); - return 1; - } - - fo = fopen("gmon.out", "w+"); - if (fo == NULL) { - perror("Unable to open the output file"); - fclose(f); - return 1; - } - - while (!feof(f)) { - if (fscanf(f, "~%x(%x)%*[^\n]\n", &eip, &from) == 2) { - note_arc(eip, from); - } else if (fscanf(f, "%*c~%x(%x)%*[^\n]\n", &eip, &from) == 2) { - note_arc(eip, from); - } else { - /* just drop a line */ - tmp = fscanf(f, "%*[^\n]\n"); - } - } - - /* write gprof header */ - fwrite(GMON_MAGIC, 1, sizeof(GMON_MAGIC) - 1, fo); - tmp = GMON_VERSION; - fwrite(&tmp, 1, sizeof(tmp), fo); - tmp = 0; - fwrite(&tmp, 1, sizeof(tmp), fo); - fwrite(&tmp, 1, sizeof(tmp), fo); - fwrite(&tmp, 1, sizeof(tmp), fo); - /* write fake histogram */ - tag = GMON_TAG_TIME_HIST; - fwrite(&tag, 1, sizeof(tag), fo); - fwrite(&mineip, 1, sizeof(mineip), fo); - fwrite(&maxeip, 1, sizeof(maxeip), fo); - /* size of histogram */ - tmp = 1; - fwrite(&tmp, 1, sizeof(tmp), fo); - /* prof rate */ - tmp = 1000; - fwrite(&tmp, 1, sizeof(tmp), fo); - fwrite(GMON_SEC, 1, sizeof(GMON_SEC) - 1, fo); - hit = 1; - fwrite(&hit, 1, sizeof(hit), fo); - - /* write call graph data */ - tag = GMON_TAG_CG_ARC; - for (s = arc; s != NULL; s = s->hh.next) { - fwrite(&tag, 1, sizeof(tag), fo); - fwrite(&s->from, 1, sizeof(s->from), fo); - fwrite(&s->eip, 1, sizeof(s->eip), fo); - fwrite(&s->count, 1, sizeof(s->count), fo); - } - - fclose(fo); - fclose(f); - - return 0; -} diff --git a/util/genprof/log2dress b/util/genprof/log2dress deleted file mode 100755 index a7ec4bfdbd..0000000000 --- a/util/genprof/log2dress +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env 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/cbfs/fallback/ramstage.debug "$FROM" | tr -d "\n" -echo -n " calls " -addr2line -e ../../build/cbfs/fallback/ramstage.debug "$TO" -else -echo "$line" -fi - -done -- cgit v1.2.3