2013-09-08 05:53:10 +00:00
|
|
|
#include <iostream>
|
|
|
|
#include <iomanip>
|
|
|
|
|
|
|
|
#include <DB/IO/CachedCompressedReadBuffer.h>
|
|
|
|
#include <DB/IO/WriteBufferFromFile.h>
|
|
|
|
#include <DB/IO/copyData.h>
|
|
|
|
|
|
|
|
#include <statdaemons/Stopwatch.h>
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char ** argv)
|
|
|
|
{
|
|
|
|
using namespace DB;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
UncompressedCache cache(1024);
|
|
|
|
std::string path = argv[1];
|
|
|
|
|
|
|
|
std::cerr << std::fixed << std::setprecision(3);
|
|
|
|
|
|
|
|
size_t hits = 0;
|
|
|
|
size_t misses = 0;
|
|
|
|
|
|
|
|
{
|
|
|
|
Stopwatch watch;
|
2014-02-11 11:05:02 +00:00
|
|
|
CachedCompressedReadBuffer in(path, &cache);
|
2013-09-09 02:23:36 +00:00
|
|
|
WriteBufferFromFile out("/dev/null");
|
2013-09-08 05:53:10 +00:00
|
|
|
copyData(in, out);
|
|
|
|
|
|
|
|
std::cerr << "Elapsed: " << watch.elapsedSeconds() << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
cache.getStats(hits, misses);
|
|
|
|
std::cerr << "Hits: " << hits << ", misses: " << misses << std::endl;
|
|
|
|
|
|
|
|
{
|
|
|
|
Stopwatch watch;
|
2014-02-11 11:05:02 +00:00
|
|
|
CachedCompressedReadBuffer in(path, &cache);
|
2013-09-09 02:23:36 +00:00
|
|
|
WriteBufferFromFile out("/dev/null");
|
2013-09-08 05:53:10 +00:00
|
|
|
copyData(in, out);
|
|
|
|
|
|
|
|
std::cerr << "Elapsed: " << watch.elapsedSeconds() << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
cache.getStats(hits, misses);
|
|
|
|
std::cerr << "Hits: " << hits << ", misses: " << misses << std::endl;
|
|
|
|
}
|
|
|
|
catch (const Exception & e)
|
|
|
|
{
|
|
|
|
std::cerr << e.what() << ", " << e.displayText() << std::endl;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|