[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [ns] "bad file size in video.dat"--why?



did you use the trace files from www-tkn.ee.tu-berlin.de/research/trace ?
Well, either the tcl script to convert them to the obscure binary format is broken or the tracetraffic.cc .

I hacked tracefile.cc to read a plain text format:

int TraceFile::setup()
{
   tracerec* t;
   struct stat buf;
   int i;
   FILE *fp;
   ofstream of("readlog");

   /* only open/read the file once (could be shared by multiple
    * SourceModel's
    */
   if (! status_)
   {
      status_ = 1;

      if (stat(name_, (struct stat *)&buf))
      {
         printf("could not stat %s\n", name_);
         return -1;
      }
      nrec_ = buf.st_size/sizeof(tracerec);
      unsigned nrecplus = nrec_ * sizeof(tracerec);
      unsigned bufst = buf.st_size;
      trace_ = new struct tracerec[nrec_];

      if ((fp = fopen(name_, "rb")) == NULL)
      {
         printf("can't open file %s\n", name_);
         return -1;
      }

      t = trace_;
      char buf[4*1024];
      while (!feof(fp)  )
      {

         if (fgets(buf,4*1024,fp)==0)
            break;
         if (sscanf(buf,"%d %d",&t->trec_time,&t->trec_size)!=2)
         {
            printf("read failed\n");
            return -1 ;
         };
         of<<t->trec_time<<" "<<t->trec_size<<endl;
         t++;
      };

   }
   /* pick a random starting place in the trace file */
   return (int(Random::uniform((double)nrec_)+.5));
}

and the tcl script:

#  puts -nonewline $trace_file_id [binary format "II" $time $length]
  puts $trace_file_id "$time $length"

I don't know why they used a binary format...

Bye
Alex

--
Free Dmitry Sklyarov ! 
http://www.freesklyarov.org

> -----Original Message-----
> From:	dongmin97 [SMTP:[email protected]]
> Sent:	Wednesday, November 28, 2001 5:39 AM
> To:	[email protected]
> Cc:	[email protected]
> Subject:	[ns] "bad file size in video.dat"--why?
> 
> This message uses a character set that is not supported by the Internet Service.  To view the original message content,  open the attached message. If the text doesn't display correctly, save the attachment to disk, and then open it using a viewer that can display the original character set. << File: message.txt >>