<div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">>     For whatever reason this file has only 98304 bytes. The<br>
>     content looks<br>
>      >     all right. So, the next step is to modify the client so that<br>
>     it can<br>
>      >     read<br>
>      >     from a file instead of the TCP stream.<br>
>      ><br>
>      > I am trying to write code to read from the original raw record item.<br>
> <br>
>     I am not sure why you want to do this. On which task are you currently<br>
>     working?<br>
> <br>
> I am working on the 2nd task to modify the record-client program to read <br>
> from a file if a --input=<FILE> command line option is given.<br>
<br>
Could you please check in the part which adds the new option and the <br>
code which opens the file.<br>
<br>
> <br>
> client_item record;<br>
> while(fread(&record, sizeof(record), 1, input_file))<br>
>          printf ("CPU=%d\n",record.cpu);<br>
> <br>
> Here input_file is a file provided through the command.<br>
<br>
The TCP stream you saved with nc from the target consists of struct <br>
rtems_record_item_32. In the code above you read struct client_item <br>
items. This cannot be right. When you don't know which content a file <br>
has, please ask.<br></blockquote>typedef struct {<br>  uint32_t event;<br>  uint32_t data;<br><div>} rtems_record_item_32; </div><div><br></div><div>Okay. Raw file contents have this structure. It means raw file will only contain event and data in binary format. How should I get it's corresponding ns and cpu values.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
You have to change this code here:<br>
<br>
   while ( true ) {<br>
     int buf[ 8192 ];<br>
     ssize_t n;<br>
<br>
     n = recv( fd, buf, sizeof( buf ), 0 );<br>
     if ( n >= 0 ) {<br>
       rtems_record_client_run( &ctx, buf, (size_t) n );<br>
     } else {<br>
       break;<br>
     }<br>
   }<br>
<br>
First you should refactor the code and move the TCP relates stuff into <br>
separate functions. </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> </blockquote><div>The command line should like this right?</div><div>./build/misc/rtems-record --input=<file> | head </div></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><font size="4"><b>Ravindra Kumar Meena</b></font>,<div><span style="color:rgb(102,102,102)">B. Tech. Computer Science and Engineering,<br></span></div><div><span style="color:rgb(102,102,102)"><a href="https://www.iitism.ac.in/" style="color:rgb(17,85,204)" target="_blank">Indian Institute of Technology (Indian School of Mines)</a>, Dhanbad</span></div></div></div></div></div></div>