[PATCH] Write event stream in file
Ravindra Kumar Meena
rmeena840 at gmail.com
Fri Jun 21 06:57:49 UTC 2019
> > seconds = (uint32_t) ( item->ns / 1000000000 );
> > nanoseconds = (uint32_t) ( item->ns % 1000000000 );
> > + ns=nanoseconds;
>
> Why not move the nanoseconds variable into the upper block?
>
Okay
>
> > fprintf( f, "%" PRIu32 ".%09" PRIu32 ":", seconds, nanoseconds );
> > } else {
>
> Which value has "ns" in this path?
>
na does not have a unique value. It is changing eveytime print_item() is
called upon
>
> > 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?
>
I would like to know your approach. I will implement that only. It's better
to implement your approach instead of mine. It will save some time.
>
> > +
> > + if (fptr == NULL)
> > + {
> > + printf("Could not open file");
> > + return 0;
>
> Can void functions return something?
>
Ooops. I didn't see the void.
>
> > + }
> > +
> > + ctf_item->cpu=item->cpu;
>
> To which object points the the ctf_item pointer here?
>
Are you expecting 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?
>
Yes the rtems-tools was building successfully but I was getting nothing in
file.
--
*Ravindra Kumar Meena*,
B. Tech. Computer Science and Engineering,
Indian Institute of Technology (Indian School of Mines)
<https://www.iitism.ac.in/>, Dhanbad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20190621/bd4d5ae8/attachment-0002.html>
More information about the devel
mailing list