aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-08-31 00:45:21 -0400
committerIngo Molnar <mingo@elte.hu>2009-08-31 04:04:49 -0400
commit561f732c1233f6bf7c3c5c5fb9b4d90bb6c107aa (patch)
tree3b1fa89421add9bf578b44d02e8503f90f286404 /tools/perf
parent9b8055a52c8986167e0a7357460d528a00db67e6 (diff)
perf tools: Complete support for dynamic strings
Complete support for __str_loc type strings of ftrace events which have dynamic offsets values set for each of them inside their sammples. Before: geany-5759 [000] 0.000000: lock_release: name geany-5759 [000] 0.000000: lock_release: name geany-5759 [000] 0.000000: lock_release: name kondemand/0-362 [000] 0.000000: lock_release: name pdflush-421 [000] 0.000000: lock_release: name After: geany-5759 [000] 0.000000: lock_release: &u->lock geany-5759 [000] 0.000000: lock_release: key geany-5759 [000] 0.000000: lock_release: &group->notification_mutex kondemand/0-362 [000] 0.000000: lock_release: &rq->lock pdflush-421 [000] 0.000000: lock_release: &rq->lock Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Steven Rostedt <rostedt@goodmis.org> LKML-Reference: <1251693921-6579-4-git-send-email-fweisbec@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/util/trace-event-parse.c16
-rw-r--r--tools/perf/util/trace-event.h1
2 files changed, 15 insertions, 2 deletions
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index 96c5e97ffe7b..665dac20cd1e 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -1548,6 +1548,7 @@ process_str(struct event *event __unused, struct print_arg *arg, char **tok)
1548 1548
1549 arg->type = PRINT_STRING; 1549 arg->type = PRINT_STRING;
1550 arg->string.string = token; 1550 arg->string.string = token;
1551 arg->string.offset = -1;
1551 1552
1552 if (read_expected(EVENT_DELIM, (char *)")") < 0) 1553 if (read_expected(EVENT_DELIM, (char *)")") < 0)
1553 return EVENT_ERROR; 1554 return EVENT_ERROR;
@@ -2031,9 +2032,20 @@ static void print_str_arg(void *data, int size,
2031 2032
2032 case PRINT_TYPE: 2033 case PRINT_TYPE:
2033 break; 2034 break;
2034 case PRINT_STRING: 2035 case PRINT_STRING: {
2035 printf("%s", arg->string.string); 2036 int str_offset;
2037
2038 if (arg->string.offset == -1) {
2039 struct format_field *f;
2040
2041 f = find_any_field(event, arg->string.string);
2042 arg->string.offset = f->offset;
2043 }
2044 str_offset = *(int *)(data + arg->string.offset);
2045 str_offset &= 0xffff;
2046 printf("%s", ((char *)data) + str_offset);
2036 break; 2047 break;
2048 }
2037 case PRINT_OP: 2049 case PRINT_OP:
2038 /* 2050 /*
2039 * The only op for string should be ? : 2051 * The only op for string should be ? :
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h
index 051fcf363825..420294a5773e 100644
--- a/tools/perf/util/trace-event.h
+++ b/tools/perf/util/trace-event.h
@@ -50,6 +50,7 @@ struct print_arg_atom {
50 50
51struct print_arg_string { 51struct print_arg_string {
52 char *string; 52 char *string;
53 int offset;
53}; 54};
54 55
55struct print_arg_field { 56struct print_arg_field {