Created
August 19, 2016 10:48
-
-
Save ChinaXing/302e053d03d8e53dfde2610e000b22d3 to your computer and use it in GitHub Desktop.
btrace probe field set
This file contains hidden or 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.annotations.*; | |
import com.sun.btrace.AnyType; | |
import static com.sun.btrace.BTraceUtils.*; | |
@BTrace | |
public class Q{ | |
@OnMethod( | |
clazz="java.nio.Buffer", | |
method="/.*/", | |
location=@Location(value=Kind.FIELD_SET, clazz="java.nio.Buffer", field="po | |
sition") | |
) | |
public static void S(@Self Object self, int v){ // type must match the field's type | |
if(v == 0){ | |
// long id = getLong(field(classForName("com.alibaba.cobar.net.F | |
rontendConnection",contextClassLoader()),"id"),self); | |
int hash = identityHashCode(self); | |
println(concat(concat(concat("====", str(hash)) ,"======== set posist | |
ion : \n"), jstackStr())); | |
} | |
} | |
@OnMethod( | |
clazz="com.alibaba.cobar.net.buffer.BufferPool", | |
method="insert" | |
) | |
public static void insert(AnyType[] args){ | |
println(concat("insert>>>>",str(identityHashCode(args[0])))); | |
} | |
@OnMethod( | |
clazz="com.alibaba.cobar.net.buffer.BufferPool", | |
method="extract", | |
location=@Location(Kind.RETURN) | |
) | |
public static void extract(@Return Object arg){ | |
println(concat("extract>>>>",str(identityHashCode(arg)))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment