mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 11:46:19 +00:00
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>
This commit is contained in:
parent
9b8055a52c
commit
561f732c12
2 changed files with 15 additions and 2 deletions
|
@ -1548,6 +1548,7 @@ process_str(struct event *event __unused, struct print_arg *arg, char **tok)
|
||||||
|
|
||||||
arg->type = PRINT_STRING;
|
arg->type = PRINT_STRING;
|
||||||
arg->string.string = token;
|
arg->string.string = token;
|
||||||
|
arg->string.offset = -1;
|
||||||
|
|
||||||
if (read_expected(EVENT_DELIM, (char *)")") < 0)
|
if (read_expected(EVENT_DELIM, (char *)")") < 0)
|
||||||
return EVENT_ERROR;
|
return EVENT_ERROR;
|
||||||
|
@ -2031,9 +2032,20 @@ static void print_str_arg(void *data, int size,
|
||||||
|
|
||||||
case PRINT_TYPE:
|
case PRINT_TYPE:
|
||||||
break;
|
break;
|
||||||
case PRINT_STRING:
|
case PRINT_STRING: {
|
||||||
printf("%s", arg->string.string);
|
int str_offset;
|
||||||
|
|
||||||
|
if (arg->string.offset == -1) {
|
||||||
|
struct format_field *f;
|
||||||
|
|
||||||
|
f = find_any_field(event, arg->string.string);
|
||||||
|
arg->string.offset = f->offset;
|
||||||
|
}
|
||||||
|
str_offset = *(int *)(data + arg->string.offset);
|
||||||
|
str_offset &= 0xffff;
|
||||||
|
printf("%s", ((char *)data) + str_offset);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case PRINT_OP:
|
case PRINT_OP:
|
||||||
/*
|
/*
|
||||||
* The only op for string should be ? :
|
* The only op for string should be ? :
|
||||||
|
|
|
@ -50,6 +50,7 @@ struct print_arg_atom {
|
||||||
|
|
||||||
struct print_arg_string {
|
struct print_arg_string {
|
||||||
char *string;
|
char *string;
|
||||||
|
int offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct print_arg_field {
|
struct print_arg_field {
|
||||||
|
|
Loading…
Reference in a new issue