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));
}
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;
}
}
};
}
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());
}
}
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");
}
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));
}
Aggregations