Class ProfileStack
- java.lang.Object
-
- org.opends.server.plugins.profiler.ProfileStack
-
public class ProfileStack extends Object
This class defines a data structure that may be used to hold information about a thread stack trace.
-
-
Field Summary
Fields Modifier and Type Field Description static intLINE_NUMBER_NATIVEThe line number that will be used for stack frames in which the line number is unknown because it is a native method.static intLINE_NUMBER_UNKNOWNThe line number that will be used for stack frames in which the line number is unknown but it is not a native method.
-
Constructor Summary
Constructors Constructor Description ProfileStack(StackTraceElement[] stackElements)Creates a new profile stack with the provided information.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ProfileStackdecode(ASN1Reader reader)Decodes the contents of the provided element as a profile stack.booleanequals(Object o)Indicates whether to the provided object is equal to this profile stack.StringgetClassName(int depth)Retrieves the class name from the specified frame in the stack.String[]getClassNames()Retrieves the class names in this stack.intgetLineNumber(int depth)Retrieves the line number from the specified frame in the stack.int[]getLineNumbers()Retrieves the line numbers in this stack.StringgetMethodName(int depth)Retrieves the method name from the specified frame in the stack.String[]getMethodNames()Retrieves the method names in this stack.intgetNumFrames()Retrieves the number of frames in this stack.inthashCode()Retrieves the hash code for this profile stack.voidwrite(ASN1Writer writer)Encodes and writes this profile stack to the capture file.
-
-
-
Field Detail
-
LINE_NUMBER_UNKNOWN
public static final int LINE_NUMBER_UNKNOWN
The line number that will be used for stack frames in which the line number is unknown but it is not a native method.- See Also:
- Constant Field Values
-
LINE_NUMBER_NATIVE
public static final int LINE_NUMBER_NATIVE
The line number that will be used for stack frames in which the line number is unknown because it is a native method.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ProfileStack
public ProfileStack(StackTraceElement[] stackElements)
Creates a new profile stack with the provided information.- Parameters:
stackElements- The stack trace elements to use to create this profile stack.
-
-
Method Detail
-
getNumFrames
public int getNumFrames()
Retrieves the number of frames in this stack.- Returns:
- The number of frames in this stack.
-
getClassNames
public String[] getClassNames()
Retrieves the class names in this stack.- Returns:
- The class names in this stack.
-
getClassName
public String getClassName(int depth)
Retrieves the class name from the specified frame in the stack.- Parameters:
depth- The depth of the frame to retrieve, with the first frame being frame zero.- Returns:
- The class name from the specified frame in the stack.
-
getMethodNames
public String[] getMethodNames()
Retrieves the method names in this stack.- Returns:
- The method names in this stack.
-
getMethodName
public String getMethodName(int depth)
Retrieves the method name from the specified frame in the stack.- Parameters:
depth- The depth of the frame to retrieve, with the first frame being frame zero.- Returns:
- The method name from the specified frame in the stack.
-
getLineNumbers
public int[] getLineNumbers()
Retrieves the line numbers in this stack.- Returns:
- The line numbers in this stack.
-
getLineNumber
public int getLineNumber(int depth)
Retrieves the line number from the specified frame in the stack.- Parameters:
depth- The depth of the frame for which to retrieve the line number.- Returns:
- The line number from the specified frame in the stack.
-
hashCode
public int hashCode()
Retrieves the hash code for this profile stack. It will be the sum of the hash codes for the class and method name and line number for the first frame.
-
equals
public boolean equals(Object o)
Indicates whether to the provided object is equal to this profile stack.
-
write
public void write(ASN1Writer writer) throws IOException
Encodes and writes this profile stack to the capture file.- Parameters:
writer- The writer to use.- Throws:
IOException- if an error occurs while writing.
-
decode
public static ProfileStack decode(ASN1Reader reader) throws IOException
Decodes the contents of the provided element as a profile stack.- Parameters:
reader- The ASN.1 reader to read the encoded profile stack information from.- Returns:
- The decoded profile stack.
- Throws:
IOException- If the element could not be decoded for some reason.
-
-