#include <oxstd.h>
#include "dhtfile.h"

#include "dhtfile.ox"


main()
{
    decl file = new DhtFile(), time, x;

    time = timer();
    file->OpenRead("dhttest3"); // no extension
    file->Info();               // check to see what is read
    print("OpenRead took: ", timespan(time), "\n");

    time = timer();
    file->Seekr(1000);
    x = file->Readr(5000);
    print("Read 5000 rows time:", timespan(time), " column mean: ", double(meanc(meanr(x))), "\n");

    time = timer();
    file->Seekc(4);
    x = file->Readc(1);
    print("Read column 5 (block 1024*8KB) time:  ", timespan(time), " column mean: ", double(meanc(x)), "\n");

    time = timer();
    file->SetBlockSize(10240);
    file->Seekc(4);
    x = file->Readc(1);
    print("Read column 5 (block 10240*8KB) time: ", timespan(time), " column mean: ", double(meanc(x)), "\n");

    time = timer();
    file->SetBlockSize(1);
    file->Seekc(4);
    x = file->Readc(1);
    print("Read column 5 (no blocking) time:     ", timespan(time), " column mean: ", double(meanc(x)), "\n");

    delete file;                // clean up
}
