Benchmark b = new Benchmark();
b.mark("init");
FlumeConfiguration conf = FlumeConfiguration.get();
ThriftEventSink tes = new ThriftEventSink(conf.getCollectorHost(), conf
.getCollectorPort(), false);
tes.open();
MemorySinkSource mem = cmd.hasOption("m") ? new MemorySinkSource() : null;
for (String f : argv) {
EventSource src = null;
if (cmd.hasOption("l")) {
b.mark("log4jtext");
src = new Log4jTextFileSource(f);
} else if (cmd.hasOption("t")) {
b.mark("random access text");
src = new TextFileSource(f);
} else {
b.mark("buffered reader text");
src = new TextReaderSource(f);
}
src.open();
b.mark("fileread");
if (mem != null) {
EventUtil.dumpAll(src, mem);
} else {
EventUtil.dumpAll(src, tes);
}
src.close();
}
b.mark("memdump");
if (mem != null) {
EventUtil.dumpAll(mem, tes);
}
b.mark("done");
b.done();
tes.close();
}