Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

Prof Class Reference

Main profiler library class. More...

#include <prof.h>

Inheritance diagram for Prof::

IProf List of all members.

Public Methods

virtual ~Prof ()
 Destructor.

void runEvent (JVMPI_Event *event)
 Main fork for all received JVMPI events. More...

ClassgetClass (jobjectID classId, int create=1)
 Returns corresponding Class object. More...

MethodgetMethod (jmethodID methodId, int create=1)
 Returns corresponding Method object. More...

ThreadgetThread (JNIEnv *envId, int create=1)
 Returns corresponding Thread object. More...

AllocTracegetAllocTrace (int numFrames, JVMPI_CallFrame *frames, int create=1)
 Returns corresponding AllocTrace object. More...

AllocObjectgetAllocObject (jobjectID classId, jint isArray, int create=1)
 Returns corresponding AllocObject object. More...

AllocObjectMethodgetAllocObjectMethod (jobjectID classId, jint isArray, jmethodID methodId, int create=1)
 Returns corresponding AllocObjectMethod object. More...

AllocObjectTracegetAllocObjectTrace (jobjectID classId, jint isArray, int numFrames, JVMPI_CallFrame *frames, int create=1)
 Returns corresponding AllocObjectTrace object. More...

AllocThreadMethodgetAllocThreadMethod (JNIEnv *envId, jmethodID methodId, int create=1)
 Returns corresponding AllocThreadMethod object. More...

AllocThreadTracegetAllocThreadTrace (JNIEnv *envId, int numFrames, JVMPI_CallFrame *frames, int create=1)
 Returns corresponding AllocThreadTrace object. More...

AllocThreadObjectgetAllocThreadObject (JNIEnv *envId, jobjectID classId, jint isArray, int create=1)
 Returns corresponding AllocThreadObject object. More...

AllocThreadObjectMethodgetAllocThreadObjectMethod (JNIEnv *envId, jobjectID classId, jint isArray, jmethodID methodId, int create=1)
 Returns corresponding AllocThreadObjectMethod object. More...

AllocThreadObjectTracegetAllocThreadObjectTrace (JNIEnv *envId, jobjectID classId, jint isArray, int numFrames, JVMPI_CallFrame *frames, int create=1)
 Returns corresponding AllocThreadObjectTrace object. More...

CpuTracegetCpuTrace (int numFrames, JVMPI_CallFrame *frames, int create=1)
 Returns corresponding CpuTrace object. More...

CpuThreadMethodgetCpuThreadMethod (JNIEnv *envId, jmethodID methodId, int create=1)
 Returns corresponding CpuThreadMethod object. More...

CpuThreadTracegetCpuThreadTrace (JNIEnv *envId, int numFrames, JVMPI_CallFrame *frames, int create=1)
 Returns corresponding CpuThreadTrace object. More...

MonTracegetMonTrace (int numFrames, JVMPI_CallFrame *frames, int create=1)
 Returns corresponding MonTrace object. More...

MonThreadMethodgetMonThreadMethod (JNIEnv *envId, jmethodID methodId, int create=1)
 Returns corresponding MonThreadMethod object. More...

MonThreadTracegetMonThreadTrace (JNIEnv *envId, int numFrames, JVMPI_CallFrame *frames, int create=1)
 Returns corresponding MonThreadTrace object. More...

virtual void shutdown ()
 Shutdown the JVM. More...

virtual jint isShutdowned ()
 JVM shutdowned. More...

virtual void suspendVM ()
 Suspend JVM. More...

virtual void resumeVM ()
 Resume JVM. More...

virtual void exitVM ()
 Exit JVM. More...

virtual jint getInfo (objectID infoId, eInfoType type, InfoBinaryFormat *&info)
 Get information. More...

virtual jint getData (objectID objId, eDataType type, sData &data)
 Get statistic data. More...

virtual jint getAll (objectID objId, eSeqType what, jint includeInfo, jint optionalArg, seqID &seq)
 Get all objects with all statistic data. More...

virtual jint getChanged (objectID objId, eSeqType what, jint includeInfo, jint optionalArg, seqID &seq)
 Get all objects with changed statistic data. More...

virtual void enableGC ()
 Enable Java garbage collector. More...

virtual void disableGC ()
 Disable Java garbage collector. More...

virtual void runGC ()
 Run Java garbage collector explicitly. More...


Static Public Methods

void dumpError (const char *context, const char *error, const char *file, int line)
 Dumps error. More...

Prof & prof ()
 Returns reference to profiler Prof object. More...

Prof * create (char *options, JVMPI_Interface *jvmpi)
 Creates static instance of Prof class. More...

void destroy ()
 Destroys profiler Prof object. More...

void notifyEvent (JVMPI_Event *event)
 Universal handler for all JVMPI events. More...


Public Attributes

JVMPI_Interface * jvmpiInterface
 pointer to JVMPI interface structure.

Setupsetup
 profiler setup parameters.

Lock gcLock
 Lock for enabling/disabling GC. More...

Lock dataLock
 mutex for profiling data.

List< GroupThread, LI1groupsOfThreads
 list of groups of Java threads.

List< Thread, LI4threads
 Java threads (deactivated ones included).

List< Class, LI2classes
 Java classes (deactivated ones included).

List< AllocObject, LI2allocObjects
 Java object types (deactivated ones included).

List< AllocArena, LI1arenas
 list of Java arenas.

Hash< AllocInstance, jobjectID,
LI1
instances
 Java object instances.

List< AllocInstance, LI1unusedInstances
 unused place used for Java object instances.

Hash< AllocGlobalRef, jobject,
LI1
jniGlobalRefs
 JNI global references to Java objects.

