use of net.openhft.load.config.ConfigParser in project Chronicle-Queue by OpenHFT.
the class StageMain method main.
public static void main(String[] args) throws IOException {
// MlockAll.doMlockall();
if (args.length != 2) {
throw new IllegalArgumentException("Usage: <program> [resource-name] [stage-index]");
}
final ConfigParser configParser = new ConfigParser(args[0]);
final StageConfig stageConfig = configParser.getStageConfig(Integer.parseInt(args[1]));
final ExecutorService service = Executors.newFixedThreadPool(stageConfig.getStageIndices().size() + 1);
service.submit(new PretoucherTask(outputQueue(stageConfig.getOutputPath(), UNSET_SOURCE), configParser.getPretouchIntervalMillis()));
for (Integer index : stageConfig.getStageIndices()) {
service.submit(() -> {
final Stage stage = new Stage(createOutput(stageConfig.getOutputPath(), index + 1), index);
final MethodReader reader = createReader(stageConfig.getInputPath(), stage);
Thread.currentThread().setName("load.stage-consumer-" + index);
boolean warnOnce = false;
while (!Thread.currentThread().isInterrupted()) {
try {
reader.readOne();
} catch (Exception e) {
if (!warnOnce) {
e.printStackTrace();
warnOnce = true;
}
}
}
});
}
}
use of net.openhft.load.config.ConfigParser in project Chronicle-Queue by OpenHFT.
the class PublishDeltaGenerator method main.
public static void main(String[] args) throws IOException {
if (args.length != 1) {
throw new IllegalArgumentException("Usage: <program> [resource-name]");
}
Jvm.setExceptionHandlers((c, m, t) -> {
// System.out.println(m);
}, (c, m, t) -> {
// System.out.println(m);
t.printStackTrace();
}, (c, m, t) -> System.out.println(m));
final ConfigParser configParser = new ConfigParser(args[0]);
final List<StageConfig> allStageConfigs = configParser.getAllStageConfigs();
final StageConfig lastStageConfig = allStageConfigs.get(allStageConfigs.size() - 1);
try (final SingleChronicleQueue pubQueue = ChronicleQueue.singleBuilder(configParser.getPublisherConfig().outputDir()).build();
final SingleChronicleQueue queue = ChronicleQueue.singleBuilder(lastStageConfig.getOutputPath()).build();
final Writer resultsWriter = new FileWriter("publish-deltas.txt", false);
final Writer s0Pub = new FileWriter("s0-deltas.txt", false);
final Writer s1Pub = new FileWriter("s1-deltas.txt", false);
final Writer s0s2Pub = new FileWriter("s0-s2-deltas.txt", false);
final Writer s1s2Pub = new FileWriter("s1-s2-deltas.txt", false)) {
final MethodReader reader = pubQueue.createTailer().methodReader(new CapturingReceiver(resultsWriter, m -> m.publishNanos));
while (reader.readOne()) {
// report
}
final MethodReader methodReader = queue.createTailer().methodReader(new DelegatingReceiver(new CapturingReceiver(s0Pub, m -> m.t0), new CapturingReceiver(s1Pub, m -> m.t1), new CapturingReceiver(s0s2Pub, m -> m.t2, 5), new CapturingReceiver(s1s2Pub, m -> m.t2, 6)));
while (methodReader.readOne()) {
// report
}
}
}
use of net.openhft.load.config.ConfigParser in project Chronicle-Queue by OpenHFT.
the class PublisherMain method main.
public static void main(String[] args) throws Exception {
// MlockAll.doMlockall();
if (args.length != 1) {
throw new IllegalArgumentException("Usage: <program> [resource-name]");
}
final ConfigParser configParser = new ConfigParser(args[0]);
final PublisherConfig publisherConfig = configParser.getPublisherConfig();
final ExecutorService executorService = Executors.newFixedThreadPool(2);
executorService.submit(new PretoucherTask(outputQueue(publisherConfig.outputDir()), configParser.getPretouchIntervalMillis()));
executorService.submit(new HiccupReporter()::start);
final Publisher publisher = new Publisher(publisherConfig, createOutput(publisherConfig.outputDir()), configParser.getAllStageConfigs());
publisher.init();
publisher.startPublishing();
}
use of net.openhft.load.config.ConfigParser in project Chronicle-Queue by OpenHFT.
the class ResultGenerator method main.
public static void main(String[] args) throws IOException {
if (args.length != 1) {
throw new IllegalArgumentException("Usage: <program> [resource-name]");
}
final ConfigParser configParser = new ConfigParser(args[0]);
final List<StageConfig> allStageConfigs = configParser.getAllStageConfigs();
final StageConfig lastStageConfig = allStageConfigs.get(allStageConfigs.size() - 1);
Jvm.setExceptionHandlers((c, m, t) -> {
// System.out.println(m);
}, (c, m, t) -> {
// System.out.println(m);
if (t != null) {
t.printStackTrace();
}
}, (c, m, t) -> System.out.println(m));
try (final SingleChronicleQueue queue = ChronicleQueue.singleBuilder(lastStageConfig.getOutputPath()).build();
final Writer resultsWriter = new FileWriter("results.txt", false)) {
final MethodReader methodReader = queue.createTailer().methodReader(new CapturingReceiver(resultsWriter));
while (methodReader.readOne()) {
// report
}
}
}
Aggregations