com.mentorgen.tools.profile.runtime
Class Profile
java.lang.Object
com.mentorgen.tools.profile.runtime.Profile
- All Implemented Interfaces:
- java.lang.Runnable
public final class Profile
- extends java.lang.Object
- implements java.lang.Runnable
The Profiler is the class that actually profiles the code.
Code to be profiled is instrumented, when the byte code is loaded,
to make calls to this class:
- At the beginning of each method (calls
Profiler.start())
- At the end of each method (that is, when return is called, which
might not actaully be at the end of the method)
(calls
Profiler.end())
- When an exception is thrown (also calls
Profiler.end())
- Each time a constructor is called (optional)
Note: Instrumenting code can interfer with line numbers that are added to
the code for debugging. If you are debugging code and your stack traces
don't have line numbers, don't use the profiler (ie, don't use
-javaagent)
- Author:
- Andrew Wilcox
|
Method Summary |
static void |
alloc(java.lang.String className)
|
static java.lang.Iterable<ClassAllocation> |
allocations()
|
static void |
beginWait(java.lang.String className,
java.lang.String methodName)
|
static void |
clear()
|
static void |
end(java.lang.String className,
java.lang.String method)
|
static void |
endWait(java.lang.String className,
java.lang.String methodName)
|
static java.lang.Iterable<Frame> |
frameList()
|
static long |
getThreadTotalTime(long threadId)
|
static void |
init()
|
static void |
initProfiler()
|
static java.lang.Iterable<Frame> |
interactions(long threadId)
|
void |
run()
ShutdownHook: This will dump the profiling info when the VM shutsdown. |
static void |
setFileName(java.lang.String fileName)
|
static void |
shutdown()
|
static void |
sortFrameList(java.util.Comparator<Frame> comp)
|
static void |
start()
|
static void |
start(java.lang.String className,
java.lang.String methodName)
|
static void |
stop()
|
static java.lang.Iterable<java.lang.Long> |
threads()
|
static void |
unwind(java.lang.String className,
java.lang.String methodName,
java.lang.String exception)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Profile
public Profile()
initProfiler
public static void initProfiler()
init
public static void init()
clear
public static void clear()
start
public static void start()
stop
public static void stop()
setFileName
public static void setFileName(java.lang.String fileName)
shutdown
public static void shutdown()
threads
public static java.lang.Iterable<java.lang.Long> threads()
interactions
public static java.lang.Iterable<Frame> interactions(long threadId)
frameList
public static java.lang.Iterable<Frame> frameList()
allocations
public static java.lang.Iterable<ClassAllocation> allocations()
getThreadTotalTime
public static long getThreadTotalTime(long threadId)
sortFrameList
public static void sortFrameList(java.util.Comparator<Frame> comp)
start
public static void start(java.lang.String className,
java.lang.String methodName)
end
public static void end(java.lang.String className,
java.lang.String method)
beginWait
public static void beginWait(java.lang.String className,
java.lang.String methodName)
endWait
public static void endWait(java.lang.String className,
java.lang.String methodName)
unwind
public static void unwind(java.lang.String className,
java.lang.String methodName,
java.lang.String exception)
alloc
public static void alloc(java.lang.String className)
run
public void run()
- ShutdownHook: This will dump the profiling info when the VM shutsdown.
- Specified by:
run in interface java.lang.Runnable