Hash< AllocGlobalRef, jobject,
LI1
jniWeakGlobalRefs
 JNI weak global references to Java objects.

List< GC, LI1gcStat
 garbage collector statistics.

Sampling sampling
 CPU samping.

List< Thread, LI5sampledThreads
 threads to be sampled.

Hash< Class, jobjectID, LI1activeClasses
 hash table of active Java classes.

Hash< Method, jmethodID, LI1activeMethods
 hash table of active Java class methods.

Hash< Thread, JNIEnv *, LI1activeThreads
 hash table of active Java threads.

Hash< AllocObject, AllocObjectKey,
LI1
activeAllocObjects
 hash table of active Java object types.

Hash< AllocTrace, TraceKey,
LI1
activeAllocTraces
 hash table of active AllocTraces.

Hash< AllocObjectMethod, AllocObjectMethodKey,
LI3
activeAllocObjectMethods
 hash table of active AllocObjectMethods.

Hash< AllocObjectTrace, AllocObjectTraceKey,
LI3
activeAllocObjectTraces
 hash table of active AllocObjectTraces.

Hash< AllocThreadMethod, AllocThreadMethodKey,
LI2
activeAllocThreadMethods
 hash table of active AllocThreadMethods.

Hash< AllocThreadTrace, AllocThreadTraceKey,
LI2
activeAllocThreadTraces
 hash table of active AllocThreadTraces.

Hash< AllocThreadObject, AllocThreadObjectKey,
LI3
activeAllocThreadObjects
 hash table of active AllocThreadObjects.

Hash< AllocThreadObjectMethod,
AllocThreadObjectMethodKey,
LI4
activeAllocThreadObjectMethods
 hash table of active AllocThreadObjectMethods.

Hash< AllocThreadObjectTrace,
AllocThreadObjectTraceKey,
LI4
activeAllocThreadObjectTraces
 hash table of active AllocThreadObjectTraces.

Hash< CpuTrace, TraceKey,
LI1
activeCpuTraces
 hash table of active CpuTraces.

Hash< CpuThreadMethod, CpuThreadMethodKey,
LI1
activeCpuThreadMethods
 hash table of active CpuThreadMethods.

Hash< CpuThreadTrace, CpuThreadTraceKey,
LI1
activeCpuThreadTraces
 hash table of active CpuThreadTraces.

Hash< MonTrace, TraceKey,
LI1
activeMonTraces
 hash table of active MonTraces.

Hash< MonThreadMethod, MonThreadMethodKey,
LI1
activeMonThreadMethods
 hash table of active MonThreadMethods.

Hash< MonThreadTrace, MonThreadTraceKey,
LI1
activeMonThreadTraces
 hash table of active MonThreadTraces.

Lock shutdownLock
 lock for waiting in JVMPI_EVENT_SHUTDOWN event handler.


Protected Methods

 Prof (Setup &msetup, JVMPI_Interface *jvmpi)
 Constructor. More...


Private Types

enum  e { TAB_FUNC_SIZE = 40 }
 constants used in Prof class. More...


Private Methods

void event_arenaDelete (JVMPI_Event *event)
 Arena delete. More...

void event_arenaNew (JVMPI_Event *event)
 Arena new. More...

void event_classLoad (JVMPI_Event *event)
 Class load. More...

void event_classUnload (JVMPI_Event *event)
 Class unload. More...

void event_gcStart (JVMPI_Event *event)
 GC start. More...

void event_gcFinish (JVMPI_Event *event)
 GC finish. More...

void event_jniGlobalrefAlloc (JVMPI_Event *event)
 JNI globalref alloc. More...

void event_jniGlobalrefFree (JVMPI_Event *event)
 JNI globalref free. More...

void event_jniWeakGlobalrefAlloc (JVMPI_Event *event)
 JNI weak globalref alloc. More...

void event_jniWeakGlobalrefFree (JVMPI_Event *event)
 JNI weak globalref free. More...

void event_jvmInitDone (JVMPI_Event *event)
 JVM init done. More...

void event_jvmShutDown (JVMPI_Event *event)
 JVM shutdown. More...

void event_methodEntry (JVMPI_Event *event)
 Method entry. More...

void event_methodExit (JVMPI_Event *event)
 Method exit. More...

void event_monitorContendedEnter (JVMPI_Event *event)
 Monitor contended enter. More...

void event_monitorContendedEntered (JVMPI_Event *event)
 Monitor contended entered. More...

void event_monitorWaited (JVMPI_Event *event)
 Monitor waited. More...

void event_objectAlloc (JVMPI_Event *event)
 Object alloc. More...

void event_objectFree (JVMPI_Event *event)
 Object free. More...

void event_objectMove (JVMPI_Event *event)
 Object move. More...

void event_threadStart (JVMPI_Event *event)
 Thread start. More...

void event_threadEnd (JVMPI_Event *event)
 Thread end. More...

objectID getInfoId (IdObject *o, eSeqType seqType)
 Get infoId of an object. More...

sID * copy (sID *dest, IdObject *src, objectID infoId, jint includeInfo)
 Copy data from object. More...

template<class T, class L> void getDataFromList (List< T, L > &list, seqID &seq, int all, eSeqType st, jint includeInfo, jint optionalArg)
 Get data from given list. More...

int getDataFromList_filter (IdObject *o, jint optionalArg)
 Filter useless objects. More...

jint getInfoBinaryFormat (objectID infoId, InfoBinaryFormat *&info, jint &infoType)
 Get information about object. More...


Static Private Methods

void communThreadRoutine (void *)
 Start routine for communication thread. More...


Private Attributes

sF tabFunc [TAB_FUNC_SIZE]
 event handlers table.

int shuttingDown
 indication that VM is shutting down.

int threadsSuspended
 flag if threads are suspended now or not.


