[PATCH v2] Write event stream in file

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Jun 25 18:26:38 UTC 2019


----- Am 25. Jun 2019 um 19:18 schrieb Ravindra Kumar Meena rmeena840 at gmail.com:

> ---
> misc/record/record-main.c | 26 +++++++++-----------------
> 1 file changed, 9 insertions(+), 17 deletions(-)
> 
> diff --git a/misc/record/record-main.c b/misc/record/record-main.c
> index cd7ef4f..7764109 100644
> --- a/misc/record/record-main.c
> +++ b/misc/record/record-main.c
> @@ -146,20 +146,12 @@ static int connect_client( const char *host, uint16_t port
> )
> static void print_item( FILE *f, const client_item *item )
> {
>   ctf_event ctf_item;
> -  uint32_t ns=0;
> 
> -  if ( item->ns != 0 ) {
> -    uint32_t nanoseconds;
> -
> -    nanoseconds = (uint32_t) ( item->ns % 1000000000 );
> -    ns=nanoseconds;
> -  }
> -
> -  ctf_item.event_id=0;
> -  ctf_item.ns=ns;
> -  ctf_item.cpu=item->cpu;
> -  ctf_item.event=item->event;
> -  ctf_item.data=item->data;
> +  ctf_item.event_id = 0;
> +  ctf_item.ns = ( uint32_t ) ( item->ns % 1000000000 );

Why don't you simply assign item->ns to ctf_item.ns like I said several times before. When you don't know why it should be like this, then please ask.

> +  ctf_item.cpu= item->cpu;
> +  ctf_item.event = __builtin_bswap32( item->event );

Why is there this byte swap?



More information about the devel mailing list