On Mon, Aug 22, 2022 at 03:33:26PM -0700, Jiang, Dave wrote: > > On 8/22/2022 3:27 PM, Steven Rostedt wrote: > > On Mon, 22 Aug 2022 15:21:01 -0700 > > Dave Jiang <dave.jiang@xxxxxxxxx> wrote: > > > > > On 8/22/2022 3:18 PM, Steven Rostedt wrote: > > > > On Mon, 22 Aug 2022 14:48:30 -0700 > > > > Dave Jiang <dave.jiang@xxxxxxxxx> wrote: > > > > > Attempting to use libtraceevent to retrieve fields from events. For example here's the event I'm trying to parse: > > > > > > > > > > check-events.sh-5983 [002] ..... 261848.250238: cxl_dram_event: cxl_mem.7: Fatal time=0 id=b3cb1 > > > > > d60-069c-ab4e-b8af-4e9bfb5c9624 handle=1 related_handle=0 hdr_flags='Performance Degraded': phys_add > > > > > r=8000 volatile=FALSE desc='Threshold event' type='Invalid Address' trans_type='Internal Media Scrub > > > > > ' channel=1 rank=0 nibble_mask=0 bank_group=5 bank=2 row=0 column=1024 cor_mask=00 00 00 00 00 00 00 > > > > > 00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 valid_flags='CHANNEL|BANK > > > > > GROUP|BANK|COLUMN' > > > > > > > > > > Here's me iterating through all the fields and using tep_get_field_raw() trying to retrieve the fields. It appears that > > > > > if the field is a string type I'm not able to retrieve the field and the error written back in the seq file is > > > > > "CANT FIND FIELD". Am I doing something wrong or using the wrong API to retrieve those type of fields? > > > > What's the format for this event? That is, what is the output of : > > > > > > > > trace-cmd list -e cxl_dram_event -F > > > > > > > > ? > > > #trace-cmd list -e cxl_dram_event -F > > > system: cxl_events > > > name: cxl_dram_event > > > ID: 2325 > > > 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:__data_loc char[] dev_name; offset:8; size:4; signed:1; > > > field:int log; offset:12; size:4; signed:1; > > > field:u8 id[16]; offset:16; size:16; signed:0; > > > field:u32 flags; offset:32; size:4; signed:0; > > > field:u16 handle; offset:36; size:2; signed:0; > > > field:u16 related_handle; offset:38; size:2; signed:0; > > > field:u64 timestamp; offset:40; size:8; signed:0; > > > field:u64 phys_addr; offset:48; size:8; signed:0; > > > field:u8 descriptor; offset:56; size:1; signed:0; > > > field:u8 type; offset:57; size:1; signed:0; > > > field:u8 transaction_type; offset:58; size:1; signed:0; > > > field:u8 channel; offset:59; size:1; signed:0; > > > field:u16 validity_flags; offset:60; size:2; signed:0; > > > field:u16 column; offset:62; size:2; signed:0; > > > field:u32 nibble_mask; offset:64; size:4; signed:0; > > > field:u32 row; offset:68; size:4; signed:0; > > > field:u8 cor_mask[0x20]; offset:72; size:32; signed:0; > > > field:u8 rank; offset:104; size:1; signed:0; > > > field:u8 bank_group; offset:105; size:1; signed:0; > > > field:u8 bank; offset:106; size:1; signed:0; > > The above are the fields you need. If you want to see how they are > > formatted in the output, you can add "--full" to the above command and > > you'll see a "printf" like format. > > > > > > Your output you showed in the previous email had: > > > > > failed to get field: time > > > <CANT FIND FIELD time> > > There's no field "time" above. > > > > > got field: id, len: 16 > > > got field: handle, len: 2 > > > got field: related_handle, len: 2 > > > failed to get field: hdr_flags > > > <CANT FIND FIELD hdr_flags> > > Same for "hdr_flags" > > > > > got field: phys_addr, len: 8 > > > failed to get field: volatile > > > <CANT FIND FIELD volatile> > > And "volatile" > > > > > failed to get field: desc > > > <CANT FIND FIELD desc> > > etc. > > > > > got field: type, len: 1 > > > failed to get field: trans_type > > > <CANT FIND FIELD trans_type> > > etc. > > > > > > > got field: channel, len: 1 > > > got field: rank, len: 1 > > > got field: nibble_mask, len: 4 > > > got field: bank_group, len: 1 > > > got field: bank, len: 1 > > > got field: row, len: 4 > > > got field: column, len: 2 > > > got field: cor_mask, len: 32 > > > failed to get field: valid_flags > > > <CANT FIND FIELD valid_flags> > > etc. > > > > > > The field names are from the above format, not what you see in the output > > of the event. > > Ok that makes sense. Thanks for the help! Not sure how I missed this thread. But sounds like for consistency the printk format should match these field names. I'll add that to the list of cleanup. Ira