Static Private Attributes

int communThreadEnd = 0
 indication if communication thread can be stopped (1).

Prof * _prof = NULL
 the one and only instance of Prof class.


Detailed Description

Main profiler library class.

It encapsulates all used event handlers, implements all necessary methods for proper function of the library. After the start of JVM, static instance of this class is created and initialized (done in JVM_OnLoad() function).

Note: it must be only one instance of this class running !

Author:
Marek Przeczek, Petr Luner

Definition at line 61 of file prof.h.


Member Enumeration Documentation

enum Prof::e [private]
 

constants used in Prof class.

Enumeration values:
TAB_FUNC_SIZE  number of rows in the event handler table.

Reimplemented from IProf.

Definition at line 74 of file prof.h.


Constructor & Destructor Documentation

Prof::Prof Setup   msetup,
JVMPI_Interface *    jvmpi
[protected]
 

Constructor.

The constructor initializes event handlers table with appropriate values ( {event_type, relative_method_pointer} pairs).

Parameters:
msetup  reference to profiler setup
jvmpi  pointer to JVMPI interface

Definition at line 39 of file prof.cpp.

Referenced by create().


Member Function Documentation

void Prof::communThreadRoutine void *    [static, private]
 

Start routine for communication thread.

Parameters:
not  used

Definition at line 119 of file prof.cpp.

Prof::sID * Prof::copy sID *    dest,
IdObject   src,
objectID    infoId,
jint    includeInfo
[private]
 

Copy data from object.

This method copies data from given object to this structure which is used for transfering data thru communication interface.

Parameters:
dest  destination
src  source
infoId  infoId of object
includeInfo  include information about object
Returns:
pointer to destination object

Definition at line 629 of file prof_interface.cpp.

Referenced by getDataFromList().

Prof * Prof::create char *    options,
JVMPI_Interface *    jvmpi
[static]
 

Creates static instance of Prof class.

Parameters:
options  command-line options
jvmpi  pointer to JVMPI interface
Returns:
pointer to newly created object

Definition at line 132 of file prof.cpp.

void Prof::destroy   [static]
 

Destroys profiler Prof object.

It is called from first Allocator being destroyed.

Definition at line 137 of file prof.cpp.

Referenced by event_jvmShutDown().

void Prof::disableGC   [virtual]
 

Disable Java garbage collector.

This method disables Java garbage collector of profiled JVM. Enabling and disabling of GC can be nested ! Methods like suspendVM() or runGC() can not be called when GC is disabled !

See also:
enableGC(), runGC()

Reimplemented from IProf.

Definition at line 1142 of file prof_interface.cpp.

void Prof::dumpError const char *    context,
const char *    error,
const char *    file,
int    line
[static]
 

Dumps error.

Parameters:
context  error context
error  error description
file  source file
line  line number

Definition at line 125 of file prof.cpp.

void Prof::enableGC   [virtual]
 

Enable Java garbage collector.

This method enables Java garbage collector of profiled JVM. Enabling and disabling of GC can be nested !

See also:
disableGC(), runGC()

Reimplemented from IProf.

Definition at line 1135 of file prof_interface.cpp.

void Prof::event_arenaDelete JVMPI_Event *    event [private]
 

Arena delete.

This method is a JVMPI_EVENT_ARENA_DELETE event handler. This event is sent when a heap arena is deleted. All objects residing in this arena are freed. This event is issued in the thread suspended mode. The profiler agent must not make any blocking calls such as entering a monitor or allocating from the C heap. Freed java objects are removed from structures of profiler agent.

Parameters:
event  JVMPI_Event structure describing the event
See also:
runEvent(), JVMPI specification

Definition at line 53 of file prof_arena.cpp.

void Prof::event_arenaNew JVMPI_Event *    event [private]
 

Arena new.

This method is a JVMPI_EVENT_ARENA_NEW event handler. This event is sent when a new arena for allocating objects is created. An information about created arena is stored in structures of profiler agent.

Parameters:
event  JVMPI_Event structure describing the event
See also:
runEvent(), JVMPI specification

Definition at line 41 of file prof_arena.cpp.

void Prof::event_classLoad JVMPI_Event *    event [private]
 

Class load.

This method is a JVMPI_EVENT_CLASS_LOAD event handler. This event is sent when a class is loaded in the VM. This event is issued with GC disabled. GC is re-enabled after this method returns. An information about loaded class is stored in structures of profiler agent.

Parameters:
event  JVMPI_Event structure describing the event
See also:
runEvent(), JVMPI specification

Definition at line 39 of file prof_class.cpp.

void Prof::event_classUnload JVMPI_Event *    event [private]
 

Class unload.

This method is a JVMPI_EVENT_CLASS_UNLOAD event handler. This event is sent when a class is unloaded from VM. This event is issued with GC disabled. GC is re-enabled after this method returns. An information about unloaded class will be noticed to the structures of profiler agent.

Parameters:
event  JVMPI_Event structure describing the event
See also:
runEvent(), JVMPI specification

Definition at line 124 of file prof_class.cpp.

void Prof::event_gcFinish JVMPI_Event *    event [private]
 

GC finish.

This method is a JVMPI_EVENT_GC_FINISH event handler. This event is sent when GC finishes. The system gets back into multi-threaded mode after this event. Profiler agent releases locks grabbed during GC start notification.

Parameters:
event  JVMPI_Event structure describing the event
See also:
runEvent(), JVMPI specification

Definition at line 62 of file prof_gc.cpp.

void Prof::event_gcStart JVMPI_Event *    event [private]
 

GC start.

This method is a JVMPI_EVENT_GC_START event handler. This event is sent when GC is about to start. The system goes into thread suspended mode after this event. Profiler agent grabs locks needed for handling object free, object move and arena delete events.

Parameters:
event  JVMPI_Event structure describing the event
See also:
runEvent(), JVMPI specification

Definition at line 38 of file prof_gc.cpp.

void Prof::event_jniGlobalrefAlloc JVMPI_Event *    event [private]
 

JNI globalref alloc.

This method is a JVMPI_EVENT_JNI_GLOBALREF_ALLOC event handler. This event is sent when a JNI global reference is created. This event is issued with GC disabled. GC is re-enabled after this method returns. An information about created global reference is stored in the structures of profiler agent.

Parameters:
event  JVMPI_Event structure describing the event
See also:
runEvent(), JVMPI specification

Definition at line 40 of file prof_jniref.cpp.

void Prof::event_jniGlobalrefFree JVMPI_Event *    event [private]
 

JNI globalref free.

This method is a JVMPI_EVENT_JNI_GLOBALREF_FREE event handler. This event is sent when a JNI global reference is deleted. An information about freed global reference will be noticed to structures of profiler agent.

Parameters:
event  JVMPI_Event structure describing the event
See also:
runEvent(), JVMPI specification

Definition at line 61 of file prof_jniref.cpp.

void Prof::event_jniWeakGlobalrefAlloc JVMPI_Event *    event [private]
 

JNI weak globalref alloc.

This method is a JVMPI_EVENT_JNI_WEAK_GLOBALREF_ALLOC event handler. This event is sent when a JNI weak global reference is created. This event is issued with GC disabled. GC is re-enabled after this method returns. An information about created weak global reference is stored in the structures of profiler agent.

Parameters:
event  JVMPI_Event structure describing the event
See also:
runEvent(), JVMPI specification

Definition at line 72 of file prof_jniref.cpp.

void Prof::event_jniWeakGlobalrefFree JVMPI_Event *    event [private]
 

JNI weak globalref free.

This method is a JVMPI_EVENT_JNI_WEAK_GLOBALREF_FREE event handler. This event is sent when a JNI weak global reference is deleted. An information about freed weak global reference will be noticed to structures of profiler agent.

Parameters:
event  JVMPI_Event structure describing the event
See also:
runEvent(), JVMPI specification

Definition at line 93 of file prof_jniref.cpp.

void Prof::event_jvmInitDone JVMPI_Event *    event [private]
 

JVM init done.

This method is a JVMPI_EVENT_JVM_INIT_DONE event handler. This event is sent by the VM when its initialization is done. It is safe to call CreateSystemThread() routine only after this event is notified.

Parameters:
event  not used
See also:
runEvent(), JVMPI specification

Definition at line 434 of file prof_jvm.cpp.

void Prof::event_jvmShutDown JVMPI_Event *    event [private]
 

JVM shutdown.

This method is a JVMPI_EVENT_SHUT_DOWN event handler. This event is sent by the VM when it is shutting down. Profiler agent will save the profiling data.

Parameters:
event  not used
See also:
runEvent(), JVMPI specification

Definition at line 453 of file prof_jvm.cpp.

void Prof::event_methodEntry JVMPI_Event *    event [private]
 

Method entry.

This method is a JVMPI_EVENT_METHOD_ENTRY event handler. This event is sent when a method is entered by a thread. Here just the time of the method entrance recorded.

Parameters:
event  JVMPI_Event structure describing the event
See also:
runEvent(), JVMPI specification

Definition at line 41 of file prof_method.cpp.

void Prof::event_methodExit JVMPI_Event *    event [private]
 

Method exit.

This method is a JVMPI_EVENT_METHOD_EXIT event handler. This event is sent when a thread exits a method. Here the time consumed by the method is billed and recorded to appropriate structures.

Parameters:
event  JVMPI_Event structure describing the event
See also:
runEvent(), JVMPI specification

Definition at line 81 of file prof_method.cpp.

void Prof::event_monitorContendedEnter JVMPI_Event *    event [private]
 

Monitor contended enter.

This method is a JVMPI_EVENT_MONITOR_CONTENDED_ENTER event handler. This event is sent when a thread is attemping to enter a Java monitor already acquired by another thread. It is issued with GC disabled. GC is re-enabled after this method returns. Here only the current time before the thread starts waiting on the monitor is recorded.

Parameters:
event  JVMPI_Event structure describing the event
See also:
runEvent(), JVMPI specification

Definition at line 42 of file prof_monitor.cpp.

void Prof::event_monitorContendedEntered JVMPI_Event *    event [private]
 

Monitor contended entered.

This method is a JVMPI_EVENT_MONITOR_CONTENDED_ENTERED event handler. This event is sent when a thread enters a Java monitor after waiting for it to be released by another thread. It is issued with GC disabled. GC is re-enabled after this method returns. Here the total time the thread spent by waiting on the monitor is determined and recorded to appriate structures.

Parameters:
event  JVMPI_Event structure describing the event
See also:
runEvent(), JVMPI specification

Definition at line 66 of file prof_monitor.cpp.

void Prof::event_monitorWaited JVMPI_Event *    event [private]
 

Monitor waited.

This method is a JVMPI_EVENT_MONITOR_WAITED event handler. This event is sent when a thread finishes waiting on an object. It is issued with GC disabled. GC is re-enabled after this method returns. Here the total time the thread has waited is recored to appropriate structures.

Parameters:
event  JVMPI_Event structure describing the event
See also:
runEvent(), JVMPI specification

Definition at line 143 of file prof_monitor.cpp.

void Prof::event_objectAlloc JVMPI_Event *    event [private]
 

Object alloc.

This method is a JVMPI_EVENT_OBJECT_ALLOC event handler. This event is sent when an object is allocated. This event is issued with GC disabled. GC is re-enabled after this method returns. An information about new allocated object is stored in the structures of profiler agent.

