Skip to content

Instantly share code, notes, and snippets.

@xmlking
Created May 8, 2013 20:16
Show Gist options
  • Save xmlking/5543304 to your computer and use it in GitHub Desktop.
Save xmlking/5543304 to your computer and use it in GitHub Desktop.
profile with StopWatch
import org.springframework.util.StopWatch;
@Around("methodsToBeProfiled()")
public Object profile(ProceedingJoinPoint pjp) throws Throwable {
StopWatch sw = new StopWatch(getClass().getSimpleName());
try {
sw.start(pjp.getSignature().getName());
return pjp.proceed();
} finally {
sw.stop();
System.out.println(sw.prettyPrint());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment