Search in sources :

Example 11 with Stopwatch

use of org.javasimon.Stopwatch in project webofneeds by researchstudio-sat.

the class MatchingLoadTestMonitorAction method doRun.

@Override
protected void doRun(final Event event, EventListener executingListener) throws Exception {
    Stopwatch stopwatch = SimonManager.getStopwatch("needHintFullRoundtrip");
    if (event instanceof NeedCreatedEvent) {
        Split split = stopwatch.start();
        needSplits.put(((NeedCreatedEvent) event).getNeedURI().toString(), split);
        logger.info("RECEIVED EVENT {} for uri {}", event, ((NeedCreatedEvent) event).getNeedURI().toString());
        long startTime = System.currentTimeMillis();
        String needUri = ((NeedCreatedEvent) event).getNeedURI().toString();
        needEventStartTime.put(needUri, startTime);
    } else if (event instanceof HintFromMatcherEvent) {
        logger.info("RECEIVED EVENT {} for uri {}", event, ((HintFromMatcherEvent) event).getMatch().getFromNeed().toString());
        long hintReceivedTime = System.currentTimeMillis();
        String needUri = ((HintFromMatcherEvent) event).getMatch().getFromNeed().toString();
        needSplits.get(((HintFromMatcherEvent) event).getMatch().getFromNeed().toString()).stop();
        if (hintEventReceivedTime.get(needUri) == null) {
            hintEventReceivedTime.put(needUri, new LinkedList<Long>());
        }
        hintEventReceivedTime.get(needUri).add(hintReceivedTime);
    }
    if (startTestTime == -1) {
        startTestTime = System.currentTimeMillis();
    }
    logger.info("Number of Needs: {}", needEventStartTime.size());
    logger.info("Number of Hints: {}", getTotalHints());
    logger.info("Number of Needs with Hints: {}", getNeedsWithHints());
    logger.info("Average Duration: {}", getAverageHintDuration());
    logger.info("Minimum Duration: {}", getMinHintDuration());
    logger.info("Maximum Duration: {}", getMaxHintDuration());
    logger.info("Needs with Hints per Second: {}", getNeedsWithNeedsPerSecond(startTestTime));
    logger.info("Hints per Second: {}", getHintsPerSecondThroughput(startTestTime));
}
Also used : HintFromMatcherEvent(won.bot.framework.eventbot.event.impl.wonmessage.HintFromMatcherEvent) Stopwatch(org.javasimon.Stopwatch) Split(org.javasimon.Split) NeedCreatedEvent(won.bot.framework.eventbot.event.impl.needlifecycle.NeedCreatedEvent)

Example 12 with Stopwatch

use of org.javasimon.Stopwatch in project webofneeds by researchstudio-sat.

the class BaseEventBotAction method getActionTask.

@Override
public Runnable getActionTask(final Event event, final EventListener eventListener) {
    return new Runnable() {

        public void run() {
            Stopwatch stopwatch = SimonManager.getStopwatch(stopwatchName);
            Split split = stopwatch.start();
            try {
                doRun(event, eventListener);
                split.stop();
            } catch (Exception e) {
                eventListenerContext.getEventBus().publish(new ErrorEvent(e));
                split.stop(EXCEPTION_TAG);
            } catch (Throwable t) {
                logger.warn("could not run action {}", stopwatchName, t);
                split.stop(EXCEPTION_TAG);
                throw t;
            }
        }
    };
}
Also used : Stopwatch(org.javasimon.Stopwatch) ErrorEvent(won.bot.framework.eventbot.event.impl.lifecycle.ErrorEvent) Split(org.javasimon.Split)

Example 13 with Stopwatch

use of org.javasimon.Stopwatch in project midpoint by Evolveum.

the class TestDeltaPerfComparison method complexStructure.

@Test(dataProvider = "combinations")
public void complexStructure(int assigmentCount, PlusMinusZero operation) throws SchemaException {
    PrismObject<UserType> user = PrismTestUtil.getPrismContext().createObject(UserType.class);
    user.setOid(newUuid());
    user.asObjectable().setName(PolyString.toPolyStringType(PolyString.fromOrig("User")));
    AssignmentType assigment = null;
    for (int i = 0; i < assigmentCount; i++) {
        assigment = randomAssigment();
        user.asObjectable().assignment(assigment);
    }
    PrismContainerValue lastAssign = assigment.asPrismContainerValue().clone();
    lastAssign.freeze();
    ObjectDelta<UserType> delta = PrismTestUtil.getPrismContext().deltaFor(UserType.class).item(UserType.F_ASSIGNMENT).mod(operation, lastAssign).asObjectDelta(user.getOid());
    Stopwatch clone = stopwatch(monitorName("delta", "clone", String.valueOf(assigmentCount)), "Cloning of structure");
    Stopwatch applyDelta = stopwatch(monitorName("delta", operation.toString(), "apply", String.valueOf(assigmentCount)), "Application of delta");
    for (int i = 0; i < REPETITIONS; i++) {
        PrismObject<UserType> userMod = null;
        try (Split s = clone.start()) {
            userMod = user.clone();
        }
        // Measure
        try (Split s = applyDelta.start()) {
            delta.applyTo(userMod);
        }
        assertNotNull(userMod.getOid());
        assertNotNull(userMod.asObjectable().getAssignment());
    }
}
Also used : PrismContainerValue(com.evolveum.midpoint.prism.PrismContainerValue) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType) Stopwatch(org.javasimon.Stopwatch) Split(org.javasimon.Split) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) Test(org.testng.annotations.Test)

