----- Am 20. Jun 2019 um 14:17 schrieb Ravindra Kumar Meena rmeena...@gmail.com:
> --- > misc/record/record-main.c | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > > diff --git a/misc/record/record-main.c b/misc/record/record-main.c > index 742428b..eccf291 100644 > --- a/misc/record/record-main.c > +++ b/misc/record/record-main.c > @@ -67,6 +67,13 @@ typedef struct client_item { > uint64_t counter; > } client_item; > > +typedef struct ctf_event { > + uint64_t ns; > + uint32_t cpu; > + rtems_record_event event; > + uint64_t data; > +} ctf_event; > + > typedef struct client_context { > uint64_t ns_threshold; > uint64_t last_ns; > @@ -135,12 +142,16 @@ 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; > + > if ( item->ns != 0 ) { > uint32_t seconds; > uint32_t nanoseconds; > > seconds = (uint32_t) ( item->ns / 1000000000 ); > nanoseconds = (uint32_t) ( item->ns % 1000000000 ); > + ns=nanoseconds; Why not move the nanoseconds variable into the upper block? > fprintf( f, "%" PRIu32 ".%09" PRIu32 ":", seconds, nanoseconds ); > } else { Which value has "ns" in this path? > fprintf( f, "*:" ); > @@ -153,6 +164,22 @@ static void print_item( FILE *f, const client_item *item > ) > rtems_record_event_text( item->event ), > item->data > ); > + > + FILE *fptr = fopen("event", "a"); How often gets this file opened and closed? Do you think that opening and closing a file is a cheap operation? Could there be a more efficient solution? > + > + if (fptr == NULL) > + { > + printf("Could not open file"); > + return 0; Can void functions return something? > + } > + > + ctf_item->cpu=item->cpu; To which object points the the ctf_item pointer here? > + ctf_item->event=item->event; > + ctf_item->data=item->data; > + ctf_item->ns=ns; > + > + fprintf(fptr,ctf_item); > + fclose(fptr); > } > > static void flush_items( client_context *cctx ) > -- > 2.7.4 Did you compile and run the program with this patch? _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel