lkml.org 
[lkml]   [2010]   [Sep]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: kernelshark plugins and ftrace array fields
From
Date
On Thu, 2010-09-02 at 14:16 -0400, Steven Rostedt wrote:
> On Thu, 2010-09-02 at 17:34 +0300, Avi Kivity wrote:

>
> OK, with no modification of what I have already, I just created this
> handler:
>
> static int
> kvm_emulate_insn_handler(struct trace_seq *s, struct record *record,
> struct event_format *event, void *context)
> {
> struct format_field *field;
> unsigned char *data = record->data;
> int i;
>
> field = pevent_find_field(event, "insn");
> if (!field) {
> trace_seq_puts(s, "Can't find inst field");
> return 0;
> }
>
> trace_seq_puts(s, "insn: ");
> for (i = 0; i < field->size; i++) {
> trace_seq_printf(s, "%s%02x",
> i ? "," : "",
> data[field->offset + i]);
> }
>
> return 0;
> }
>
>
> I think this is what you would want, right?

I think I will add a:

void *pevent_get_field_raw(stuct trace_seq *s,
struct event_format *event,
char *field_name,
struct record *record,
int **field_len);

which will return a pointer into record->data and set the field_len to
the actual size.

This will be useful for dynamic arrays too, since it is more complex
than just using a field->offset.

-- Steve




\
 
 \ /
  Last update: 2010-09-02 20:41    [W:0.081 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site