[PATCH] Write event stream in file

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Jun 21 08:37:10 UTC 2019


On 21/06/2019 10:33, Ravindra Kumar Meena wrote:
> 
>     The
> 
>     static void print_item( FILE *f, const client_item *item )
> 
>     gets already a file, please use it.
> 
>     The file is currently stdout.  This should be changed to an event
>     stream
>     file.  Add the file pointer to client_context and open the file in
>     main().
> 
> Are you suggesting to change the client_context from
> 
> typedef struct client_context {
>    uint64_t                       ns_threshold;
>    uint64_t                       last_ns;
>    uint32_t                       last_cpu;
>    bool                           flush;
>    bool                           only_one_cpu;
>    uint64_t                       counter;
>    SLIST_HEAD( , client_item )    free_items;
>    RB_HEAD( active, client_item ) active_items;
> } client_context;
> to
> 
> typedef struct client_context {
>    uint64_t                       ns_threshold;
>    uint64_t                       last_ns;
>    uint32_t                       last_cpu;
>    bool                           flush;
>    bool                           only_one_cpu;
>    uint64_t                       counter;
>    SLIST_HEAD( , client_item )    free_items;
>    RB_HEAD( active, client_item ) active_items;
>    FILE                           *fptr;

Yes, but give it a more descriptive name like "event_stream".

> } client_context;
> 
> In this case, I have to create global client_context variable to store 
> the file pointer in it. Is that good?

The context is already there in main():

int main( int argc, char **argv )
{
   rtems_record_client_context ctx;
   client_context cctx;

-- 
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