| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2006 Sun Microsystems, Inc. |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.plugins.profiler; |
| | | |
| | |
| | | import org.opends.server.protocols.asn1.ASN1OctetString; |
| | | import org.opends.server.protocols.asn1.ASN1Sequence; |
| | | |
| | | import static org.opends.server.loggers.Debug.*; |
| | | |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugCought; |
| | | import static org.opends.server.loggers.debug.DebugLogger.debugEnabled; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | public class ProfileStack |
| | | { |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.plugins.profiler.ProfileStack"; |
| | | |
| | | |
| | | |
| | |
| | | */ |
| | | public ProfileStack(StackTraceElement[] stackElements) |
| | | { |
| | | assert debugConstructor(CLASS_NAME, String.valueOf(stackElements)); |
| | | |
| | | numFrames = stackElements.length; |
| | | classNames = new String[numFrames]; |
| | |
| | | private ProfileStack(String[] classNames, String[] methodNames, |
| | | int[] lineNumbers) |
| | | { |
| | | assert debugConstructor(CLASS_NAME, String.valueOf(classNames), |
| | | String.valueOf(methodNames), |
| | | String.valueOf(lineNumbers)); |
| | | |
| | | this.numFrames = classNames.length; |
| | | this.classNames = classNames; |
| | |
| | | */ |
| | | public int getNumFrames() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getDepth"); |
| | | |
| | | return numFrames; |
| | | } |
| | |
| | | */ |
| | | public String[] getClassNames() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getClassNames"); |
| | | |
| | | return classNames; |
| | | } |
| | |
| | | */ |
| | | public String getClassName(int depth) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getClassName", String.valueOf(depth)); |
| | | |
| | | return classNames[depth]; |
| | | } |
| | |
| | | */ |
| | | public String[] getMethodNames() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getMethodNames"); |
| | | |
| | | return methodNames; |
| | | } |
| | |
| | | */ |
| | | public String getMethodName(int depth) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getMethodName", String.valueOf(depth)); |
| | | |
| | | return methodNames[depth]; |
| | | } |
| | |
| | | */ |
| | | public int[] getLineNumbers() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getLineNumbers"); |
| | | |
| | | return lineNumbers; |
| | | } |
| | |
| | | */ |
| | | public int getLineNumber(int depth) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "getLineNumber", String.valueOf(depth)); |
| | | |
| | | return lineNumbers[depth]; |
| | | } |
| | |
| | | */ |
| | | public int hashCode() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "hashCode"); |
| | | |
| | | if (numFrames == 0) |
| | | { |
| | |
| | | */ |
| | | public boolean equals(Object o) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "equals", String.valueOf(o)); |
| | | |
| | | if (o == null) |
| | | { |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "equals", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | return false; |
| | | } |
| | |
| | | */ |
| | | public ASN1Element encode() |
| | | { |
| | | assert debugEnter(CLASS_NAME, "encode"); |
| | | |
| | | ArrayList<ASN1Element> elements = new ArrayList<ASN1Element>(3*numFrames); |
| | | for (int i=0; i < numFrames; i++) |
| | |
| | | */ |
| | | public static ProfileStack decode(ASN1Element stackElement) |
| | | { |
| | | assert debugEnter(CLASS_NAME, "decode", String.valueOf(stackElement)); |
| | | |
| | | try |
| | | { |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | assert debugException(CLASS_NAME, "decode", e); |
| | | if (debugEnabled()) |
| | | { |
| | | debugCought(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | return null; |
| | | } |