Parameters:
event  JVMPI_Event structure describing the event
See also:
runEvent(), JVMPI specification

Definition at line 46 of file prof_object.cpp.

void Prof::event_objectFree JVMPI_Event *    event [private]
 

Object free.

This method is a JVMPI_EVENT_OBJECT_FREE event handler. This event is sent when an object is freed. This event is issued in the thread suspended mode. The profiler agent must not make any blocking calls such as entering a monitor or allocating from a C heap. An information about freed object will be noticed to the structures of profiler agent.

Parameters:
event  JVMPI_Event structure describing the event
See also:
runEvent(), JVMPI specification

Definition at line 175 of file prof_object.cpp.

void Prof::event_objectMove JVMPI_Event *    event [private]
 

Object move.

This method is a JVMPI_EVENT_OBJECT_MOVE event handler. This event is sent when an object is moved in the heap. This event is issued in the thread suspended mode. The profiler agent must not make any blocking calls such as entering a monitor or allocating from the C heap. An information about moved object will be changed in the structures of profiler agent.

Parameters:
event  JVMPI_Event structure describing the event
See also:
runEvent(), JVMPI specification

Definition at line 190 of file prof_object.cpp.

void Prof::event_threadEnd JVMPI_Event *    event [private]
 

Thread end.

This method is a JVMPI_EVENT_THREAD_END event handler. This event is sent when a thread ends in the VM. An information about that will be noticed to the structures of the profiler agent.

Parameters:
event  JVMPI_Event structure describing the event
See also:
runEvent(), JVMPI specification

Definition at line 115 of file prof_thread.cpp.

void Prof::event_threadStart JVMPI_Event *    event [private]
 

Thread start.

This method is a JVMPI_EVENT_THREAD_START event handler. This event is sent when a thread is started in the VM. This event is issued with GC disabled. GC is re-enabled after this method returns. An information about started thread is stored in the structures of profiler agent.

Parameters:
event  JVMPI_Event structure describing the event
See also:
runEvent(), JVMPI specification

Definition at line 61 of file prof_thread.cpp.

void Prof::exitVM   [virtual]
 

Exit JVM.

This method exits running (or shutting down) profiled JVM. Profiled JVM is stopped immediatelly. Client looses connection with it.

See also:
shutdown()

Reimplemented from IProf.

Definition at line 118 of file prof_interface.cpp.

virtual jint Prof::getAll objectID    objId,
eSeqType    what,
jint    includeInfo,
jint    optionalArg,
seqID   seq
[inline, virtual]
 

Get all objects with all statistic data.

This method returns all statistic data of all objects of specified type. New objects (just created) are returned, too. The output is stored to "seq" sequence. If an error occurres, returned value is less than 0.

An example: if "objId" is a method identifier, "what" is ALLOC_METHOD_TRACES, then "seq" will contain all traces of specified method.

Parameters:
objId  identifier of object having a data
what  specified action
includeInfo  include information about object
optionalArg  optional argument (depends on type of data)
seq  output sequence
Returns:
>=0 length of output sequence; RC_BAD_OBJ_ID (bad ID); RC_BAD_COMMAND (command unknown or not allowed)
See also:
getInfo(), getData(), getChanged()

Reimplemented from IProf.

Definition at line 887 of file prof.h.

AllocObject * Prof::getAllocObject jobjectID    classId,
jint    isArray,
int    create = 1
 

Returns corresponding AllocObject object.

If none exists and the 'create' flag is set to 1 the function attempts to construct one. If unsuccessful in either case the NULL is returned.

Parameters:
classId  class ID
isArray  is array?
create  creation flag
Returns:
pointer to AllocObject object or NULL

Definition at line 182 of file prof_get.cpp.

Referenced by event_objectAlloc(), getAllocObjectMethod(), and getAllocThreadObject().

AllocObjectMethod * Prof::getAllocObjectMethod jobjectID    classId,
jint    isArray,
jmethodID    methodId,
int    create = 1
 

Returns corresponding AllocObjectMethod object.

If none exists and the 'create' flag is set to 1 the function attempts to construct one. If unsuccessful in either case the NULL is returned.

Parameters:
classId  class ID
isArray  is array?
methodId  method ID
create  creation flag
Returns:
pointer to AllocObjectMethod object or NULL

Definition at line 213 of file prof_get.cpp.

Referenced by event_objectAlloc(), getAllocObjectTrace(), and getAllocThreadObjectMethod().

AllocObjectTrace * Prof::getAllocObjectTrace jobjectID    classId,
jint    isArray,
int    numFrames,
JVMPI_CallFrame *    frames,
int    create = 1
 

Returns corresponding AllocObjectTrace object.

If none exists and the 'create' flag is set to 1 the function attempts to construct one. If unsuccessful in either case the NULL is returned.

Parameters:
classId  class ID
isArray  is array?
numFrames  number of call frames
frames  array of call frames
create  creation flag
Returns:
pointer to AllocObjectTrace object or NULL

Definition at line 243 of file prof_get.cpp.

Referenced by event_objectAlloc(), and getAllocThreadObjectTrace().

AllocThreadMethod * Prof::getAllocThreadMethod JNIEnv *    envId,
jmethodID    methodId,
int    create = 1
 

Returns corresponding AllocThreadMethod object.

If none exists and the 'create' flag is set to 1 the function attempts to construct one. If unsuccessful in either case the NULL is returned.

Parameters:
envId  thread ID
methodId  method ID
create  creation flag
Returns:
pointer to AllocThreadMethod object or NULL

Definition at line 274 of file prof_get.cpp.

Referenced by getAllocThreadObjectMethod(), and getAllocThreadTrace().

AllocThreadObject * Prof::getAllocThreadObject JNIEnv *    envId,
jobjectID    classId,
jint    isArray,
int    create = 1
 

Returns corresponding AllocThreadObject object.

If none exists and the 'create' flag is set to 1 the function attempts to construct one. If unsuccessful in either case the NULL is returned.

Parameters:
envId  thread ID
classId  class ID
isArray  is array?
create  creation flag
Returns:
pointer to AllocThreadObject object or NULL

Definition at line 333 of file prof_get.cpp.

Referenced by event_objectAlloc(), and getAllocThreadObjectMethod().

AllocThreadObjectMethod * Prof::getAllocThreadObjectMethod JNIEnv *    envId,
jobjectID    classId,
jint    isArray,
jmethodID    methodId,
int    create = 1
 

Returns corresponding AllocThreadObjectMethod object.

If none exists and the 'create' flag is set to 1 the function attempts to construct one. If unsuccessful in either case the NULL is returned.

Parameters:
envId  thread ID
classId  class ID
isArray  is array?
methodId  method ID
create  creation flag
Returns:
pointer to AllocThreadObjectMethod object or NULL

Definition at line 363 of file prof_get.cpp.

Referenced by event_objectAlloc(), and getAllocThreadObjectTrace().

AllocThreadObjectTrace * Prof::getAllocThreadObjectTrace JNIEnv *    envId,
jobjectID    classId,
jint    isArray,
int    numFrames,
JVMPI_CallFrame *    frames,
int    create = 1
 

Returns corresponding AllocThreadObjectTrace object.

If none exists and the 'create' flag is set to 1 the function attempts to construct one. If unsuccessful in either case the NULL is returned.

Parameters:
envId  thread ID
classId  class ID
isArray  is array?
numFrames  number of call frames
frames  array of call frames
create  creation flag
Returns:
pointer to AllocThreadObjectTrace object or NULL

Definition at line 398 of file prof_get.cpp.

Referenced by event_objectAlloc().

AllocThreadTrace * Prof::getAllocThreadTrace JNIEnv *    envId,
int    numFrames,
JVMPI_CallFrame *    frames,
int    create = 1
 

Returns corresponding AllocThreadTrace object.

If none exists and the 'create' flag is set to 1 the function attempts to construct one. If unsuccessful in either case the NULL is returned.

Parameters:
envId  thread ID
numFrames  number of call frames
frames  array of call frames
create  creation flag
Returns:
pointer to AllocThreadTrace object or NULL

Definition at line 303 of file prof_get.cpp.

Referenced by getAllocThreadObjectTrace().

AllocTrace * Prof::getAllocTrace int    numFrames,
JVMPI_CallFrame *    frames,
int    create = 1
 

Returns corresponding AllocTrace object.

If none exists and the 'create' flag is set to 1 the function attempts to construct one. If unsuccessful in either case the NULL is returned.

Parameters:
numFrames  number of call frames
frames  array of call frames
create  creation flag
Returns:
pointer to AllocTrace object or NULL

Definition at line 147 of file prof_get.cpp.

Referenced by getAllocObjectTrace(), and getAllocThreadTrace().

virtual jint Prof::getChanged objectID    objId,
eSeqType    what,
jint    includeInfo,
jint    optionalArg,
seqID   seq
[inline, virtual]
 

Get all objects with changed statistic data.

This method returns all statistic data of all objects of specified type, which have changed since last call of this method (or getAll() method). New objects (just created) are returned, too. The output is stored to "seq" sequence. If an error occurres, returned value is less than 0.

Parameters:
objId  identifier of object having a data
what  specified action
includeInfo  include information about object
optionalArg  optional argument (depends on type of data)
seq  output sequence
Returns:
>=0 length of output sequence; RC_BAD_OBJ_ID (bad ID); RC_BAD_COMMAND (command unknown or not allowed)
See also:
getInfo(), getData(), getAll()

Reimplemented from IProf.

Definition at line 914 of file prof.h.

Class* Prof::getClass jobjectID    classId,
int    create = 1
[inline]
 

Returns corresponding Class object.

If none exists and the 'create' flag is set to 1 the function attempts to construct one. If unsuccessful in either case the NULL is returned.

Parameters:
classId  class ID
create  creation flag
Returns:
pointer to Class object or NULL

Definition at line 236 of file prof.h.

Referenced by event_classUnload(), and getAllocObject().

CpuThreadMethod * Prof::getCpuThreadMethod JNIEnv *    envId,
jmethodID    methodId,
int    create = 1
 

Returns corresponding CpuThreadMethod object.

If none exists and the 'create' flag is set to 1 the function attempts to construct one. If unsuccessful in either case the NULL is returned.

Parameters:
envId  thread ID
methodId  method ID
create  creation flag
Returns:
pointer to CpuThreadMethod object or NULL

Definition at line 88 of file prof_get.cpp.

Referenced by Sampling::doOneSample(), event_methodExit(), and getCpuThreadTrace().

CpuThreadTrace * Prof::getCpuThreadTrace JNIEnv *    envId,
int    numFrames,
JVMPI_CallFrame *    frames,
int    create = 1
 

Returns corresponding CpuThreadTrace object.

If none exists and the 'create' flag is set to 1 the function attempts to construct one. If unsuccessful in either case the NULL is returned.

Parameters:
envId  thread ID
numFrames  number of call frames
frames  array of call frames
create  creation flag
Returns:
pointer to CpuThreadTrace object or NULL

Definition at line 117 of file prof_get.cpp.

Referenced by Sampling::doOneSample(), and event_methodExit().

CpuTrace * Prof::getCpuTrace int    numFrames,
JVMPI_CallFrame *    frames,
int    create = 1
 

