[PATCH] Write event stream in file
Ravindra Meena
rmeena840 at gmail.com
Thu Jun 20 12:17:40 UTC 2019
---
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;
fprintf( f, "%" PRIu32 ".%09" PRIu32 ":", seconds, nanoseconds );
} else {
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");
+
+ if (fptr == NULL)
+ {
+ printf("Could not open file");
+ return 0;
+ }
+
+ ctf_item->cpu=item->cpu;
+ 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
More information about the devel
mailing list