use of org.springframework.util.StopWatch in project Gemma by PavlidisLab.
the class DifferentialExpressionSearchTaskImpl method fetchDifferentialExpressionResults.
/**
* Main processing: fetch diff ex results.
*
* @param resultSets to be searched
* @param geneIds to be searched
* @param searchResult holds the results
*/
private void fetchDifferentialExpressionResults(List<DiffExResultSetSummaryValueObject> resultSets, List<Long> geneIds, DifferentialExpressionGenesConditionsValueObject searchResult) {
StopWatch watch = new StopWatch("Process differential expression search");
watch.start("Fetch diff ex results");
// Main query for results; the main time sink.
Map<Long, Map<Long, DiffExprGeneSearchResult>> resultSetToGeneResults = differentialExpressionResultService.findDiffExAnalysisResultIdsInResultSets(resultSets, geneIds);
watch.stop();
Collection<DiffExprGeneSearchResult> aggregatedResults = this.aggregateAcrossResultSets(resultSetToGeneResults);
watch.start("Fetch details for contrasts for " + aggregatedResults.size() + " results");
Map<Long, ContrastsValueObject> detailedResults = this.getDetailsForContrasts(aggregatedResults);
this.processHits(searchResult, resultSetToGeneResults, resultSets, detailedResults);
watch.stop();
DifferentialExpressionSearchTaskImpl.log.info("Diff ex search finished:\n" + watch.prettyPrint());
}
use of org.springframework.util.StopWatch in project spring-security by spring-projects.
the class FilterChainPerformanceTests method provideDataOnScalingWithNumberOfAuthoritiesUserHas.
/**
* Creates data from 1 to N_AUTHORITIES in steps of 10, performing N_INVOCATIONS for
* each
*/
@Test
public void provideDataOnScalingWithNumberOfAuthoritiesUserHas() throws Exception {
StopWatch sw = new StopWatch("Scaling with nAuthorities");
for (int user = 0; user < N_AUTHORITIES / 10; user++) {
int nAuthorities = (user != 0) ? user * 10 : 1;
SecurityContextHolder.getContext().setAuthentication(new UsernamePasswordAuthenticationToken("bob", "bobspassword", createRoles(nAuthorities)));
this.session.setAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY, SecurityContextHolder.getContext());
SecurityContextHolder.clearContext();
sw.start(nAuthorities + " authorities");
runWithStack(this.minimalStack);
System.out.println(sw.shortSummary());
sw.stop();
}
System.out.println(sw.prettyPrint());
}
use of org.springframework.util.StopWatch in project spring-framework by spring-projects.
the class PerformanceMonitorInterceptor method invokeUnderTrace.
@Override
protected Object invokeUnderTrace(MethodInvocation invocation, Log logger) throws Throwable {
String name = createInvocationTraceName(invocation);
StopWatch stopWatch = new StopWatch(name);
stopWatch.start(name);
try {
return invocation.proceed();
} finally {
stopWatch.stop();
writeToLog(logger, stopWatch.shortSummary());
}
}
use of org.springframework.util.StopWatch in project spring-framework by spring-projects.
the class IntroductionBenchmarkTests method timeManyInvocations.
@Test
public void timeManyInvocations() {
StopWatch sw = new StopWatch();
TestBean target = new TestBean();
ProxyFactory pf = new ProxyFactory(target);
pf.setProxyTargetClass(false);
pf.addAdvice(new SimpleCounterIntroduction());
ITestBean proxy = (ITestBean) pf.getProxy();
Counter counter = (Counter) proxy;
sw.start(INVOCATIONS + " invocations on proxy, not hitting introduction");
for (int i = 0; i < INVOCATIONS; i++) {
proxy.getAge();
}
sw.stop();
sw.start(INVOCATIONS + " invocations on proxy, hitting introduction");
for (int i = 0; i < INVOCATIONS; i++) {
counter.getCount();
}
sw.stop();
sw.start(INVOCATIONS + " invocations on target");
for (int i = 0; i < INVOCATIONS; i++) {
target.getAge();
}
sw.stop();
System.out.println(sw.prettyPrint());
}
use of org.springframework.util.StopWatch in project spring-framework by spring-projects.
the class QuartzSchedulerLifecycleTests method destroyLazyInitSchedulerWithDefaultShutdownOrderDoesNotHang.
// SPR-6354
@Test
public void destroyLazyInitSchedulerWithDefaultShutdownOrderDoesNotHang() {
ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("quartzSchedulerLifecycleTests.xml", getClass());
assertThat(context.getBean("lazyInitSchedulerWithDefaultShutdownOrder")).isNotNull();
StopWatch sw = new StopWatch();
sw.start("lazyScheduler");
context.close();
sw.stop();
assertThat(sw.getTotalTimeMillis() < 500).as("Quartz Scheduler with lazy-init is hanging on destruction: " + sw.getTotalTimeMillis()).isTrue();
}
Aggregations