[PATCH] Write event stream in file

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Jun 21 12:26:31 UTC 2019


On 21/06/2019 13:20, Ravindra Kumar Meena wrote:
> Hi,
> 
> I was able to store the event stream in file. I have sent the patch for 
> the same. It has only one warning that I have to discuss with you.
> 
> ../misc/record/record-main.c:172:14: warning: ‘ns’ may be used 
> uninitialized in this function [-Wmaybe-uninitialized]
>     ctf_item.ns=ns;
>                ^
> ../misc/record/record-main.c:147:12: note: ‘ns’ was declared here
>     uint32_t ns;

This is not a warning. It is an error. The ns variable is not set in the 
else path.

It should look like this:

static void print_item( FILE *f, const client_item *item )
{
   ctf_event ctf_item;

   ctf_item.ns = item->ns;
   ctf_item.cpu = item->cpu;
   ctf_item.event = item->event;
   ctf_item.data = item->data;

   fwrite( &ctf_item, sizeof( ctf_item ), 1, f );
}

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.


More information about the devel mailing list