Returns corresponding CpuTrace object.

If none exists and the 'create' flag is set to 1 the function attempts to construct one. If unsuccessful in either case the NULL is returned.

Parameters:
numFrames  number of call frames
frames  array of call frames
create  creation flag
Returns:
pointer to CpuTrace object or NULL

Definition at line 53 of file prof_get.cpp.

Referenced by Sampling::doOneSample(), event_methodExit(), and getCpuThreadTrace().

jint Prof::getData objectID    objId,
eDataType    type,
sData &    data
[virtual]
 

Get statistic data.

This method returns statistic data of the given object. Data is returned to "data" structure.

Parameters:
objId  identifier of object having data
type  type of data
data  output structure
Returns:
RC_OK (ok); RC_BAD_OBJ_ID (bad ID); RC_BAD_DATA_TYPE (bad type)
See also:
getInfo(), getAll(), getChanged()

Reimplemented from IProf.

Definition at line 187 of file prof_interface.cpp.

template<class T, class L>
void Prof::getDataFromList List< T, L > &    list,
seqID   seq,
int    all,
eSeqType    st,
jint    includeInfo,
jint    optionalArg
[inline, private]
 

Get data from given list.

This function template is used to grab data from given list of objects to special sID structure (seqID sequence) which is used by IProf class to transfer data between library and Java.

Parameters:
list  reference to list of objects (in)
seq  reference to output sequence (out)
all  1 = all objects; 0 = changed objects only
st  sequence type (see IProf::eSeqType)
includeInfo  include information about object
optionalArg  optional argument (depends on type of object)
See also:
getDataFromList_filter()

Definition at line 1002 of file prof.h.

int Prof::getDataFromList_filter IdObject   o,
jint    optionalArg
[private]
 

Filter useless objects.

This method is used by getDataFromList() template to filter some useless objects which are unimportant for client's statistics. The client can specify special 'optionalArg' while calling IProf::getChanged() or IProf::getAll() method. This argument is dependent on type of object and its statistic information. Eg. for cpu traces this argument means number of hits, so only traces hitted more than or equal to the optionalArg's value are sent to client.

Parameters:
o  pointer to object
optionalArg  optional argument (depends on type of object)
Returns:
0 (false - filter); 1 (true - do not filter)
See also:
getDataFromList()

Definition at line 1044 of file prof_interface.cpp.

Referenced by getDataFromList().

jint Prof::getInfo objectID    infoId,
eInfoType    type,
InfoBinaryFormat *&    info
[virtual]
 

Get information.

This method returns information about required object specified by "infoId" and "type". Information is returned to "info" (pointer to existing structure is returned).

Parameters:
infoId  identifier of object having an information
type  type of information
info  pointer to output structure
Returns:
RC_OK (ok); RC_BAD_INFO_ID (bad ID); RC_BAD_INFO_TYPE (bad type)
See also:
getData(), getAll(), getChanged()

Reimplemented from IProf.

Definition at line 123 of file prof_interface.cpp.

jint Prof::getInfoBinaryFormat objectID    infoId,
InfoBinaryFormat *&    info,
jint &    infoType
[private]
 

Get information about object.

This method returns information in binary format (and type of information) about an object with given 'infoId' identifier.

Parameters:
infoId  ID of object where info is stored
info  reference to place where to store pointer to info data
infoType  where to store type of information
Returns:
0 (failed); 1 (ok)

Definition at line 948 of file prof_interface.cpp.

Referenced by copy().

IProf::objectID Prof::getInfoId IdObject   o,
eSeqType    seqType
[private]
 

Get infoId of an object.

This method returns infoId of an object according to seqType value. InfoId is an identifier (mostly) of another object which holds information about this given object. It is internally used by Prof::copy() method. Don't use it anywhere else.

Parameters:
o  object
seqType  sequence type (which an object is part of)
Returns:
infoId value of the object

Definition at line 820 of file prof_interface.cpp.

Referenced by getDataFromList().

Method* Prof::getMethod jmethodID    methodId,
int    create = 1
[inline]
 

Returns corresponding Method object.

If none exists and the 'create' flag is set to 1 the function attempts to construct one. If unsuccessful in either case the NULL is returned.

Parameters:
methodId  method ID
create  creation flag
Returns:
pointer to Method object or NULL

Definition at line 251 of file prof.h.

Referenced by Sampling::doOneSample(), event_methodExit(), event_monitorContendedEntered(), event_monitorWaited(), getAllocObjectMethod(), getAllocThreadMethod(), getAllocTrace(), getCpuThreadMethod(), getCpuTrace(), getMonThreadMethod(), and getMonTrace().

MonThreadMethod * Prof::getMonThreadMethod JNIEnv *    envId,
jmethodID    methodId,
int    create = 1
 

Returns corresponding MonThreadMethod object.

If none exists and the 'create' flag is set to 1 the function attempts to construct one. If unsuccessful in either case the NULL is returned.

Parameters:
envId  thread ID
methodId  method ID
create  creation flag
Returns:
pointer to MonThreadMethod object or NULL

Definition at line 469 of file prof_get.cpp.

Referenced by event_monitorContendedEntered(), event_monitorWaited(), and getMonThreadTrace().

MonThreadTrace * Prof::getMonThreadTrace JNIEnv *    envId,
int    numFrames,
JVMPI_CallFrame *    frames,
int    create = 1
 

Returns corresponding MonThreadTrace object.

If none exists and the 'create' flag is set to 1 the function attempts to construct one. If unsuccessful in either case the NULL is returned.

Parameters:
envId  thread ID
numFrames  number of call frames
frames  array of call frames
create  creation flag
Returns:
pointer to MonThreadTrace object or NULL

Definition at line 498 of file prof_get.cpp.

