Last active
December 27, 2015 07:49
-
-
Save manicmonkey/7291397 to your computer and use it in GitHub Desktop.
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.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
/** | |
* @author jbaxter - 2013-10-29 | |
*/ | |
public aspect Trace { | |
private static final Logger log = LoggerFactory.getLogger("com.manicmonkey.profiling"); | |
pointcut profiledMethods(): | |
execution(@com.manicmonkey.Profiled * com.manicmonkey..*(..)); | |
Object around(): profiledMethods() { | |
long start = System.currentTimeMillis(); | |
try { | |
return proceed(); | |
} finally { | |
long end = System.currentTimeMillis(); | |
log.debug(thisJoinPoint.getSignature().getDeclaringTypeName() + "." + thisJoinPoint.getSignature().getName() + " took " + (end - start) + " milliseconds"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment