> > > For whatever reason this file has only 98304 bytes. The > > content looks > > > all right. So, the next step is to modify the client so that > > it can > > > read > > > from a file instead of the TCP stream. > > > > > > I am trying to write code to read from the original raw record > item. > > > > I am not sure why you want to do this. On which task are you > currently > > working? > > > > I am working on the 2nd task to modify the record-client program to read > > from a file if a --input=<FILE> command line option is given. > > Could you please check in the part which adds the new option and the > code which opens the file. > > > > > client_item record; > > while(fread(&record, sizeof(record), 1, input_file)) > > printf ("CPU=%d\n",record.cpu); > > > > Here input_file is a file provided through the command. > > The TCP stream you saved with nc from the target consists of struct > rtems_record_item_32. In the code above you read struct client_item > items. This cannot be right. When you don't know which content a file > has, please ask. > typedef struct { uint32_t event; uint32_t data; } rtems_record_item_32;
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. > > You have to change this code here: > > while ( true ) { > int buf[ 8192 ]; > ssize_t n; > > n = recv( fd, buf, sizeof( buf ), 0 ); > if ( n >= 0 ) { > rtems_record_client_run( &ctx, buf, (size_t) n ); > } else { > break; > } > } > > First you should refactor the code and move the TCP relates stuff into > separate functions. The command line should like this right? ./build/misc/rtems-record --input=<file> | head -- *Ravindra Kumar Meena*, B. Tech. Computer Science and Engineering, Indian Institute of Technology (Indian School of Mines) <https://www.iitism.ac.in/>, Dhanbad
_______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel