summaryrefslogtreecommitdiff
path: root/tools/perf/tests/code-reading.c
diff options
context:
space:
mode:
authorFabian Hemmer <copy@copy.sh>2021-02-04 00:15:37 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2021-02-17 21:15:06 +0300
commitcef7af25c9d3a7ea5d0c82424dc8bf93a95b6fc3 (patch)
treec55d0626aaa0f3dfdf360a476599b64b73453032 /tools/perf/tests/code-reading.c
parent48859e5293a261437deb0231d78a388e242ed2d3 (diff)
downloadlinux-cef7af25c9d3a7ea5d0c82424dc8bf93a95b6fc3.tar.xz
perf tools: Add OCaml demangling
Detect symbols generated by the OCaml compiler based on their prefix. Demangle OCaml symbols, returning a newly allocated string (like the existing Java demangling functionality). Move a helper function (hex) from tests/code-reading.c to util/string.c To test: echo 'Printf.printf "%d\n" (Random.int 42)' > test.ml perf record ocamlopt.opt test.ml perf report -d ocamlopt.opt Signed-off-by: Fabian Hemmer <copy@copy.sh> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> LPU-Reference: 20210203211537.b25ytjb6dq5jfbwx@nyu Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests/code-reading.c')
-rw-r--r--tools/perf/tests/code-reading.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 7c098d49c77e..280f0348a09c 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -26,6 +26,7 @@
#include "event.h"
#include "record.h"
#include "util/mmap.h"
+#include "util/string2.h"
#include "util/synthetic-events.h"
#include "thread.h"
@@ -41,15 +42,6 @@ struct state {
size_t done_cnt;
};
-static unsigned int hex(char c)
-{
- if (c >= '0' && c <= '9')
- return c - '0';
- if (c >= 'a' && c <= 'f')
- return c - 'a' + 10;
- return c - 'A' + 10;
-}
-
static size_t read_objdump_chunk(const char **line, unsigned char **buf,
size_t *buf_len)
{