// =====================================================================
//  $Id: ofilterbench.cc,v 1.2 2003/12/08 04:26:30 goiwai Exp $
//  $Name: CLDAQ-1-14-06 $
//  $Log: ofilterbench.cc,v $
//  Revision 1.2  2003/12/08 04:26:30  goiwai
//  *** empty log message ***
//
//  Revision 1.1  2003/12/07 06:20:22  goiwai
//  ベンチーマーク用プログラムを追加しました.
//  測定をなるべく厳密に行なえるようにtest以下のプログラムを若干修整したも
//  のです.
//
// =====================================================================
#include "TOutputObjectFile.hh"
#include "TBenchmark.hh"
#include "TSystemTimer.hh"
#include "TDataRecord.hh"
#include "TFileProperty.hh"
#include "TCompressObjectFilter.hh"
#include "constants.h"

int main()
{
  TDataRecord record;
  record.Test();
  const Tint recordsize = record.GetRecordSize();

  for ( Tint i = 0; i < len; i ++ ) {
    Tint max = nevent[i];
    Tstring filename = "ofilterbench" + itostr(max,0) + ".drec";
    TCompressObjectFilter filter;
    TBenchmark bench;
    bench.Start();
    TOutputObjectFile* ofile = new TOutputObjectFile(&filter,filename);
    for ( Tint event = 0; event < max; event ++ ) {
      ofile -> Write( record );
    }
    delete ofile;
    bench.Stop();

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


  }

  return 0;
}
