// =====================================================================
//  $Id: sysread.cc,v 1.1 2003/12/08 04:26:23 goiwai Exp $
//  $Name: CLDAQ-1-11-00 $
//  $Log: sysread.cc,v $
//  Revision 1.1  2003/12/08 04:26:23  goiwai
//  4kBずつ read/write するプログラム
//  よけいなことはいっさいしないです.
//  評価用にどうぞ.
//
// =====================================================================
#include "TBenchmark.hh"
#include "TSystemTimer.hh"
#include "TFileProperty.hh"
#include "constants.h"

int main()
{
  const Tint buflen = 0x1000;
  Tbyte buf[buflen];
  const Tsize_t recordsize = Tsizeof(buf) * Tsizeof(Tbyte);

  for ( Tint i = 0; i < len; i ++ ) {
    Tint max = nevent[i];
    Tstring filename = "syswrite" + itostr(max,0) + ".dat";
    Tint flags = O_RDONLY;

    TBenchmark bench;
    bench.Start();
    Tint fd = open(filename.c_str(),flags);
    while ( read(fd,buf,recordsize) ) {
      // nothig to do;
    }
    close(fd);
    bench.Stop();

    TFileProperty p(filename);
    Tcout << max << " "
          << p.GetTotalSize() << " "
          << bench.GetSystemTimer().GetRealElapsedTime() << Tendl;
  }

  return 0;
}
