Btrace常用片断

imports

引用

import static com.sun.btrace.BTraceUtils.*;

import java.sql.Statement;

import java.util.Map;

import com.sun.btrace.AnyType;

import com.sun.btrace.aggregation.Aggregation;

import com.sun.btrace.aggregation.AggregationFunction;

import com.sun.btrace.aggregation.AggregationKey;

import com.sun.btrace.annotations.*;

Class declaration

引用

@BTrace

public class JdbcQueries {

  …

}

OnMethod

引用

    @OnMethod(

        clazz="+java.util.logging.Logger",

        method="log"

    )

    public static void onLog(@Self Logger self, LogRecord record) {

        println(Reflective.get(msgField, record));

    }

All Methods

引用

    @OnMethod(

        clazz="/javax\\.swing\\..*/",

        method="/.*/",

        location=@Location(value=Kind.RETURN)

    )

    public static void m(@ProbeClassName String probeClass, @ProbeMethodName String probeMethod) {

        print(Strings.strcat("entered ", probeClass));

        println(Strings.strcat(".", probeMethod));

    }

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.