|
Protomatter Software v1.1.8 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.protomatter.util.StackTraceUtil
A utility class for parsing stack traces.
Determining the stack information at runtime is a relatively expensive operation. I've tested this on a 650MHz PIII Coppermine Sony Vaio laptop running RedHat Linux 7.2, kernel 2.4.9, I saw these results with single-threaded tests:
Classic VM (build JDK-1.2.2_012, green threads, nojit) | Average 0.73543ms |
Classic VM (build 1.3.1, J2RE 1.3.1 IBM build cxia32131-20020410 (JIT enabled: jitc)) | Average 0.31817ms |
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_03-b03) | Average 0.18201ms |
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode) | Average 0.1024ms |
JRockit Virtual Machine (build 3.1.4-dax.appeal.se-20020319-1000) Native Threads, Generational Concurrent Garbage Collector |
Average 0.0486ms |
If possible, this class loads an implementation of itself that uses new APIs available in JDK 1.4 to improve performance. Under JDK 1.2 and 1.3, this class parses a stack trace to determine call stack information.
Also, under the IBM and JRockit JVMs, line numbers are usually not available. They may or may not be availble under other JVMs because the JIT may or may not strip that information from stack traces.
Sustained, rapid creation of java.lang.Throwable objects under the IBM JDK repeatedly caused JVM deadlocks. This should not be an issue in actual systems, but it is concerning.
Constructor Summary | |
protected |
StackTraceUtil()
Protected constructor so nobody instantiates this class. |
Method Summary | |
protected StackTraceInfo |
getInfo(int stackOffset)
|
static void |
main(java.lang.String[] args)
Performance test rig. |
static StackTraceInfo |
whereAmI()
Determine what class and method you are in. |
static StackTraceInfo |
whereAmI(int stackOffset)
Determine what class and method you are in. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected StackTraceUtil()
Method Detail |
public static StackTraceInfo whereAmI()
public static StackTraceInfo whereAmI(int stackOffset)
protected StackTraceInfo getInfo(int stackOffset)
public static void main(java.lang.String[] args)
|
Protomatter Software v1.1.8 Copyright 1998-2002 Nate Sammons |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Protomatter Software v1.1.8 | http://protomatter.sourceforge.net/1.1.8 |