From: Marek P. <ma...@us...> - 2001-09-18 22:19:32
|
Update of /cvsroot/javaprofiler/library/src/prof In directory usw-pr-cvs1:/tmp/cvs-serv18629/src/prof Modified Files: prof.cpp prof.h prof_jvm.cpp Log Message: changes in doc Index: prof.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -r1.24 -r1.25 *** prof.cpp 2001/09/02 20:14:22 1.24 --- prof.cpp 2001/09/18 22:19:28 1.25 *************** *** 110,115 **** void Prof::communThreadRoutine( void*) { ! prof().shutdownLock.wait(); ! while( !communThreadEnd) prof().run(); } --- 110,115 ---- void Prof::communThreadRoutine( void*) { ! _prof->shutdownLock.wait(); ! while( !communThreadEnd) _prof->run(); } *************** *** 117,119 **** --- 117,141 ---- cerr << "PROF ERROR (" << file << ", " << line << ") : " << context << " - " << error << endl; + } + + Prof* Prof::_prof = NULL; + + Prof& Prof::prof() { return *_prof;} + + Prof* Prof::create( char* options) { + + return (_prof = new Prof( *(new Setup( options)))); + } + + void Prof::destroy() { + + Prof* p = _prof; + _prof = NULL; + + if( p) delete p; + } + + void Prof::notifyEvent( JVMPI_Event* event) { + + if( _prof) _prof->runEvent( event); } Index: prof.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof.h,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -r1.35 -r1.36 *** prof.h 2001/09/02 20:14:22 1.35 --- prof.h 2001/09/18 22:19:29 1.36 *************** *** 968,971 **** --- 968,1006 ---- const char* file, int line); + + private: + + /// the one and only instance of Prof class + static Prof* _prof; + + public: + + /** Returns reference to profiler Prof object. + ** + ** @return reference to Prof object */ + + static Prof& prof(); + + /** Creates static instance of Prof class. + ** + ** @return pointer to newly created object */ + + static Prof* create( char* options); + + /** Destroys profiler Prof object. It is called + ** from first Allocator being destroyed. */ + + static void destroy(); + + /** 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. + ** + ** @param event pointer to JVMPI_Event structure holding the event data + ** + ** @see JVM_OnLoad(), JVMPI specification */ + + static void notifyEvent( JVMPI_Event* event); }; Index: prof_jvm.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_jvm.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -r1.21 -r1.22 *** prof_jvm.cpp 2001/09/02 20:14:22 1.21 --- prof_jvm.cpp 2001/09/18 22:19:29 1.22 *************** *** 36,40 **** #ifdef _DEBUG ! int printMethod( Method* m, void**) { cout << m->methodName << " SIGN = " << m->methodSignature << endl; --- 36,40 ---- #ifdef _DEBUG ! static int printMethod( Method* m, void**) { cout << m->methodName << " SIGN = " << m->methodSignature << endl; *************** *** 43,47 **** } ! int printField( ClassField* f, void**) { cout << f->fieldName << " SIGN = " << f->fieldSignature << endl; --- 43,47 ---- } ! static int printField( ClassField* f, void**) { cout << f->fieldName << " SIGN = " << f->fieldSignature << endl; *************** *** 50,54 **** } ! int printClass( Class* c, void**) { cout << "CLASS = " << c->className << endl << endl; --- 50,54 ---- } ! static int printClass( Class* c, void**) { cout << "CLASS = " << c->className << endl << endl; *************** *** 69,73 **** } ! int printThread( Thread* t, void**) { cout << t->threadName << " : " << (long)(t->threadEnvId) << endl; --- 69,73 ---- } ! static int printThread( Thread* t, void**) { cout << t->threadName << " : " << (long)(t->threadEnvId) << endl; *************** *** 76,80 **** } ! int printGroup( GroupThread* g, void**) { cout << "GROUP = " << g->groupName << endl; --- 76,80 ---- } ! static int printGroup( GroupThread* g, void**) { cout << "GROUP = " << g->groupName << endl; *************** *** 85,89 **** } ! int printArena( AllocArena* a, void**) { cout << "ARENA = " << a->arenaName << endl << endl; --- 85,89 ---- } ! static int printArena( AllocArena* a, void**) { cout << "ARENA = " << a->arenaName << endl << endl; *************** *** 92,96 **** } ! int printObject( AllocObject* o, void**) { cout << "OBJECT TYPE:" << endl; --- 92,96 ---- } ! static int printObject( AllocObject* o, void**) { cout << "OBJECT TYPE:" << endl; *************** *** 137,141 **** } ! int printAllocTrace( AllocTrace* at, void**) { cout << "ALLOC_TRACE:" << endl; --- 137,141 ---- } ! static int printAllocTrace( AllocTrace* at, void**) { cout << "ALLOC_TRACE:" << endl; *************** *** 151,155 **** } ! int printInstance( AllocInstance* ins, void**) { cout << "INSTANCE:" << endl; --- 151,155 ---- } ! static int printInstance( AllocInstance* ins, void**) { cout << "INSTANCE:" << endl; *************** *** 161,165 **** } ! int printGC( GC* gc, void**) { cout << "GC:" << endl; --- 161,165 ---- } ! static int printGC( GC* gc, void**) { cout << "GC:" << endl; *************** *** 171,175 **** } ! int printGlobalRefs( AllocGlobalRef* r, void**) { cout << "JNI (WEAK) GLOBALREF:" << endl; --- 171,175 ---- } ! static int printGlobalRefs( AllocGlobalRef* r, void**) { cout << "JNI (WEAK) GLOBALREF:" << endl; *************** *** 181,187 **** } ! void printHashStatistics() { ! Prof* _prof = &prof(); cout << "HASH TABLE STATISTICS:" << endl; --- 181,187 ---- } ! static void printHashStatistics() { ! Prof* _prof = &Prof::prof(); cout << "HASH TABLE STATISTICS:" << endl; *************** *** 213,219 **** } ! void printTotals() { ! Prof* _prof = &prof(); long totalClasses = 0; --- 213,219 ---- } ! static void printTotals() { ! Prof* _prof = &Prof::prof(); long totalClasses = 0; *************** *** 400,408 **** } ! void printSampling() { ! unsigned long start = prof().sampling.start; ! unsigned long finish = prof().sampling.finish; ! unsigned long samples = prof().sampling.samples; cout << "SAMPLING:" << endl << endl; --- 400,408 ---- } ! static void printSampling() { ! unsigned long start = Prof::prof().sampling.start; ! unsigned long finish = Prof::prof().sampling.finish; ! unsigned long samples = Prof::prof().sampling.samples; cout << "SAMPLING:" << endl << endl; *************** *** 464,468 **** #endif ! destroyProf(); exit( 0); } --- 464,468 ---- #endif ! Prof::destroy(); exit( 0); } |