Example 14 with Stopwatch

use of org.javasimon.Stopwatch in project midpoint by Evolveum.

the class MidScaleGuiTest method test220newUser.

@Test
public void test220newUser() {
    logger.info(getTestName());
    Stopwatch stopwatch = stopwatch("newUser", "New user");
    for (int i = 0; i < REPETITION_COUNT; i++) {
        tester.startPage(PageUser.class);
        tester.debugComponentTrees();
        try (Split ignored = stopwatch.start()) {
            queryListener.start();
            tester.executeAjaxEvent("detailsView:template:template:additionalButtons:0:additionalButton:compositedButton", "click");
        }
    }
    queryListener.dumpAndStop();
    tester.assertRenderedPage(PageUser.class);
    OperationsPerformanceInformationType performanceInformation = OperationsPerformanceInformationUtil.toOperationsPerformanceInformationType(OperationsPerformanceMonitor.INSTANCE.getGlobalPerformanceInformation());
    displayValue("Operation performance (by name)", OperationsPerformanceInformationUtil.format(performanceInformation));
    displayValue("Operation performance (by time)", OperationsPerformanceInformationUtil.format(performanceInformation, new AbstractStatisticsPrinter.Options(AbstractStatisticsPrinter.Format.TEXT, AbstractStatisticsPrinter.SortBy.TIME), null, null));
// runTestFor(PageUser.class, "newUser", "New user");
}
Also used : Stopwatch(org.javasimon.Stopwatch) Split(org.javasimon.Split) AbstractInitializedGuiIntegrationTest(com.evolveum.midpoint.web.AbstractInitializedGuiIntegrationTest) Test(org.testng.annotations.Test) AbstractGuiIntegrationTest(com.evolveum.midpoint.web.AbstractGuiIntegrationTest) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 15 with Stopwatch

use of org.javasimon.Stopwatch in project midpoint by Evolveum.

the class MidScaleGuiTest method test200sidebarMenu.

// doesn't work because of getPageBase usages
@Test(enabled = false)
public void test200sidebarMenu() {
    logger.info(getTestName());
    Stopwatch stopwatch = stopwatch("sidebar", "sidebar perf");
    try (Split ignored = stopwatch.start()) {
        queryListener.start();
        tester.startComponentInPage(LeftMenuPanel.class);
    }
    queryListener.dumpAndStop();
    OperationsPerformanceInformationType performanceInformation = OperationsPerformanceInformationUtil.toOperationsPerformanceInformationType(OperationsPerformanceMonitor.INSTANCE.getGlobalPerformanceInformation());
    displayValue("Operation performance (by name)", OperationsPerformanceInformationUtil.format(performanceInformation));
    displayValue("Operation performance (by time)", OperationsPerformanceInformationUtil.format(performanceInformation, new AbstractStatisticsPrinter.Options(AbstractStatisticsPrinter.Format.TEXT, AbstractStatisticsPrinter.SortBy.TIME), null, null));
}
Also used : Stopwatch(org.javasimon.Stopwatch) Split(org.javasimon.Split) AbstractInitializedGuiIntegrationTest(com.evolveum.midpoint.web.AbstractInitializedGuiIntegrationTest) Test(org.testng.annotations.Test) AbstractGuiIntegrationTest(com.evolveum.midpoint.web.AbstractGuiIntegrationTest) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

Split (org.javasimon.Split)35 Stopwatch (org.javasimon.Stopwatch)35 Test (org.testng.annotations.Test)28 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)22 SqaleRepoBaseTest (com.evolveum.midpoint.repo.sqale.SqaleRepoBaseTest)11 ObjectAlreadyExistsException (com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException)8 AbstractGuiIntegrationTest (com.evolveum.midpoint.web.AbstractGuiIntegrationTest)5 AbstractInitializedGuiIntegrationTest (com.evolveum.midpoint.web.AbstractInitializedGuiIntegrationTest)5 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)5 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)5 QUser (com.evolveum.midpoint.repo.sqale.qmodel.focus.QUser)4 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)4 SkipException (org.testng.SkipException)3 Objectable (com.evolveum.midpoint.prism.Objectable)1 PrismContainerValue (com.evolveum.midpoint.prism.PrismContainerValue)1 PrismParser (com.evolveum.midpoint.prism.PrismParser)1 QResource (com.evolveum.midpoint.repo.sqale.qmodel.resource.QResource)1 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)1 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)1 URI (java.net.URI)1