trace-cmd: Using the python wrapping to read trace markers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi !

We are using this article to generate trace markers:
https://lwn.net/Articles/366796/

I am responsible for reading the trace.dat binary into our tools and we are using the trace-cmd python wrapping.

I'm trying to use the python wrapping in order to read trace markers, so far unsuccessfully (See below). I've noticed that the trace marker string is written directly into the event, without using pointers, indices etc, and that the size field in this case equals zero (in bold, below). So I'm guessing that the way to read it is a bit different (using the method for reading regular string field does not seem to work). Here's how the event description looks like inside trace.dat:

name: print
ID: 5
format:
        field:unsigned short common_type;       offset:0;       size:2; signed:0;
        field:unsigned char common_flags;       offset:2;       size:1; signed:0;
        field:unsigned char common_preempt_count;       offset:3;       size:1; signed:0;
        field:int common_pid;   offset:4;       size:4; signed:1;
        field:unsigned char common_migrate_disable;     offset:8;       size:1; signed:0;
        field:unsigned char common_preempt_lazy_count;  offset:9;       size:1; signed:0;
        field:unsigned long ip; offset:16;      size:8; signed:0;
        field:char buf[];       offset:24;      size:0; signed:1;
print fmt: "%ps: %s", (void *)REC->ip, REC->buf

And here are some of the methods I've tried to access the "buf" field above:
field_name = "buf"
// method 1:
f = tep_find_any_field(self._event, field_name)
if f is None:
    return None
str = py_field_get_str(f, self._record) // (returns empty string)

// method 2:
f = tep_find_any_field(self._event, name)
if f is None:
    return None
data = py_field_get_data(f, self._record) // (returns empty buffer)

Thanks in advance,
Sharon Gabay




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux