Re: [diamon-discuss] [BUG] perf-convert-to-ctf fails to dealing with syscalls tracepoints.

Jiri Olsa <[email protected]> Mon, 19 Jan 2015 13:59:34 +0100
Newsgroups dev.linux.lists.diamon-discuss
Message-ID <[email protected]>
On Mon, Jan 19, 2015 at 08:12:04PM +0800, Wang Nan wrote:
> Hi Jiri,
> 
> I found a problem when trying to convert syscalls:* records into ctf:
> 
> root@arma15el:~# perf record -a -e syscalls:* sleep 5
> 
> [ perf record: Woken up 0 times to write data ]
> [ perf record: Captured and wrote 4.571 MB perf.data (~199696 samples) ]
> Warning:
> Processed 64994 events and lost 1 chunks!
> 
> Check IO/CPU overload!
> 
> root@arma15el:~# perf data convert --to-ctf ./out.ctf
> Failed to add field 'nr
> Failed to add event 'syscalls:sys_enter_io_submit'.
> root@arma15el:~#
> 
> Do you have time to have a look at it?
> 

yea, looks like libbabeltrace do not allow field of same name
in the structure:

---
static
int add_structure_field(GPtrArray *fields,
                GHashTable *field_name_to_index,
                struct bt_ctf_field_type *field_type,
                const char *field_name)
{
        int ret = 0;
        GQuark name_quark = g_quark_from_string(field_name);
        struct structure_field *field;

        /* Make sure structure does not contain a field of the same name */
        if (g_hash_table_lookup_extended(field_name_to_index,
---

and syscalls:sys_enter_io_submit trcaepoint actually has 'nr' field duplicates:

---
[root@krava events]# cat /sys/kernel/debug/tracing/events/syscalls/sys_enter_io_submit/format 
name: sys_enter_io_submit
ID: 720
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:int nr;   offset:8;       size:4; signed:1;
        field:aio_context_t ctx_id;     offset:16;      size:8; signed:0;
        field:long nr;  offset:24;      size:8; signed:0;
        field:struct iocb * * iocbpp;   offset:32;      size:8; signed:0;

print fmt: "ctx_id: 0x%08lx, nr: 0x%08lx, iocbpp: 0x%08lx", ((unsigned long)(REC->ctx_id)), ((unsigned long)(REC->nr)), ((unsigned long)(REC->iocbpp))
---

which is PITA ;-)

seems like reasonable request to keep names unique in the structure,
so I think we'll change it on our end (perf data convert) and maybe
add some suffix to duplicates like nr_dupl_X.. (where X = 1,2..)

thoughts?

> Moreover, is there (diamon-discuss) right place to discuss things related
> your perf-convert-to-ctf patches?

lkml is fine (maybe also add linux-perf-users list),
but please add also Sebaastian so he's not missing any fun ;-)

and Jérémie for babeltrace side.. I CC-ed both of them now

thanks,
jirka