Re: [PATCH v8 2/2] tools lib traceevent: Add support for __print_array()

From: Steven Rostedt
Date: Fri Mar 06 2015 - 14:19:39 EST


On Fri, 6 Mar 2015 18:35:18 +0000
Javi Merino <javi.merino@xxxxxxx> wrote:

> Since 6ea22486ba46 ("tracing: Add array printing helper") trace can
> traces with variable element size arrays. Add support to parse them.
>
> Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
> Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>

Both patches look fine to me. You can add my:

Acked-by: Steven Rostedt <rostedt@xxxxxxxxxxx>


> Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx>
> Signed-off-by: Javi Merino <javi.merino@xxxxxxx>
> ---
> tools/lib/traceevent/event-parse.c | 93 ++++++++++++++++++++++++++++++++++++++
> tools/lib/traceevent/event-parse.h | 8 ++++
> 2 files changed, 101 insertions(+)
>


> + if (arg->int_array.field->type == PRINT_DYNAMIC_ARRAY) {
> + unsigned long offset;
> + struct format_field *field =
> + arg->int_array.field->dynarray.field;
> + offset = pevent_read_number(pevent,
> + data + field->offset,
> + field->size);
> + num = data + (offset & 0xffff);

Unrelated to this patch set, but we really should make that 0xffff a
named define. Something like this perhaps?

#define DYNAMIC_OFFSET_MASK 0xffff
#define DYNAMIC_LENGTH_SHIFT 16

and even add:

#define dynamic_offset(num) ((num) & DYNAMIC_OFFSET_MASK)
#define dynamic_length(num) ((num) >> DYNAMIC_LENGTH_SHIFT)

and use these macros instead.

Again, this has nothing to do with the acceptance of this patch set.
Just something that this patch set reminds me that we should do.

-- Steve

> + } else {
> + field = arg->int_array.field->field.field;
> + if (!field) {
> + str = arg->int_array.field->field.name;
> + field = pevent_find_any_field(event, str);
> + if (!field)
> + goto out_warning_field;
> + arg->int_array.field->field.field = field;
> + }
> + num = data + field->offset;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/