Last active
December 28, 2015 00:18
-
-
Save oldratlee/7411901 to your computer and use it in GitHub Desktop.
BTrace, MethodTracer
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 com.sun.btrace.AnyType; | |
import com.sun.btrace.annotations.Kind; | |
import com.sun.btrace.annotations.Location; | |
import com.sun.btrace.annotations.OnMethod; | |
import com.sun.btrace.annotations.ProbeMethodName; | |
import static com.sun.btrace.BTraceUtils.print; | |
import static com.sun.btrace.BTraceUtils.printArray; | |
/* | |
<dependency> | |
<groupId>com.sun.tools.btrace</groupId> | |
<artifactId>btrace-boot</artifactId> | |
<version>1.2.3</version> | |
</dependency> | |
*/ | |
/** | |
* @author ding.lid | |
*/ | |
public class MethodTracer { | |
@OnMethod( | |
clazz = "com.xx.Foo", | |
method = "/put|decr|delete|cas/", | |
location = @Location(Kind.ENTRY) | |
) | |
public static void anyWrite(@ProbeMethodName String pmn, AnyType[] args) { | |
print(pmn); | |
print(" - "); | |
printArray(args); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment