Created
May 8, 2013 20:16
-
-
Save xmlking/5543304 to your computer and use it in GitHub Desktop.
profile with StopWatch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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