Search in sources :

Example 1 with BenchmarkHTMLReport

use of com.codingchili.core.benchmarking.reporting.BenchmarkHTMLReport in project chili-core by codingchili.

the class BenchmarkIT method testBenchmarkBuilders.

@Test
public void testBenchmarkBuilders(TestContext test) {
    Async async = test.async();
    List<BenchmarkGroup> groups = new ArrayList<>();
    BiConsumer<BenchmarkGroup, String> addOneOperation = (group, implementation) -> {
        group.implementation(implementation).add("sleep1x", Promise::complete).add("sleep2x", Promise::complete);
    };
    BiConsumer<String, Integer> addOneGroup = (name, iterations) -> {
        BenchmarkGroup group = new BenchmarkGroupBuilder(name, iterations);
        addOneOperation.accept(group, "fastImplementation");
        addOneOperation.accept(group, "slowImplementation");
        groups.add(group);
    };
    addOneGroup.accept("group_1", ITERATIONS);
    addOneGroup.accept("group_2", ITERATIONS);
    addOneGroup.accept("group_3", ITERATIONS);
    new BenchmarkExecutor(context).start(groups).onComplete(done -> {
        new BenchmarkHTMLReport(done.result()).saveTo("wowza.html");
        async.complete();
    });
}
Also used : TestContext(io.vertx.ext.unit.TestContext) Async(io.vertx.ext.unit.Async) BenchmarkHTMLReport(com.codingchili.core.benchmarking.reporting.BenchmarkHTMLReport) PARAM_ITERATIONS(com.codingchili.core.configuration.CoreStrings.PARAM_ITERATIONS) Promise(io.vertx.core.Promise) RunWith(org.junit.runner.RunWith) Timeout(io.vertx.ext.unit.junit.Timeout) VertxUnitRunner(io.vertx.ext.unit.junit.VertxUnitRunner) ArrayList(java.util.ArrayList) TimeUnit(java.util.concurrent.TimeUnit) List(java.util.List) com.codingchili.core.context(com.codingchili.core.context) BiConsumer(java.util.function.BiConsumer) org.junit(org.junit) ArrayList(java.util.ArrayList) Promise(io.vertx.core.Promise) BenchmarkHTMLReport(com.codingchili.core.benchmarking.reporting.BenchmarkHTMLReport) Async(io.vertx.ext.unit.Async)

Example 2 with BenchmarkHTMLReport

use of com.codingchili.core.benchmarking.reporting.BenchmarkHTMLReport in project chili-core by codingchili.

the class BenchmarkHTMLReportTest method setUp.

@Before
public void setUp() {
    super.setUp();
    report = new BenchmarkHTMLReport(groups);
    report.template("/main/resources/benchmarking/report.jade");
}
Also used : BenchmarkHTMLReport(com.codingchili.core.benchmarking.reporting.BenchmarkHTMLReport) Before(org.junit.Before)

Example 3 with BenchmarkHTMLReport

use of com.codingchili.core.benchmarking.reporting.BenchmarkHTMLReport in project chili-core by codingchili.

the class CoreBenchmarkSuite method createReport.

private void createReport(Promise<CommandResult> future, List<BenchmarkGroup> result, CommandExecutor executor) {
    Optional<String> template = executor.getProperty(PARAM_TEMPLATE);
    BenchmarkReport report;
    if (executor.hasProperty(PARAM_HTML)) {
        report = new BenchmarkHTMLReport(result);
    } else {
        report = new BenchmarkConsoleReport(result);
    }
    template.ifPresent(report::template);
    report.display();
    future.complete(LauncherCommandResult.SHUTDOWN);
}
Also used : BenchmarkHTMLReport(com.codingchili.core.benchmarking.reporting.BenchmarkHTMLReport) BenchmarkConsoleReport(com.codingchili.core.benchmarking.reporting.BenchmarkConsoleReport)

Aggregations

BenchmarkHTMLReport (com.codingchili.core.benchmarking.reporting.BenchmarkHTMLReport)3 BenchmarkConsoleReport (com.codingchili.core.benchmarking.reporting.BenchmarkConsoleReport)1 PARAM_ITERATIONS (com.codingchili.core.configuration.CoreStrings.PARAM_ITERATIONS)1 com.codingchili.core.context (com.codingchili.core.context)1 Promise (io.vertx.core.Promise)1 Async (io.vertx.ext.unit.Async)1 TestContext (io.vertx.ext.unit.TestContext)1 Timeout (io.vertx.ext.unit.junit.Timeout)1 VertxUnitRunner (io.vertx.ext.unit.junit.VertxUnitRunner)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 TimeUnit (java.util.concurrent.TimeUnit)1 BiConsumer (java.util.function.BiConsumer)1 org.junit (org.junit)1 Before (org.junit.Before)1 RunWith (org.junit.runner.RunWith)1