我正在尝试在 Windows 7 Enterprise 上使用 Java 1.8 运行 btrace v.1.3 (20150516) 并遇到很多问题。
在我的 btrace 脚本中,我正在使用以下方法创建一个聚合:
private static Aggregation methodDuration = Aggregations
.newAggregation(AggregationFunction.AVERAGE);
聚合创建以静默方式失败,随后的调用抛出 NullPointerException 试图访问它。
当我运行股票分析示例https://github.com/jbachorik/btrace/blob/master/samples/Profiling.java时,我遇到了几乎相同的问题
但是这次我收到一条错误消息:BTraceScript.java:131:instance variables are not allowed。
该示例的我的 btrace 代码如下所示
@BTrace
public class BTraceScript {
. . .
131 @Property
132 Profiler profiler = BTraceUtils.Profiling.newProfiler();
133
134 @OnMethod(clazz="com.vgrazi.btrace.SynchronizationExample", method="/.*/")
135 void entry(@ProbeMethodName(fqn=true) String probeMethod) {
136 BTraceUtils.Profiling.recordEntry(profiler, probeMethod);
137 }
仅供参考,我也在使用 Java 8 的 Mac 上进行尝试,虽然它稍微进一步,但它的行为仍然不正确。