-
Notifications
You must be signed in to change notification settings - Fork 963
Description
[reporter="duanetiemann", created="Tue, 25 Mar 2014 14:22:59 +0100"]
The following program fails to record the call to LinkedList.offer from readDataFromOpenFile. The output shows that readDataFromOpenFile is called and the probe that directly monitors LinkedList.offer when called from readDataFromOpenFile does fire and the jstackStr shows that it is called directly from readDataFromOpenFile. The probe with Kind.CALL is missed. Hopefully this is a horrible error on my part, but I don't see it.
importcom.sun.btrace.annotations.*;
importcom.sun.btrace.AnyType;
import static com.sun.btrace.BTraceUtils.*;
@btrace
public class ProblemDemo
{
static int Count=0;
static int MaxCount=500;
@tls static boolean InreadDataFromOpenFile = false;
@OnMethod(clazz="com.emc.storageos.data.object.controller.impl.FileSystemDeviceController", method="readDataFromOpenFile",location=@location(Kind.ENTRY))
public static void readDataFromOpenFileEntry(AnyType[] args)
{
InreadDataFromOpenFile = true;
println(strcat(str(threadId(currentThread())) ,
strcat(timestamp(" yyyy/MM/dd HH:mm:ss.SSS ") ,
strcat(str(timeNanos()) ,
" readDataFromOpenFile Entry"))));
if (Count++ > MaxCount)exit();
}
@OnMethod(clazz="com.emc.storageos.data.object.controller.impl.FileSystemDeviceController", method="readDataFromOpenFile",location=@location(Kind.RETURN))
public static void readDataFromOpenFileReturn()
{
InreadDataFromOpenFile = false;
println(strcat(str(threadId(currentThread())) ,
strcat(timestamp(" yyyy/MM/dd HH:mm:ss.SSS ") ,
strcat(str(timeNanos()) ,
" readDataFromOpenFile Return"))));
if (Count++ > MaxCount)exit();
}
@OnMethod(clazz="java.util.LinkedList", method="offer", location=@location(Kind.ENTRY))
public static void LinkedListofferEntry()
{
if (!InreadDataFromOpenFile)return;
println(strcat(str(threadId(currentThread())) ,
strcat(timestamp(" yyyy/MM/dd HH:mm:ss.SSS ") ,
strcat(str(timeNanos()) ,
strcat(" LinkedList.offer Entry" ,
strcat(" stack=" ,
jstackStr()))))));
if (Count++ > MaxCount)exit();
}
@OnMethod(clazz="com.emc.storageos.data.object.controller.impl.FileSystemDeviceController", method="readDataFromOpenFile",
location=@location(value=Kind.CALL,clazz="java.util.LinkedList",method="offer"))
public static void readDataFromOpenFilecallsLinkedListofferEntry()
{
println(strcat(str(threadId(currentThread())) ,
strcat(timestamp(" yyyy/MM/dd HH:mm:ss.SSS ") ,
strcat(str(timeNanos()) ,
" readDataFromOpenFile_calls_LinkedList.offer Entry"))));
if (Count++ > MaxCount)exit();
}
}