Referenced by event_monitorContendedEntered(), and event_monitorWaited().

MonTrace * Prof::getMonTrace int    numFrames,
JVMPI_CallFrame *    frames,
int    create = 1
 

Returns corresponding MonTrace object.

If none exists and the 'create' flag is set to 1 the function attempts to construct one. If unsuccessful in either case the NULL is returned.

Parameters:
numFrames  number of call frames
frames  array of call frames
create  creation flag
Returns:
pointer to MonTrace object or NULL

Definition at line 434 of file prof_get.cpp.

Referenced by event_monitorContendedEntered(), event_monitorWaited(), and getMonThreadTrace().

Thread* Prof::getThread JNIEnv *    envId,
int    create = 1
[inline]
 

Returns corresponding Thread object.

If none exists and the 'create' flag is set to 1 the function attempts to construct one. If unsuccessful in either case the NULL is returned.

Parameters:
envId  thread ID
create  creation flag
Returns:
pointer to Thread object or NULL

Definition at line 266 of file prof.h.

Referenced by event_methodEntry(), event_methodExit(), event_monitorContendedEnter(), event_monitorContendedEntered(), event_monitorWaited(), event_threadEnd(), getAllocThreadMethod(), getAllocThreadObject(), getCpuThreadMethod(), and getMonThreadMethod().

jint Prof::isShutdowned   [virtual]
 

JVM shutdowned.

This method checks if profiled JVM is shutting down. So, it means, the JVM will be no longer running, the JVMPI_EVENT_JVM_SHUTDOWN event was received and profiler dynamic library waits in JVMPI_EVENT_JVM_SHUTDOWN event handler. The client can now gain any necessary data before calling the shutdown() method which shutdowns JVM definitelly.

Returns:
1 (JVM is shutting down); 0 (still running, normal operation)
See also:
shutdown(), exitVM()

Reimplemented from IProf.

Definition at line 69 of file prof_interface.cpp.

void Prof::notifyEvent JVMPI_Event *    event [inline, static]
 

Universal handler for all JVMPI events.

JVM calls this function for each event it propagates.

Note: the event must be enabled to make this function be called for it.

Parameters:
event  pointer to JVMPI_Event structure holding the event data
See also:
JVM_OnLoad(), JVMPI specification

Definition at line 1105 of file prof.h.

Prof& Prof::prof   [inline, static]
 

Returns reference to profiler Prof object.

Returns:
reference to Prof object

Definition at line 1080 of file prof.h.

Referenced by Lock::Lock(), Thread::deactivate(), MonTrace::deactivate(), MonThreadTrace::deactivate(), MonThreadMethod::deactivate(), Method::deactivate(), CpuTrace::deactivate(), CpuThreadTrace::deactivate(), CpuThreadMethod::deactivate(), Class::deactivate(), AllocTrace::deactivate(), AllocThreadTrace::deactivate(), AllocThreadObjectTrace::deactivate(), AllocThreadObjectMethod::deactivate(), AllocThreadObject::deactivate(), AllocThreadMethod::deactivate(), AllocObjectTrace::deactivate(), AllocObjectMethod::deactivate(), AllocObject::deactivate(), Sampling::doOneSample(), Sampling::main(), Lock::release(), Sampling::samplingMain(), Sampling::startThread(), and Lock::wait().

void Prof::resumeVM   [virtual]
 

Resume JVM.

This method resumes suspended profiled JVM. Resumed (running) JVM can be then suspended again by suspendVM() call.

See also:
suspendVM()

Reimplemented from IProf.

Definition at line 97 of file prof_interface.cpp.

void Prof::runEvent JVMPI_Event *    event
 

Main fork for all received JVMPI events.

For each event received by profiler library, the profNotifyEvent() function is called. This one calls profiler static Prof class instance's runEvent() method, which looks for appropriate event_type in tabFunc event handlers table and calls appropriate event handler for it.

Parameters:
event  pointer to JVMPI_Event structure holding event data
See also:
profNotifyEvent(), Prof, tabFunc

Definition at line 103 of file prof.cpp.

Referenced by notifyEvent().

void Prof::runGC   [virtual]
 

Run Java garbage collector explicitly.

This method runs Java garbage collector inside profiled JVM. It can only be called when GC is enabled.

See also:
enableGC(), disableGC()

Reimplemented from IProf.

Definition at line 1153 of file prof_interface.cpp.

void Prof::shutdown   [virtual]
 

Shutdown the JVM.

This method shuts profiled JVM down. When profiled JVM is ending, it sends the JVMPI_EVENT_JVM_SHUTDOWN event to profiler dynamic library. Then the library waits in JVMPI_EVENT_JVM_SHUTDOWN event handler until the client calls this method. The goal is the client can make any necessary calls to gain data before profiled JVM really shutdowns (so before client's shutdown() call).

Note: this method doesn't stop running JVM, to stop running JVM, use exitVM() method instead.

See also:
isShutdowned(), exitVM(), JVMPI specification

Reimplemented from IProf.

Definition at line 60 of file prof_interface.cpp.

void Prof::suspendVM   [virtual]
 

Suspend JVM.

This method suspends running profiled JVM. Suspended JVM can be then resumed by resumeVM() call.

See also:
resumeVM()

Reimplemented from IProf.

Definition at line 74 of file prof_interface.cpp.


Member Data Documentation

Lock Prof::gcLock
 

Lock for enabling/disabling GC.

Following locking order must be obeyed: gcLock -> DisableGC -> dataLock

See also:
dataLock

Definition at line 101 of file prof.h.

Referenced by Sampling::main().


The documentation for this class was generated from the following files:
Generated on Mon Jan 28 14:53:29 2002 for Java Profiler Dynamic Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001