org.opends.server.plugins.profiler
Class ProfileStack

java.lang.Object
  extended by org.opends.server.plugins.profiler.ProfileStack

public class ProfileStack
extends java.lang.Object

This class defines a data structure that may be used to hold information about a thread stack trace.


Field Summary
static 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.
static 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.
 
Constructor Summary
ProfileStack(java.lang.StackTraceElement[] stackElements)
          Creates a new profile stack with the provided information.
 
Method Summary
static ProfileStack decode(ASN1Element stackElement)
          Decodes the contents of the provided element as a profile stack.
 ASN1Element encode()
          Encodes this profile stack for writing to the capture file.
 boolean equals(java.lang.Object o)
          Indicates whether to the provided object is equal to this profile stack.
 java.lang.String getClassName(int depth)
          Retrieves the class name from the specified frame in the stack.
 java.lang.String[] getClassNames()
          Retrieves the class names in this stack.
 int getLineNumber(int depth)
          Retrieves the line number from the specified frame in the stack.
 int[] getLineNumbers()
          Retrieves the line numbers in this stack.
 java.lang.String getMethodName(int depth)
          Retrieves the method name from the specified frame in the stack.
 java.lang.String[] getMethodNames()
          Retrieves the method names in this stack.
 int getNumFrames()
          Retrieves the number of frames in this stack.
 int hashCode()
          Retrieves the hash code for this profile stack.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

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(java.lang.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 java.lang.String[] getClassNames()
Retrieves the class names in this stack.

Returns:
The class names in this stack.

getClassName

public java.lang.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 java.lang.String[] getMethodNames()
Retrieves the method names in this stack.

Returns:
The method names in this stack.

getMethodName

public java.lang.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.

Overrides:
hashCode in class java.lang.Object
Returns:
The hash code for this profile stack.

equals

public boolean equals(java.lang.Object o)
Indicates whether to the provided object is equal to this profile stack.

Overrides:
equals in class java.lang.Object
Parameters:
o - The object for which to make the determination.
Returns:
true if the provided object is a profile stack object with the same set of class names, method names, and line numbers as this profile stack, or false if not.

encode

public ASN1Element encode()
Encodes this profile stack for writing to the capture file.

Returns:
The ASN.1 element containing the encoded representation of this profile stack.

decode

public static ProfileStack decode(ASN1Element stackElement)
Decodes the contents of the provided element as a profile stack.

Parameters:
stackElement - The ASN.1 element containing the encoded profile stack information.
Returns:
The decoded profile stack, or null if the element could not be decoded for some reason.