You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(73) |
Sep
(92) |
Oct
(9) |
Nov
(80) |
Dec
(60) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(92) |
Feb
(52) |
Mar
(71) |
Apr
(64) |
May
(53) |
Jun
(10) |
Jul
(111) |
Aug
(93) |
Sep
(134) |
Oct
|
Nov
|
Dec
|
From: Marek P. <ma...@us...> - 2001-11-21 22:47:25
|
Update of /cvsroot/javaprofiler/library/demo/02 In directory usw-pr-cvs1:/tmp/cvs-serv17565/demo/02 Modified Files: README Log Message: Index: README =================================================================== RCS file: /cvsroot/javaprofiler/library/demo/02/README,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** README 2001/11/21 22:31:52 1.1 --- README 2001/11/21 22:47:16 1.2 *************** *** 1,4 **** Same demo program as in 01/ subdirectory. The difference is in how information ! about classes and methods are sent. In previous example (01), information about specific object (eg. class name, method name etc. not statistic data) was requested by special IProf::getInfo() method, which is a bit slow if you --- 1,4 ---- Same demo program as in 01/ subdirectory. The difference is in how information ! about classes and methods is sent. In previous example (01), information about specific object (eg. class name, method name etc. not statistic data) was requested by special IProf::getInfo() method, which is a bit slow if you |
From: Marek P. <ma...@us...> - 2001-11-21 22:32:22
|
Update of /cvsroot/javaprofiler/library/src/setup In directory usw-pr-cvs1:/tmp/cvs-serv12170/src/setup Modified Files: Makefile.rules dir.info setup.cpp setup.h Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux Index: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/src/setup/Makefile.rules,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Makefile.rules 2001/07/26 22:44:10 1.1 --- Makefile.rules 2001/11/21 22:31:49 1.2 *************** *** 1,3 **** setup.o \ ! setup.obj: setup.cpp ../main/includes.h $(CCC) $(CPPFLAGS) setup.cpp --- 1,3 ---- setup.o \ ! setup.obj: setup.cpp $(CCC) $(CPPFLAGS) setup.cpp Index: dir.info =================================================================== RCS file: /cvsroot/javaprofiler/library/src/setup/dir.info,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** dir.info 2001/07/26 22:44:10 1.1 --- dir.info 2001/11/21 22:31:49 1.2 *************** *** 1,3 **** FILES = setup - CLEAN_FILES = *.pdb *.obj *.o --- 1,2 ---- Index: setup.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/setup/setup.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** setup.cpp 2001/09/02 20:14:22 1.6 --- setup.cpp 2001/11/21 22:31:49 1.7 *************** *** 33,37 **** */ ! #include "../main/includes.h" Setup::Setup( char* options) { --- 33,38 ---- */ ! #include "../setup/setup.h" ! #include "../main/const.h" Setup::Setup( char* options) { *************** *** 230,235 **** if( !strcmp( name, "commun_type")) { ! if( !strcmp( value, "socket")) com.communType = IProf::COMMUN_SOCKET; ! else if( !strcmp( value, "shmem")) com.communType = IProf::COMMUN_SHMEM; return; --- 231,236 ---- if( !strcmp( name, "commun_type")) { ! if( !strcmp( value, "socket")) com.communType = COMMUN_SOCKET; ! else if( !strcmp( value, "shmem")) com.communType = COMMUN_SHMEM; return; Index: setup.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/setup/setup.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** setup.h 2001/09/23 16:50:15 1.9 --- setup.h 2001/11/21 22:31:49 1.10 *************** *** 36,39 **** --- 36,42 ---- #define _SETUP_H_ + #include "../main/includes.h" + #include "../string/string.h" + /** Profiler setup parameters. ** The parameters are obtained from command line during *************** *** 45,50 **** public: /// profiling granularity levels ! enum LEVEL { LEVEL_OBJECT, --- 48,73 ---- public: + /// constants + enum e { + + /// default TCP port + COMMUN_PORT = 25595, + + /// default shared memory size (in bytes) + COMMUN_SHMEM_SIZE = 256*1024 + }; + + /// type of communication + enum eCommunType { + + /// sockets (TCP/IP) + COMMUN_SOCKET, + + /// shared memory + COMMUN_SHMEM + }; + /// profiling granularity levels ! enum eLEVEL { LEVEL_OBJECT, *************** *** 63,67 **** ** and LEVEL_TRACE. */ ! LEVEL level; /// trace depth --- 86,90 ---- ** and LEVEL_TRACE. */ ! eLEVEL level; /// trace depth *************** *** 84,88 **** ** Possible values are LEVEL_METHOD and LEVEL_TRACE. */ ! LEVEL level; /// trace depth --- 107,111 ---- ** Possible values are LEVEL_METHOD and LEVEL_TRACE. */ ! eLEVEL level; /// trace depth *************** *** 102,106 **** ** Possible values are LEVEL_METHOD and LEVEL_TRACE. */ ! LEVEL level; /// trace depth --- 125,129 ---- ** Possible values are LEVEL_METHOD and LEVEL_TRACE. */ ! eLEVEL level; /// trace depth *************** *** 115,119 **** /// type of communication ! IProf::eCommunType communType; /// connect mode (0 = server, 1 = client) --- 138,142 ---- /// type of communication ! eCommunType communType; /// connect mode (0 = server, 1 = client) *************** *** 135,149 **** Com() : ! communType( IProf::COMMUN_SOCKET), connectMode( 0), hostname( "127.0.0.1"), ! port( IProf::COMMUN_PORT), ! shmemSize( IProf::COMMUN_SHMEM_SIZE), shmemId( "com") // don't change, used in Java IProf, too ! {}; }; /// memory profiling --- 158,174 ---- Com() : ! communType( COMMUN_SOCKET), connectMode( 0), hostname( "127.0.0.1"), ! port( COMMUN_PORT), ! shmemSize( COMMUN_SHMEM_SIZE), shmemId( "com") // don't change, used in Java IProf, too ! {} }; + + public: /// memory profiling |
From: Marek P. <ma...@us...> - 2001-11-21 22:32:22
|
Update of /cvsroot/javaprofiler/library/src/profiler In directory usw-pr-cvs1:/tmp/cvs-serv12170/src/profiler Modified Files: Makefile.rules dir.info Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux Index: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/src/profiler/Makefile.rules,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Makefile.rules 2001/07/22 23:37:58 1.2 --- Makefile.rules 2001/11/21 22:31:49 1.3 *************** *** 1,3 **** profiler.o \ ! profiler.obj: profiler.cpp ../main/includes.h $(CCC) $(CPPFLAGS) profiler.cpp --- 1,3 ---- profiler.o \ ! profiler.obj: profiler.cpp $(CCC) $(CPPFLAGS) profiler.cpp Index: dir.info =================================================================== RCS file: /cvsroot/javaprofiler/library/src/profiler/dir.info,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** dir.info 2001/07/28 04:11:17 1.3 --- dir.info 2001/11/21 22:31:49 1.4 *************** *** 1,3 **** FILES = profiler - CLEAN_FILES = *.pdb *.tds *.dll *.exp *.lib *.so *.obj *.o --- 1,2 ---- |
From: Marek P. <ma...@us...> - 2001-11-21 22:32:22
|
Update of /cvsroot/javaprofiler/library/src/prof In directory usw-pr-cvs1:/tmp/cvs-serv12170/src/prof Modified Files: Makefile.rules dir.info lock.h prof.cpp prof.h prof_arena.cpp prof_class.cpp prof_gc.cpp prof_get.cpp prof_jniref.cpp prof_jvm.cpp prof_method.cpp prof_monitor.cpp prof_object.cpp prof_thread.cpp synchronized.h Added Files: lock.cpp Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux --- NEW FILE: lock.cpp --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ #include "../prof/lock.h" #include "../prof/prof.h" Lock::Lock( const String& name, JVMPI_Interface* jvmpi) { #ifdef USE_RAW_MONITORS if( !jvmpi) jvmpi = Prof::prof().jvmpiInterface; _rm = jvmpi->RawMonitorCreate( (char*)(const char*)name); #else #ifdef WIN32 InitializeCriticalSection( &cs); #else pthread_mutex_init( &cs, NULL); #endif #endif } Lock::~Lock() { #ifdef USE_RAW_MONITORS //Prof::prof().jvmpiInterface->RawMonitorDestroy( _rm); #else #ifdef WIN32 //DeleteCriticalSection( &cs); #else //pthread_mutex_destroy( &cs); #endif #endif } void Lock::wait() { #ifdef USE_RAW_MONITORS Prof::prof().jvmpiInterface->RawMonitorEnter( _rm); #else #ifdef WIN32 EnterCriticalSection( &cs); #else pthread_mutex_lock( &cs); #endif #endif } void Lock::release() { #ifdef USE_RAW_MONITORS Prof::prof().jvmpiInterface->RawMonitorExit( _rm); #else #ifdef WIN32 LeaveCriticalSection( &cs); #else pthread_mutex_unlock( &cs); #endif #endif } Index: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/Makefile.rules,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** Makefile.rules 2001/08/24 17:54:04 1.3 --- Makefile.rules 2001/11/21 22:31:44 1.4 *************** *** 1,43 **** prof.o \ ! prof.obj: prof.cpp ../main/includes.h $(CCC) $(CPPFLAGS) prof.cpp prof_gc.o \ ! prof_gc.obj: prof_gc.cpp ../main/includes.h $(CCC) $(CPPFLAGS) prof_gc.cpp prof_get.o \ ! prof_get.obj: prof_get.cpp ../main/includes.h $(CCC) $(CPPFLAGS) prof_get.cpp prof_jvm.o \ ! prof_jvm.obj: prof_jvm.cpp ../main/includes.h $(CCC) $(CPPFLAGS) prof_jvm.cpp prof_jniref.o \ ! prof_jniref.obj: prof_jniref.cpp ../main/includes.h $(CCC) $(CPPFLAGS) prof_jniref.cpp prof_thread.o \ ! prof_thread.obj: prof_thread.cpp ../main/includes.h $(CCC) $(CPPFLAGS) prof_thread.cpp prof_arena.o \ ! prof_arena.obj: prof_arena.cpp ../main/includes.h $(CCC) $(CPPFLAGS) prof_arena.cpp prof_object.o \ ! prof_object.obj: prof_object.cpp ../main/includes.h $(CCC) $(CPPFLAGS) prof_object.cpp prof_class.o \ ! prof_class.obj: prof_class.cpp ../main/includes.h $(CCC) $(CPPFLAGS) prof_class.cpp prof_method.o \ ! prof_method.obj: prof_method.cpp ../main/includes.h $(CCC) $(CPPFLAGS) prof_method.cpp prof_monitor.o \ ! prof_monitor.obj: prof_monitor.cpp ../main/includes.h $(CCC) $(CPPFLAGS) prof_monitor.cpp --- 1,47 ---- prof.o \ ! prof.obj: prof.cpp $(CCC) $(CPPFLAGS) prof.cpp prof_gc.o \ ! prof_gc.obj: prof_gc.cpp $(CCC) $(CPPFLAGS) prof_gc.cpp prof_get.o \ ! prof_get.obj: prof_get.cpp $(CCC) $(CPPFLAGS) prof_get.cpp prof_jvm.o \ ! prof_jvm.obj: prof_jvm.cpp $(CCC) $(CPPFLAGS) prof_jvm.cpp prof_jniref.o \ ! prof_jniref.obj: prof_jniref.cpp $(CCC) $(CPPFLAGS) prof_jniref.cpp prof_thread.o \ ! prof_thread.obj: prof_thread.cpp $(CCC) $(CPPFLAGS) prof_thread.cpp prof_arena.o \ ! prof_arena.obj: prof_arena.cpp $(CCC) $(CPPFLAGS) prof_arena.cpp prof_object.o \ ! prof_object.obj: prof_object.cpp $(CCC) $(CPPFLAGS) prof_object.cpp prof_class.o \ ! prof_class.obj: prof_class.cpp $(CCC) $(CPPFLAGS) prof_class.cpp prof_method.o \ ! prof_method.obj: prof_method.cpp $(CCC) $(CPPFLAGS) prof_method.cpp prof_monitor.o \ ! prof_monitor.obj: prof_monitor.cpp $(CCC) $(CPPFLAGS) prof_monitor.cpp + + lock.o \ + lock.obj: lock.cpp + $(CCC) $(CPPFLAGS) lock.cpp Index: dir.info =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/dir.info,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** dir.info 2001/08/24 17:54:04 1.5 --- dir.info 2001/11/21 22:31:44 1.6 *************** *** 1,4 **** FILES = prof prof_arena prof_class prof_gc prof_get prof_jniref prof_jvm \ ! prof_method prof_monitor prof_object prof_thread CLEAN_FILES = *.pdb *.obj *.o --- 1,4 ---- FILES = prof prof_arena prof_class prof_gc prof_get prof_jniref prof_jvm \ ! prof_method prof_monitor prof_object prof_thread lock CLEAN_FILES = *.pdb *.obj *.o Index: lock.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/lock.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** lock.h 2001/09/02 20:14:22 1.13 --- lock.h 2001/11/21 22:31:44 1.14 *************** *** 36,39 **** --- 36,42 ---- #define _LOCK_H_ + #include "../main/includes.h" + #include "../string/string.h" + /** Implementation of locking. This class implements OS dependent 0/1 locks. ** It uses mutexes for it. This implementation can be replaced *************** *** 51,54 **** --- 54,61 ---- class Lock { + #ifdef USE_RAW_MONITORS + /// raw monitor object + JVMPI_RawMonitor _rm; + #else #ifdef WIN32 /// critical section (mutex) object *************** *** 58,61 **** --- 65,69 ---- pthread_mutex_t cs; #endif + #endif public: *************** *** 67,105 **** ** ** @param name name of mutex (used on WIN32 only) ** ** @see WIN32 API, UNIX API, String */ ! Lock( const String& name = NULL) { ! ! #ifdef WIN32 ! InitializeCriticalSection( &cs); ! #else ! pthread_mutex_init( &cs, NULL); ! #endif ! } /// Destructor. It destroys the mutex. ! ~Lock() { - #ifdef WIN32 - DeleteCriticalSection( &cs); - #else - pthread_mutex_destroy( &cs); - #endif - } - /** Locking. This method waits on the mutex till it is used ** by someone else. ** ** @see release() */ - - void wait() { ! #ifdef WIN32 ! EnterCriticalSection( &cs); ! #else ! pthread_mutex_lock( &cs); ! #endif ! } /** Unlocking. This method releases locked mutex so it can be --- 75,93 ---- ** ** @param name name of mutex (used on WIN32 only) + ** @param jvmpi pointer to JVMPI interface ** ** @see WIN32 API, UNIX API, String */ ! Lock( const String& name, JVMPI_Interface* jvmpi = NULL); /// Destructor. It destroys the mutex. ! ~Lock(); /** Locking. This method waits on the mutex till it is used ** by someone else. ** ** @see release() */ ! void wait(); /** Unlocking. This method releases locked mutex so it can be *************** *** 108,119 **** ** @see wait() */ ! void release() { ! ! #ifdef WIN32 ! LeaveCriticalSection( &cs); ! #else ! pthread_mutex_unlock( &cs); ! #endif ! } }; --- 96,100 ---- ** @see wait() */ ! void release(); }; Index: prof.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -r1.25 -r1.26 *** prof.cpp 2001/09/18 22:19:28 1.25 --- prof.cpp 2001/11/21 22:31:44 1.26 *************** *** 33,48 **** */ ! #include "../main/includes.h" #define tF( i, a, b) tabFunc[i].event = a; tabFunc[i].func = b ! Prof::Prof( Setup& msetup) : ! setup( msetup), ! IProf( msetup), ! dataLock( "_data_lock"), ! shutdownLock( "_shutdown_lock"), ! gcLock( "_gc_lock"), shuttingDown( 0), --- 33,52 ---- */ ! #include "../prof/prof.h" #define tF( i, a, b) tabFunc[i].event = a; tabFunc[i].func = b ! Prof::Prof( Setup& msetup, JVMPI_Interface* jvmpi) : ! IProf( msetup, jvmpi), ! ! dataLock( "_data_lock", jvmpi), ! shutdownLock( "_shutdown_lock", jvmpi), ! gcLock( "_gc_lock", jvmpi), ! ! jvmpiInterface( jvmpi), ! setup( msetup), ! sampling( jvmpi), shuttingDown( 0), *************** *** 92,95 **** --- 96,104 ---- } + Prof::~Prof() { + + delete &setup; + } + void Prof::runEvent( JVMPI_Event* event) { *************** *** 99,103 **** if( event->event_type == p->event) { ! if( p->func) (this->*(p->func))( event); break; --- 108,112 ---- if( event->event_type == p->event) { ! if( p->func) (this->*(p->func))( event); break; *************** *** 120,141 **** 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); } --- 129,146 ---- Prof* Prof::_prof = NULL; ! Prof* Prof::create( char* options, JVMPI_Interface* jvmpi) { ! return (_prof = new Prof( *(new Setup( options)), jvmpi)); } void Prof::destroy() { ! static int destroying = 0; ! if( destroying) return; ! destroying = 1; ! if( _prof) delete _prof; ! _prof = NULL; } Index: prof.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof.h,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -r1.36 -r1.37 *** prof.h 2001/09/18 22:19:29 1.36 --- prof.h 2001/11/21 22:31:44 1.37 *************** *** 36,39 **** --- 36,53 ---- #define _PROF_H_ + #include "../main/includes.h" + #include "../commun/iprof.h" + #include "../hash/hash.h" + #include "../cpu/sampling.h" + #include "../cpu/cpuThreadMethodKey.h" + #include "../shared/class.h" + #include "../shared/method.h" + #include "../shared/thread.h" + #include "../shared/groupThread.h" + #include "../alloc/allocArena.h" + #include "../alloc/allocObject.h" + #include "../alloc/allocGlobalRef.h" + #include "../gc/gc.h" + /** Main profiler library class. It encapsulates all used event handlers, ** implements all necessary methods for proper function of the library. *************** *** 46,50 **** class Prof: public IProf { - private: /// one row of event handlers table --- 60,63 ---- *************** *** 65,68 **** --- 78,83 ---- }; + private: + /// event handlers table sF tabFunc[TAB_FUNC_SIZE]; *************** *** 78,82 **** Setup& setup; ! /** Lock for enabling / disabling GC. ** Following locking order must be obeyed: ** gcLock -> DisableGC -> dataLock --- 93,97 ---- Setup& setup; ! /** Lock for enabling/disabling GC. ** Following locking order must be obeyed: ** gcLock -> DisableGC -> dataLock *************** *** 183,195 **** public: ! /** Default constructor. The constructor initializes event handlers table ** with appropriate values ( {event_type, relative_method_pointer} pairs). ** ! ** @param msetup reference to profiler setup */ ! Prof( Setup& msetup); /// Destructor. ! virtual ~Prof() { delete &setup;} /** Main fork for all received JVMPI events. For each event received by profiler --- 198,211 ---- public: ! /** Constructor. The constructor initializes event handlers table ** with appropriate values ( {event_type, relative_method_pointer} pairs). ** ! ** @param msetup reference to profiler setup ! ** @param jvmpi pointer to JVMPI interface */ ! Prof( Setup& msetup, JVMPI_Interface* jvmpi); /// Destructor. ! virtual ~Prof(); /** Main fork for all received JVMPI events. For each event received by profiler *************** *** 215,220 **** ** ** @return pointer to Class object or NULL */ ! Class* getClass(jobjectID classId, int create = 1); /** Returns corresponding Method object. --- 231,239 ---- ** ** @return pointer to Class object or NULL */ + + Class* getClass( jobjectID classId, int create = 1) { ! return activeClasses.get( classId); ! } /** Returns corresponding Method object. *************** *** 228,233 **** ** @return pointer to Method object or NULL */ ! Method* getMethod(jmethodID methodId, int create = 1); /** Returns corresponding Thread object. ** If none exists and the 'create' flag is set to 1 --- 247,255 ---- ** @return pointer to Method object or NULL */ ! Method* getMethod( jmethodID methodId, int create = 1) { + return activeMethods.get( methodId); + } + /** Returns corresponding Thread object. ** If none exists and the 'create' flag is set to 1 *************** *** 235,244 **** ** If unsuccessful in either case the NULL is returned. ** ! ** @param envId thread ID ** @param create creation flag ** ** @return pointer to Thread object or NULL */ ! Thread* getThread(JNIEnv* envId, int create = 1); /** Returns corresponding AllocTrace object. --- 257,269 ---- ** If unsuccessful in either case the NULL is returned. ** ! ** @param envId thread ID ** @param create creation flag ** ** @return pointer to Thread object or NULL */ + + Thread* getThread( JNIEnv* envId, int create = 1) { ! return activeThreads.get( envId); ! } /** Returns corresponding AllocTrace object. *************** *** 253,257 **** ** @return pointer to AllocTrace object or NULL */ ! AllocTrace* getAllocTrace(int numFrames, JVMPI_CallFrame* frames, int create = 1); /** Returns corresponding AllocObject object. --- 278,282 ---- ** @return pointer to AllocTrace object or NULL */ ! AllocTrace* getAllocTrace( int numFrames, JVMPI_CallFrame* frames, int create = 1); /** Returns corresponding AllocObject object. *************** *** 266,270 **** ** @return pointer to AllocObject object or NULL */ ! AllocObject* getAllocObject(jobjectID classId, jint isArray, int create = 1); /** Returns corresponding AllocObjectMethod object. --- 291,295 ---- ** @return pointer to AllocObject object or NULL */ ! AllocObject* getAllocObject( jobjectID classId, jint isArray, int create = 1); /** Returns corresponding AllocObjectMethod object. *************** *** 280,284 **** ** @return pointer to AllocObjectMethod object or NULL */ ! AllocObjectMethod* getAllocObjectMethod(jobjectID classId, jint isArray, jmethodID methodId, int create = 1); /** Returns corresponding AllocObjectTrace object. --- 305,309 ---- ** @return pointer to AllocObjectMethod object or NULL */ ! AllocObjectMethod* getAllocObjectMethod( jobjectID classId, jint isArray, jmethodID methodId, int create = 1); /** Returns corresponding AllocObjectTrace object. *************** *** 295,299 **** ** @return pointer to AllocObjectTrace object or NULL */ ! AllocObjectTrace* getAllocObjectTrace(jobjectID classId, jint isArray, int numFrames, JVMPI_CallFrame* frames, int create = 1); /** Returns corresponding AllocThreadMethod object. --- 320,324 ---- ** @return pointer to AllocObjectTrace object or NULL */ ! AllocObjectTrace* getAllocObjectTrace( jobjectID classId, jint isArray, int numFrames, JVMPI_CallFrame* frames, int create = 1); /** Returns corresponding AllocThreadMethod object. *************** *** 308,312 **** ** @return pointer to AllocThreadMethod object or NULL */ ! AllocThreadMethod* getAllocThreadMethod(JNIEnv* envId, jmethodID methodId, int create = 1); /** Returns corresponding AllocThreadTrace object. --- 333,337 ---- ** @return pointer to AllocThreadMethod object or NULL */ ! AllocThreadMethod* getAllocThreadMethod( JNIEnv* envId, jmethodID methodId, int create = 1); /** Returns corresponding AllocThreadTrace object. *************** *** 322,326 **** ** @return pointer to AllocThreadTrace object or NULL */ ! AllocThreadTrace* getAllocThreadTrace(JNIEnv* envId, int numFrames, JVMPI_CallFrame* frames, int create = 1); /** Returns corresponding AllocThreadObject object. --- 347,351 ---- ** @return pointer to AllocThreadTrace object or NULL */ ! AllocThreadTrace* getAllocThreadTrace( JNIEnv* envId, int numFrames, JVMPI_CallFrame* frames, int create = 1); /** Returns corresponding AllocThreadObject object. *************** *** 329,333 **** ** If unsuccessful in either case the NULL is returned. ** ! ** @param envId thread ID ** @param classId class ID ** @param isArray is array? --- 354,358 ---- ** If unsuccessful in either case the NULL is returned. ** ! ** @param envId thread ID ** @param classId class ID ** @param isArray is array? *************** *** 336,340 **** ** @return pointer to AllocThreadObject object or NULL */ ! AllocThreadObject* getAllocThreadObject(JNIEnv* envId, jobjectID classId, jint isArray, int create = 1); /** Returns corresponding AllocThreadObjectMethod object. --- 361,365 ---- ** @return pointer to AllocThreadObject object or NULL */ ! AllocThreadObject* getAllocThreadObject( JNIEnv* envId, jobjectID classId, jint isArray, int create = 1); /** Returns corresponding AllocThreadObjectMethod object. *************** *** 343,347 **** ** If unsuccessful in either case the NULL is returned. ** ! ** @param envId thread ID ** @param classId class ID ** @param isArray is array? --- 368,372 ---- ** If unsuccessful in either case the NULL is returned. ** ! ** @param envId thread ID ** @param classId class ID ** @param isArray is array? *************** *** 351,355 **** ** @return pointer to AllocThreadObjectMethod object or NULL */ ! AllocThreadObjectMethod* getAllocThreadObjectMethod(JNIEnv* envId, jobjectID classId, jint isArray, jmethodID methodId, int create = 1); /** Returns corresponding AllocThreadObjectTrace object. --- 376,380 ---- ** @return pointer to AllocThreadObjectMethod object or NULL */ ! AllocThreadObjectMethod* getAllocThreadObjectMethod( JNIEnv* envId, jobjectID classId, jint isArray, jmethodID methodId, int create = 1); /** Returns corresponding AllocThreadObjectTrace object. *************** *** 358,362 **** ** If unsuccessful in either case the NULL is returned. ** ! ** @param envId thread ID ** @param classId class ID ** @param isArray is array? --- 383,387 ---- ** If unsuccessful in either case the NULL is returned. ** ! ** @param envId thread ID ** @param classId class ID ** @param isArray is array? *************** *** 367,371 **** ** @return pointer to AllocThreadObjectTrace object or NULL */ ! AllocThreadObjectTrace* getAllocThreadObjectTrace(JNIEnv* envId, jobjectID classId, jint isArray, int numFrames, JVMPI_CallFrame* frames, int create = 1); /** Returns corresponding CpuTrace object. --- 392,396 ---- ** @return pointer to AllocThreadObjectTrace object or NULL */ ! AllocThreadObjectTrace* getAllocThreadObjectTrace( JNIEnv* envId, jobjectID classId, jint isArray, int numFrames, JVMPI_CallFrame* frames, int create = 1); /** Returns corresponding CpuTrace object. *************** *** 380,384 **** ** @return pointer to CpuTrace object or NULL */ ! CpuTrace* getCpuTrace(int numFrames, JVMPI_CallFrame* frames, int create = 1); /** Returns corresponding CpuThreadMethod object. --- 405,409 ---- ** @return pointer to CpuTrace object or NULL */ ! CpuTrace* getCpuTrace( int numFrames, JVMPI_CallFrame* frames, int create = 1); /** Returns corresponding CpuThreadMethod object. *************** *** 393,397 **** ** @return pointer to CpuThreadMethod object or NULL */ ! CpuThreadMethod* getCpuThreadMethod(JNIEnv* envId, jmethodID methodId, int create = 1); /** Returns corresponding CpuThreadTrace object. --- 418,422 ---- ** @return pointer to CpuThreadMethod object or NULL */ ! CpuThreadMethod* getCpuThreadMethod( JNIEnv* envId, jmethodID methodId, int create = 1); /** Returns corresponding CpuThreadTrace object. *************** *** 407,411 **** ** @return pointer to CpuThreadTrace object or NULL */ ! CpuThreadTrace* getCpuThreadTrace(JNIEnv* envId, int numFrames, JVMPI_CallFrame* frames, int create = 1); /** Returns corresponding MonTrace object. --- 432,436 ---- ** @return pointer to CpuThreadTrace object or NULL */ ! CpuThreadTrace* getCpuThreadTrace( JNIEnv* envId, int numFrames, JVMPI_CallFrame* frames, int create = 1); /** Returns corresponding MonTrace object. *************** *** 420,424 **** ** @return pointer to MonTrace object or NULL */ ! MonTrace* getMonTrace(int numFrames, JVMPI_CallFrame* frames, int create = 1); /** Returns corresponding MonThreadMethod object. --- 445,449 ---- ** @return pointer to MonTrace object or NULL */ ! MonTrace* getMonTrace( int numFrames, JVMPI_CallFrame* frames, int create = 1); /** Returns corresponding MonThreadMethod object. *************** *** 433,437 **** ** @return pointer to MonThreadMethod object or NULL */ ! MonThreadMethod* getMonThreadMethod(JNIEnv* envId, jmethodID methodId, int create = 1); /** Returns corresponding MonThreadTrace object. --- 458,462 ---- ** @return pointer to MonThreadMethod object or NULL */ ! MonThreadMethod* getMonThreadMethod( JNIEnv* envId, jmethodID methodId, int create = 1); /** Returns corresponding MonThreadTrace object. *************** *** 447,451 **** ** @return pointer to MonThreadTrace object or NULL */ ! MonThreadTrace* getMonThreadTrace(JNIEnv* envId, int numFrames, JVMPI_CallFrame* frames, int create = 1); private: --- 472,476 ---- ** @return pointer to MonThreadTrace object or NULL */ ! MonThreadTrace* getMonThreadTrace( JNIEnv* envId, int numFrames, JVMPI_CallFrame* frames, int create = 1); private: *************** *** 807,812 **** ** ** @param infoId identifier of object having an information ! ** @param type type of information ! ** @param info pointer to output structure ** ** @return RC_OK (ok); --- 832,837 ---- ** ** @param infoId identifier of object having an information ! ** @param type type of information ! ** @param info pointer to output structure ** ** @return RC_OK (ok); *************** *** 816,822 **** ** @see getData(), getAll(), getChanged() */ ! virtual jint getInfo( objectID infoId, // in (jint) ! eInfoType type, // in (jint) ! InfoBinaryFormat*& info); // out /** Get statistic data. This method returns statistic data --- 841,847 ---- ** @see getData(), getAll(), getChanged() */ ! virtual jint getInfo( objectID infoId, // in (jint) ! eInfoType type, // in (jint) ! InfoBinaryFormat*& info); // out /** Get statistic data. This method returns statistic data *************** *** 833,839 **** ** @see getInfo(), getAll(), getChanged() */ ! virtual jint getData( objectID objId, // in (jint) ! eDataType type, // in (jint) ! sData& data); // out /** Get all objects with all statistic data. This method returns --- 858,864 ---- ** @see getInfo(), getAll(), getChanged() */ ! virtual jint getData( objectID objId, // in (jint) ! eDataType type, // in (jint) ! sData& data); // out /** Get all objects with all statistic data. This method returns *************** *** 846,852 **** ** of specified method. ** ! ** @param objId identifier of object having a data ! ** @param what specified action ! ** @param seq output sequence ** ** @return >=0 length of output sequence; --- 871,879 ---- ** of specified method. ** ! ** @param objId identifier of object having a data ! ** @param what specified action ! ** @param includeInfo include information about object ! ** @param optionalArg optional argument (depends on type of data) ! ** @param seq output sequence ** ** @return >=0 length of output sequence; *************** *** 856,863 **** ** @see getInfo(), getData(), getChanged() */ ! virtual jint getAll( objectID objId, // in (jint) ! eSeqType what, // in (jint) ! seqID& seq); // out /** Get all objects with changed statistic data. This method returns ** all statistic data of all objects of specified type, which have changed --- 883,895 ---- ** @see getInfo(), getData(), getChanged() */ ! virtual jint getAll( objectID objId, // in (jint) ! eSeqType what, // in (jint) ! jint includeInfo, // in (jint) ! jint optionalArg, // in (jint) ! seqID& seq) { // out + return getAllOrChanged( objId, what, includeInfo, optionalArg, seq, 1); + } + /** Get all objects with changed statistic data. This method returns ** all statistic data of all objects of specified type, which have changed *************** *** 866,872 **** ** If an error occurres, returned value is less than 0. ** ! ** @param objId identifier of object having a data ! ** @param what specified action ! ** @param seq output sequence ** ** @return >=0 length of output sequence; --- 898,906 ---- ** If an error occurres, returned value is less than 0. ** ! ** @param objId identifier of object having a data ! ** @param what specified action ! ** @param includeInfo include information about object ! ** @param optionalArg optional argument (depends on type of data) ! ** @param seq output sequence ** ** @return >=0 length of output sequence; *************** *** 876,883 **** ** @see getInfo(), getData(), getAll() */ ! virtual jint getChanged( objectID objId, // in (jint) ! eSeqType what, // in (jint) ! seqID& seq); // out private: --- 910,922 ---- ** @see getInfo(), getData(), getAll() */ ! virtual jint getChanged( objectID objId, // in (jint) ! eSeqType what, // in (jint) ! jint includeInfo, // in (jint) ! jint optionalArg, // in (jint) ! seqID& seq) { // out + return getAllOrChanged( objId, what, includeInfo, optionalArg, seq, 0); + } + private: *************** *** 887,890 **** --- 926,931 ---- jint getAllOrChanged( objectID objId, eSeqType what, + jint includeInfo, + jint optionalArg, seqID& seq, int all); *************** *** 892,907 **** private: - // internally used by Prof::event_threadStart() - // not documented - - static int findParent( Thread* t, void** inout); - - // internally used by Prof::event_threadStart() - // not documented - - static int findGroup( GroupThread* g, void** inout); - - private: - /** Get infoId of an object. This method returns infoId ** of an object according to seqType value. InfoId is an identifier --- 933,936 ---- *************** *** 910,914 **** ** Don't use it anywhere else. ** ! ** @param o object ** @param seqType sequence type (which an object is part of) ** --- 939,943 ---- ** Don't use it anywhere else. ** ! ** @param o object ** @param seqType sequence type (which an object is part of) ** *************** *** 921,931 **** ** data thru communication interface. ** ! ** @param dest destination ! ** @param src source ! ** @param infoId infoId of object ** ** @return pointer to destination object */ ! sID* copy( sID* dest, IdObject* src, objectID infoId); /** Get data from given list. This function template is used --- 950,961 ---- ** data thru communication interface. ** ! ** @param dest destination ! ** @param src source ! ** @param infoId infoId of object ! ** @param includeInfo include information about object ** ** @return pointer to destination object */ ! sID* copy( sID* dest, IdObject* src, objectID infoId, jint includeInfo); /** Get data from given list. This function template is used *************** *** 934,951 **** ** between library and Java. ** ! ** @param list reference to list of objects (in) ! ** @param seq reference to output sequence (out) ! ** @param all 1 = all objects; 0 = changed objects only ! ** @param st sequence type (see IProf::eSeqType) */ template<class T, class L> ! void getDataFromList( List<T,L>& list, seqID& seq, int all, eSeqType st) { T* a = list.first(); while( a) { ! if( all || a->isChanged()) { ! seq.add( copy( new sID, a, getInfoId( a, st))); a->setUnchanged(); } --- 964,990 ---- ** between library and Java. ** ! ** @param list reference to list of objects (in) ! ** @param seq reference to output sequence (out) ! ** @param all 1 = all objects; 0 = changed objects only ! ** @param st sequence type (see IProf::eSeqType) ! ** @param includeInfo include information about object ! ** @param optionalArg optional argument (depends on type of object) ! ** ! ** @see getDataFromList_filter() */ template<class T, class L> ! void getDataFromList( List<T,L>& list, ! seqID& seq, ! int all, ! eSeqType st, ! jint includeInfo, ! jint optionalArg) { T* a = list.first(); while( a) { ! if( (all || a->isChanged()) && getDataFromList_filter( a, optionalArg)) { ! seq.add( copy( new sID, a, getInfoId( a, st), includeInfo)); a->setUnchanged(); } *************** *** 955,958 **** --- 994,1030 ---- } + /** 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. + ** + ** @param o pointer to object + ** @param optionalArg optional argument (depends on type of object) + ** + ** @return 0 (false - filter); + ** 1 (true - do not filter) + ** + ** @see getDataFromList() */ + + int getDataFromList_filter( IdObject* o, jint optionalArg); + + /** Get information about object. This method returns information + ** in binary format (and type of information) about an object with + ** given 'infoId' identifier. + ** + ** @param infoId ID of object where info is stored + ** @param info reference to place where to store pointer to info data + ** @param infoType where to store type of information + ** + ** @return 0 (failed); + ** 1 (ok) */ + + jint getInfoBinaryFormat( objectID infoId, // in (jint) + InfoBinaryFormat*& info, // out (pointer) + jint& infoType); // out (jint) + public: *************** *** 960,971 **** ** ** @param context error context ! ** @param error error description ! ** @param file source file ! ** @param line line number */ ! ! void dumpError( const char* context, ! const char* error, ! const char* file, ! int line); private: --- 1032,1043 ---- ** ** @param context error context ! ** @param error error description ! ** @param file source file ! ** @param line line number */ ! ! static void dumpError( const char* context, ! const char* error, ! const char* file, ! int line); private: *************** *** 980,990 **** ** @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 --- 1052,1065 ---- ** @return reference to Prof object */ ! static Prof& prof() { return *_prof;} /** Creates static instance of Prof class. ** + ** @param options command-line options + ** @param jvmpi pointer to JVMPI interface + ** ** @return pointer to newly created object */ ! static Prof* create( char* options, JVMPI_Interface* jvmpi); /** Destroys profiler Prof object. It is called *************** *** 1002,1014 **** ** @see JVM_OnLoad(), JVMPI specification */ ! static void notifyEvent( JVMPI_Event* event); ! }; ! #ifdef PROF_ERROR_ON ! #define PROF_ERROR(context, error) prof.dumpError(context, error, __FILE__, __LINE__) ! #else // PROF_ERROR_ON ! #define PROF_ERROR(context, error) ! #endif // PROF_ERROR_ON ! #endif // _PROF_H_ --- 1077,1093 ---- ** @see JVM_OnLoad(), JVMPI specification */ ! static void notifyEvent( JVMPI_Event* event) { ! if( _prof) _prof->runEvent( event); ! } ! private: + // internally used by event_threadStart() method + // not documented + + static int findParent( Thread* t, void** inout); + static int findGroup( GroupThread* g, void** inout); + }; + + #endif // _PROF_H_ Index: prof_arena.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_arena.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** prof_arena.cpp 2001/09/02 20:14:22 1.9 --- prof_arena.cpp 2001/11/21 22:31:44 1.10 *************** *** 33,37 **** */ ! #include "../main/includes.h" void Prof::event_arenaNew( JVMPI_Event* event) { --- 33,41 ---- */ ! #include "../prof/prof.h" ! #include "../prof/synchronized.h" ! #include "../alloc/allocArena.h" ! #include "../alloc/allocInstance.h" ! #include "../alloc/allocAbstractStatThreadObject.h" void Prof::event_arenaNew( JVMPI_Event* event) { *************** *** 48,52 **** void Prof::event_arenaDelete( JVMPI_Event* event) { ! jint arena_id = event->u.delete_arena.arena_id; --- 52,56 ---- void Prof::event_arenaDelete( JVMPI_Event* event) { ! jint arena_id = event->u.delete_arena.arena_id; Index: prof_class.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_class.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** prof_class.cpp 2001/09/02 20:14:22 1.10 --- prof_class.cpp 2001/11/21 22:31:44 1.11 *************** *** 33,37 **** */ ! #include "../main/includes.h" void Prof::event_classLoad( JVMPI_Event* event) { --- 33,39 ---- */ ! #include "../prof/prof.h" ! #include "../shared/classField.h" ! #include "../prof/synchronized.h" void Prof::event_classLoad( JVMPI_Event* event) { *************** *** 42,45 **** --- 44,63 ---- if( !event->u.class_load.class_id) return; + static int firstTime = 1; + if( firstTime) { + + jvmpiInterface->EnableEvent( JVMPI_EVENT_CLASS_UNLOAD, NULL); + + if( setup.alloc.turnedOn) jvmpiInterface->EnableEvent( JVMPI_EVENT_OBJECT_ALLOC, NULL); + + if( setup.cpu.turnedOn && !setup.cpu.sampling) + jvmpiInterface->EnableEvent( JVMPI_EVENT_METHOD_ENTRY, NULL); + + if( setup.mon.turnedOn) + jvmpiInterface->EnableEvent( JVMPI_EVENT_MONITOR_CONTENDED_ENTER, NULL); + + firstTime = 0; + } + Class* c = new Class; *************** *** 107,111 **** Synchronized sync( dataLock); ! Class* c = getClass(event->u.class_unload.class_id, 0); if( c) c->deactivate(); --- 125,129 ---- Synchronized sync( dataLock); ! Class* c = getClass(event->u.class_unload.class_id, 0); if( c) c->deactivate(); Index: prof_gc.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_gc.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** prof_gc.cpp 2001/09/02 20:14:22 1.8 --- prof_gc.cpp 2001/11/21 22:31:44 1.9 *************** *** 33,37 **** */ ! #include "../main/includes.h" void Prof::event_gcStart( JVMPI_Event* event) { --- 33,38 ---- */ ! #include "../prof/prof.h" ! #include "../gc/gc.h" void Prof::event_gcStart( JVMPI_Event* event) { *************** *** 40,43 **** --- 41,57 ---- dataLock.wait(); + static int firstTime = 1; + if( firstTime) { + + jvmpiInterface->EnableEvent( JVMPI_EVENT_GC_FINISH, NULL); + + jvmpiInterface->EnableEvent( JVMPI_EVENT_OBJECT_FREE, NULL); + jvmpiInterface->EnableEvent( JVMPI_EVENT_OBJECT_MOVE, NULL); + + jvmpiInterface->EnableEvent( JVMPI_EVENT_ARENA_DELETE, NULL); + + firstTime = 0; + } + GC* gc = new GC; gc->startTime = time( NULL); *************** *** 47,51 **** void Prof::event_gcFinish( JVMPI_Event* event) { ! GC* gc = gcStat.first(); --- 61,65 ---- void Prof::event_gcFinish( JVMPI_Event* event) { ! GC* gc = gcStat.first(); Index: prof_get.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_get.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** prof_get.cpp 2001/09/02 20:14:22 1.7 --- prof_get.cpp 2001/11/21 22:31:44 1.8 *************** *** 33,53 **** */ ! #include "../main/includes.h" - Class* Prof::getClass(jobjectID classId, int create) { - - return activeClasses.get(classId); - } - - Method* Prof::getMethod(jmethodID methodId, int create) { - - return activeMethods.get(methodId); - } - - Thread* Prof::getThread(JNIEnv* envId, int create) { - - return activeThreads.get(envId); - } - CpuTrace* Prof::getCpuTrace(int numFrames, JVMPI_CallFrame* frames, int create) { --- 33,54 ---- */ ! #include "../prof/prof.h" ! #include "../cpu/cpuTrace.h" ! #include "../shared/traceFrame.h" ! #include "../cpu/cpuThreadMethod.h" ! #include "../cpu/cpuThreadTrace.h" ! #include "../alloc/allocTrace.h" ! #include "../alloc/allocObject.h" ! #include "../alloc/allocObjectMethod.h" ! #include "../alloc/allocObjectTrace.h" ! #include "../alloc/allocThreadMethod.h" ! #include "../alloc/allocThreadTrace.h" ! #include "../alloc/allocThreadObject.h" ! #include "../alloc/allocThreadObjectMethod.h" ! #include "../alloc/allocThreadObjectTrace.h" ! #include "../mon/monTrace.h" ! #include "../mon/monThreadMethod.h" ! #include "../mon/monThreadTrace.h" CpuTrace* Prof::getCpuTrace(int numFrames, JVMPI_CallFrame* frames, int create) { *************** *** 524,526 **** return threadTrace; } - --- 525,526 ---- Index: prof_jniref.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_jniref.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** prof_jniref.cpp 2001/09/02 20:14:22 1.6 --- prof_jniref.cpp 2001/11/21 22:31:44 1.7 *************** *** 33,37 **** */ ! #include "../main/includes.h" void Prof::event_jniGlobalrefAlloc( JVMPI_Event* event) { --- 33,40 ---- */ ! #include "../prof/prof.h" ! #include "../prof/synchronized.h" ! #include "../alloc/allocInstance.h" ! #include "../alloc/allocGlobalRef.h" void Prof::event_jniGlobalrefAlloc( JVMPI_Event* event) { *************** *** 42,45 **** --- 45,55 ---- if( !ins) return; + static int firstTime = 1; + if( firstTime) { + + jvmpiInterface->EnableEvent( JVMPI_EVENT_JNI_GLOBALREF_FREE, NULL); + firstTime = 0; + } + AllocGlobalRef* r = new AllocGlobalRef; r->instance = ins; *************** *** 66,69 **** --- 76,86 ---- AllocInstance* ins = instances.get( event->u.jni_globalref_alloc.obj_id); if( !ins) return; + + static int firstTime = 1; + if( firstTime) { + + jvmpiInterface->EnableEvent( JVMPI_EVENT_JNI_WEAK_GLOBALREF_FREE, NULL); + firstTime = 0; + } AllocGlobalRef* r = new AllocGlobalRef; Index: prof_jvm.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_jvm.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -r1.22 -r1.23 *** prof_jvm.cpp 2001/09/18 22:19:29 1.22 --- prof_jvm.cpp 2001/11/21 22:31:44 1.23 *************** *** 33,43 **** */ ! #include "../main/includes.h" #ifdef _DEBUG static int printMethod( Method* m, void**) { cout << m->methodName << " SIGN = " << m->methodSignature << endl; - return 0; } --- 33,60 ---- */ ! #include "../prof/prof.h" ! #include "../delay/delay.h" #ifdef _DEBUG + + #include "../shared/classField.h" + #include "../shared/groupThread.h" + #include "../alloc/allocArena.h" + #include "../alloc/allocObject.h" + #include "../alloc/allocTrace.h" + #include "../shared/traceFrame.h" + #include "../alloc/allocInstance.h" + #include "../gc/gc.h" + #include "../alloc/allocGlobalRef.h" + #include "../alloc/allocObjectMethod.h" + #include "../alloc/allocThreadObject.h" + #include "../alloc/allocThreadObjectMethod.h" + #include "../alloc/allocThreadMethod.h" + #include "../cpu/cpuThreadMethod.h" + #include "../mon/monThreadMethod.h" + static int printMethod( Method* m, void**) { cout << m->methodName << " SIGN = " << m->methodSignature << endl; return 0; } *************** *** 46,50 **** cout << f->fieldName << " SIGN = " << f->fieldSignature << endl; - return 0; } --- 63,66 ---- *************** *** 72,76 **** cout << t->threadName << " : " << (long)(t->threadEnvId) << endl; - return 0; } --- 88,91 ---- *************** *** 88,92 **** cout << "ARENA = " << a->arenaName << endl << endl; - return 0; } --- 103,106 ---- *************** *** 416,440 **** cout << endl; } ! ! #endif void Prof::event_jvmInitDone( JVMPI_Event* event) { if( setup.cpu.turnedOn && setup.cpu.sampling) sampling.startThread( 1); jvmpiInterface->CreateSystemThread( (char*)COMMUN_THREAD, ! JVMPI_NORMAL_PRIORITY, ! Prof::communThreadRoutine); } void Prof::event_jvmShutDown( JVMPI_Event* event) { - Synchronized sync1( communLock, 0); - Synchronized sync2( dataLock, 0); - if( isConnectionEstablished()) { ! sync1.enter(); ! sync2.enter(); } --- 430,460 ---- cout << endl; } ! #endif // _DEBUG void Prof::event_jvmInitDone( JVMPI_Event* event) { + // enable some curious events ;-) + + jvmpiInterface->EnableEvent( JVMPI_EVENT_THREAD_START, NULL); + jvmpiInterface->EnableEvent( JVMPI_EVENT_CLASS_LOAD, NULL); + + if( setup.alloc.turnedOn) jvmpiInterface->EnableEvent( JVMPI_EVENT_ARENA_NEW, NULL); + + jvmpiInterface->EnableEvent ( JVMPI_EVENT_JVM_SHUT_DOWN, NULL); + jvmpiInterface->DisableEvent( JVMPI_EVENT_JVM_INIT_DONE, NULL); + if( setup.cpu.turnedOn && setup.cpu.sampling) sampling.startThread( 1); jvmpiInterface->CreateSystemThread( (char*)COMMUN_THREAD, ! JVMPI_NORMAL_PRIORITY, ! Prof::communThreadRoutine); } void Prof::event_jvmShutDown( JVMPI_Event* event) { if( isConnectionEstablished()) { ! communLock.wait(); ! dataLock.wait(); } *************** *** 444,450 **** if( isConnectionEstablished()) { ! sync1.release(); shutdownLock.wait(); ! sync1.enter(); } else communThreadEnd = 1; --- 464,470 ---- if( isConnectionEstablished()) { ! communLock.release(); shutdownLock.wait(); ! communLock.wait(); } else communThreadEnd = 1; *************** *** 464,468 **** #endif Prof::destroy(); ! exit( 0); } --- 484,528 ---- #endif + // that's amazing ! must be called in reverse order ;-) + + jvmpiInterface->DisableEvent( JVMPI_EVENT_CLASS_UNLOAD, NULL); + jvmpiInterface->DisableEvent( JVMPI_EVENT_CLASS_LOAD, NULL); + + jvmpiInterface->DisableEvent( JVMPI_EVENT_METHOD_EXIT, NULL); + jvmpiInterface->DisableEvent( JVMPI_EVENT_METHOD_ENTRY, NULL); + + jvmpiInterface->DisableEvent( JVMPI_EVENT_THREAD_END, NULL); + jvmpiInterface->DisableEvent( JVMPI_EVENT_THREAD_START, NULL); + + jvmpiInterface->DisableEvent( JVMPI_EVENT_GC_FINISH, NULL); + jvmpiInterface->DisableEvent( JVMPI_EVENT_GC_START, NULL); + + jvmpiInterface->DisableEvent( JVMPI_EVENT_ARENA_DELETE, NULL); + jvmpiInterface->DisableEvent( JVMPI_EVENT_ARENA_NEW, NULL); + + jvmpiInterface->DisableEvent( JVMPI_EVENT_OBJECT_FREE, NULL); + jvmpiInterface->DisableEvent( JVMPI_EVENT_OBJECT_MOVE, NULL); + jvmpiInterface->DisableEvent( JVMPI_EVENT_OBJECT_ALLOC, NULL); + + jvmpiInterface->DisableEvent( JVMPI_EVENT_JNI_GLOBALREF_FREE, NULL); + jvmpiInterface->DisableEvent( JVMPI_EVENT_JNI_GLOBALREF_ALLOC, NULL); + + jvmpiInterface->DisableEvent( JVMPI_EVENT_JNI_WEAK_GLOBALREF_FREE, NULL); + jvmpiInterface->DisableEvent( JVMPI_EVENT_JNI_WEAK_GLOBALREF_ALLOC, NULL); + + jvmpiInterface->DisableEvent( JVMPI_EVENT_MONITOR_WAITED, NULL); + jvmpiInterface->DisableEvent( JVMPI_EVENT_MONITOR_CONTENDED_ENTERED, NULL); + jvmpiInterface->DisableEvent( JVMPI_EVENT_MONITOR_CONTENDED_ENTER, NULL); + + jvmpiInterface->DisableEvent( JVMPI_EVENT_JVM_SHUT_DOWN, NULL); + + dataLock.release(); + + while( !sampling.isTerminated()) Delay::delay( 10); + Delay::delay( 1000); + + dataLock.wait(); + Prof::destroy(); ! exit( 0); // for sure } Index: prof_method.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_method.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** prof_method.cpp 2001/09/02 20:14:22 1.6 --- prof_method.cpp 2001/11/21 22:31:44 1.7 *************** *** 33,37 **** */ ! #include "../main/includes.h" void Prof::event_methodEntry( JVMPI_Event* event) { --- 33,41 ---- */ ! #include "../prof/prof.h" ! #include "../prof/synchronized.h" ! #include "../cpu/cpuThreadMethod.h" ! #include "../cpu/cpuThreadTrace.h" ! #include "../cpu/cpuTrace.h" void Prof::event_methodEntry( JVMPI_Event* event) { *************** *** 39,44 **** Synchronized sync(dataLock); - // cerr << "METHOD ENTRY: " << (long)(event->env_id) << endl; - jlong entryTime; JVMPI_CallFrame callFrame; --- 43,46 ---- *************** *** 51,54 **** --- 53,57 ---- jvmpiInterface->GetCallTrace(&callTrace, (jint)1); + if (callTrace.num_frames != (jint)1) { PROF_ERROR("METHOD ENTRY", "GetCallTrace failed"); *************** *** 67,70 **** --- 70,80 ---- entryTime = jvmpiInterface->GetCurrentThreadCpuTime(); thread->stack.push(callFrame, entryTime); + + static int firstTime = 1; + if( firstTime) { + + jvmpiInterface->EnableEvent( JVMPI_EVENT_METHOD_EXIT, NULL); + firstTime = 0; + } } *************** *** 72,77 **** Synchronized sync(dataLock); - - // cerr << "METHOD EXIT: " << (long)(event->env_id) << endl; Thread* thread; --- 82,85 ---- Index: prof_monitor.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_monitor.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** prof_monitor.cpp 2001/09/02 20:14:22 1.3 --- prof_monitor.cpp 2001/11/21 22:31:44 1.4 *************** *** 33,37 **** */ ! #include "../main/includes.h" void Prof::event_monitorContendedEnter( JVMPI_Event* event) { --- 33,42 ---- */ ! #include "../prof/prof.h" ! #include "../prof/synchronized.h" ! #include "../delay/delay.h" ! #include "../mon/monThreadMethod.h" ! #include "../mon/monThreadTrace.h" ! #include "../mon/monTrace.h" void Prof::event_monitorContendedEnter( JVMPI_Event* event) { *************** *** 39,44 **** Synchronized sync(dataLock); - // cerr << "MONITOR CONTENDED ENTER: " << (long)(event->env_id) << endl; - Thread* t; if (!(t = getThread(event->env_id))) { --- 44,47 ---- *************** *** 47,50 **** --- 50,62 ---- } + static int firstTime = 1; + if( firstTime) { + + jvmpiInterface->EnableEvent( JVMPI_EVENT_MONITOR_CONTENDED_ENTERED, NULL); + jvmpiInterface->EnableEvent( JVMPI_EVENT_MONITOR_WAITED, NULL); + + firstTime = 0; + } + t->monitorEnter = 1; t->monitorEnterObject = event->u.monitor.object; *************** *** 56,61 **** Synchronized sync(dataLock); - // cerr << "MONITOR CONTENDED ENTERED: " << (long)(event->env_id) << endl; - Thread* t; if (!(t = getThread(event->env_id))) { --- 68,71 ---- *************** *** 134,139 **** Synchronized sync(dataLock); - - // cerr << "MONITOR WAITED: " << (long)(event->env_id) << endl; Thread* t; --- 144,147 ---- Index: prof_object.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_object.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** prof_object.cpp 2001/09/02 20:14:22 1.15 --- prof_object.cpp 2001/11/21 22:31:45 1.16 *************** *** 33,37 **** */ ! #include "../main/includes.h" void Prof::event_objectAlloc( JVMPI_Event* event) { --- 33,46 ---- */ ! #include "../prof/prof.h" ! #include "../prof/synchronized.h" ! #include "../alloc/allocThreadObject.h" ! #include "../alloc/allocObject.h" ! #include "../alloc/allocThreadObjectMethod.h" ! #include "../alloc/allocObjectMethod.h" ! #include "../alloc/allocThreadObjectTrace.h" ! #include "../alloc/allocObjectTrace.h" ! #include "../alloc/allocInstance.h" ! #include "../alloc/allocArena.h" void Prof::event_objectAlloc( JVMPI_Event* event) { *************** *** 102,106 **** } else { - JVMPI_CallTrace trace; JVMPI_CallFrame frames[MAX_TRACE]; --- 111,114 ---- *************** *** 134,137 **** --- 142,156 ---- } + static int firstTime = 1; + if( firstTime) { + + jvmpiInterface->EnableEvent( JVMPI_EVENT_GC_START, NULL); + + jvmpiInterface->EnableEvent( JVMPI_EVENT_JNI_GLOBALREF_ALLOC, NULL); + jvmpiInterface->EnableEvent( JVMPI_EVENT_JNI_WEAK_GLOBALREF_ALLOC, NULL); + + firstTime = 0; + } + AllocInstance* instance = unusedInstances.first(); if (instance) unusedInstances.remove(instance); *************** *** 170,174 **** void Prof::event_objectMove( JVMPI_Event* event) { ! jobjectID obj_id = event->u.obj_move.obj_id; AllocInstance* ins = instances.get( obj_id); --- 189,193 ---- void Prof::event_objectMove( JVMPI_Event* event) { ! jobjectID obj_id = event->u.obj_move.obj_id; AllocInstance* ins = instances.get( obj_id); *************** *** 200,204 **** } ! instances.removeNoRehash(ins); if( ins->arena) ins->arena->instances.remove( ins); --- 219,223 ---- } ! instances.removeNoRehash(ins); if( ins->arena) ins->arena->instances.remove( ins); Index: prof_thread.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_thread.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** prof_thread.cpp 2001/09/02 20:14:22 1.13 --- prof_thread.cpp 2001/11/21 22:31:46 1.14 *************** *** 33,37 **** */ ! #include "../main/includes.h" int Prof::findParent( Thread* t, void** inout) { --- 33,39 ---- */ ! #include "../prof/prof.h" ! #include "../shared/groupThread.h" ! #include "../prof/synchronized.h" int Prof::findParent( Thread* t, void** inout) { *************** *** 62,67 **** if( !(event->event_type & JVMPI_REQUESTED_EVENT)) sync.enter(); - // cerr << "THREAD START: " << (long)(event->u.thread_start.thread_env_id) << " " << event->u.thread_start.thread_name << endl; - JNIEnv* envId = event->u.thread_start.thread_env_id; char* name = event->u.thread_start.thread_name; --- 64,67 ---- *************** *** 71,74 **** --- 71,81 ---- if (strcmp(name, SAMPLING_THREAD) == 0) return; + static int firstTime = 1; + if( firstTime) { + + jvmpiInterface->EnableEvent( JVMPI_EVENT_THREAD_END, NULL); + firstTime = 0; + } + Thread* t = new Thread; *************** *** 109,114 **** Synchronized sync( dataLock); - - // cerr << "THREAD END: " << (long)(event->env_id) << endl; Thread* t = getThread(event->env_id, 0); --- 116,119 ---- Index: synchronized.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/synchronized.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** synchronized.h 2001/09/02 20:14:22 1.5 --- synchronized.h 2001/11/21 22:31:49 1.6 *************** *** 36,39 **** --- 36,42 ---- #define _SYNCHRONIZED_H_ + #include "../main/includes.h" + #include "../prof/lock.h" + /** Implementation of easy-to-use synchronization. This class gave its name ** after JTCSynchronized class used in JTC (OOC JavaThreads for C++) library, *************** *** 106,108 **** #endif // _SYNCHRONIZED_H_ - --- 109,110 ---- |
From: Marek P. <ma...@us...> - 2001-11-21 22:32:17
|
Update of /cvsroot/javaprofiler/library/src/mon In directory usw-pr-cvs1:/tmp/cvs-serv12170/src/mon Modified Files: Makefile.rules dir.info monStatData.cpp monStatData.h monThreadMethod.cpp monThreadMethod.h monThreadTrace.cpp monThreadTrace.h monTrace.cpp monTrace.h Added Files: monThreadMethodKey.h monThreadTraceKey.h Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux --- NEW FILE: monThreadMethodKey.h --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ #ifndef _MON_THREAD_METHOD_KEY_H_ #define _MON_THREAD_METHOD_KEY_H_ #include "../main/includes.h" /** Key for MonThreadMethod class. ** Used for searching in hash tables. ** ** @author Petr Luner */ struct MonThreadMethodKey { /// thread ID JNIEnv* envId; /// method ID jmethodID methodId; }; #endif // _MON_THREAD_METHOD_KEY_H_ --- NEW FILE: monThreadTraceKey.h --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ #ifndef _MON_THREAD_TRACE_KEY_H_ #define _MON_THREAD_TRACE_KEY_H_ #include "../main/includes.h" #include "../shared/traceKey.h" /** Key for MonThreadTrace class. ** Used for searching in hash tables. ** ** @author Petr Luner */ struct MonThreadTraceKey { /// thread ID JNIEnv* envId; /// trace key TraceKey traceKey; }; #endif // _MON_THREAD_TRACE_KEY_H_ Index: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/src/mon/Makefile.rules,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Makefile.rules 2001/08/24 17:54:04 1.1 --- Makefile.rules 2001/11/21 22:31:44 1.2 *************** *** 1,15 **** monStatData.o \ ! monStatData.obj: monStatData.cpp ../main/includes.h $(CCC) $(CPPFLAGS) monStatData.cpp monTrace.o \ ! monTrace.obj: monTrace.cpp ../main/includes.h $(CCC) $(CPPFLAGS) monTrace.cpp monThreadMethod.o \ ! monThreadMethod.obj: monThreadMethod.cpp ../main/includes.h $(CCC) $(CPPFLAGS) monThreadMethod.cpp monThreadTrace.o \ ! monThreadTrace.obj: monThreadTrace.cpp ../main/includes.h $(CCC) $(CPPFLAGS) monThreadTrace.cpp --- 1,15 ---- monStatData.o \ ! monStatData.obj: monStatData.cpp $(CCC) $(CPPFLAGS) monStatData.cpp monTrace.o \ ! monTrace.obj: monTrace.cpp $(CCC) $(CPPFLAGS) monTrace.cpp monThreadMethod.o \ ! monThreadMethod.obj: monThreadMethod.cpp $(CCC) $(CPPFLAGS) monThreadMethod.cpp monThreadTrace.o \ ! monThreadTrace.obj: monThreadTrace.cpp $(CCC) $(CPPFLAGS) monThreadTrace.cpp Index: dir.info =================================================================== RCS file: /cvsroot/javaprofiler/library/src/mon/dir.info,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** dir.info 2001/08/24 17:54:04 1.1 --- dir.info 2001/11/21 22:31:44 1.2 *************** *** 1,3 **** FILES = monStatData monThreadMethod monThreadTrace monTrace - CLEAN_FILES = *.pdb *.obj *.o --- 1,2 ---- Index: monStatData.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/mon/monStatData.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** monStatData.cpp 2001/09/02 20:14:22 1.3 --- monStatData.cpp 2001/11/21 22:31:44 1.4 *************** *** 33,37 **** */ ! #include "../main/includes.h" void MonStatData::addMonStat(jlong addHits, jlong addTime) { --- 33,37 ---- */ ! #include "../mon/monStatData.h" void MonStatData::addMonStat(jlong addHits, jlong addTime) { Index: monStatData.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/mon/monStatData.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** monStatData.h 2001/09/23 16:50:15 1.3 --- monStatData.h 2001/11/21 22:31:44 1.4 *************** *** 36,39 **** --- 36,44 ---- #define _MON_STAT_DATA_H_ + #include "../main/includes.h" + #include "../commun/binaryFormat.h" + #include "../commun/statDataModification.h" + #include "../commun/buffer.h" + /** Statistics data for monitor profiling. ** This class is used as a base class for other classes *************** *** 47,51 **** class MonStatData: public DataBinaryFormat, public StatDataModification { - public: --- 52,55 ---- *************** *** 59,91 **** ** Indicates whether blocking occures in wait() method. ** It is neccessary to count hits correctly. */ ! char wait; public: ! /** Constructor. ** Performs statistics initialization. */ ! MonStatData() { ! time = (jlong)0; ! hits = (jlong)0; ! wait = 0; ! }; /** Updates statistics. ** ! ** @param addHits number of hits to be added ! ** @param addTime wait time to be added */ ! virtual void addMonStat(jlong addHits, jlong addTime); /** Converts statistics data to a binary format used ** for communication with client. ** ! ** @param b buffer where to append data ** ** @return reference to same Buffer object as argument 'b' */ ! virtual Buffer& dataToBin(Buffer& b); public: --- 63,100 ---- ** Indicates whether blocking occures in wait() method. ** It is neccessary to count hits correctly. */ ! ! int wait; public: ! /** Default constructor. ** Performs statistics initialization. */ ! MonStatData() : ! time( 0), ! hits( 0), ! wait( 0) + {} + + /// Destructor. + virtual ~MonStatData() {} + /** Updates statistics. ** ! ** @param addHits number of hits to be added ! ** @param addTime wait time to be added */ ! virtual void addMonStat( jlong addHits, jlong addTime); /** Converts statistics data to a binary format used ** for communication with client. ** ! ** @param b buffer where to append data ** ** @return reference to same Buffer object as argument 'b' */ ! virtual Buffer& dataToBin( Buffer& b); public: *************** *** 97,99 **** #endif // _MON_STAT_DATA_H_ - --- 106,107 ---- Index: monThreadMethod.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/mon/monThreadMethod.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** monThreadMethod.cpp 2001/09/18 22:19:28 1.3 --- monThreadMethod.cpp 2001/11/21 22:31:44 1.4 *************** *** 33,40 **** */ ! #include "../main/includes.h" - Allocator MonThreadMethod::_allocator( sizeof( MonThreadMethod)); - void MonThreadMethod::addMonStat(jlong addHits, jlong addTime) { --- 33,45 ---- */ ! #include "../mon/monThreadMethod.h" ! #include "../shared/method.h" ! #include "../prof/prof.h" ! #include "../mon/monThreadTrace.h" ! ! #ifdef USE_ALLOCATOR ! Allocator MonThreadMethod::_allocator; ! #endif void MonThreadMethod::addMonStat(jlong addHits, jlong addTime) { *************** *** 52,54 **** --- 57,88 ---- tt = threadTraces.next(tt); } + } + + const MonThreadMethodKey& MonThreadMethod::getKey( MonThreadMethodKey& key) { + + thread->getKey( key.envId); + method->getKey( key.methodId); + + return key; + } + + int MonThreadMethod::operator==( const MonThreadMethodKey& key) { + + return (*thread == key.envId) && (*method == key.methodId); + } + + int MonThreadMethod::hashKey( const MonThreadMethodKey& key) { + + return Thread::hashKey( key.envId) ^ Method::hashKey( key.methodId); + } + + int MonThreadMethod::isActive() { + + return (method->isActive() && thread->isActive()); + } + + void MonThreadMethod::setUnchanged() { + + IdObject::setUnchanged(); + clearDataChanged(); } Index: monThreadMethod.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/mon/monThreadMethod.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** monThreadMethod.h 2001/09/02 20:14:22 1.2 --- monThreadMethod.h 2001/11/21 22:31:44 1.3 *************** *** 36,53 **** #define _MON_THREAD_METHOD_H_ ! /** Key for MonThreadMethod class. ! ** Used for searching in hash tables. ! ** ! ** @author Petr Luner */ ! ! struct MonThreadMethodKey { - /// thread ID - JNIEnv* envId; - - /// method ID - jmethodID methodId; - }; - /** Crossroad of threads and methods for monitor profiling. ** This class consists of statistic information about --- 36,48 ---- #define _MON_THREAD_METHOD_H_ ! #include "../main/includes.h" ! #include "../list/listItem.h" ! #include "../commun2/idObject.h" ! #include "../mon/monStatData.h" ! #include "../list/list.h" ! #include "../mon/monThreadTrace.h" ! #include "../mon/monThreadMethodKey.h" ! #include "../allocator/allocator.h" /** Crossroad of threads and methods for monitor profiling. ** This class consists of statistic information about *************** *** 58,66 **** ** @author Petr Luner */ ! class MonThreadMethod: public IdObject, ! public LI1, ! public LI2, ! public LI3, ! public MonStatData { public: --- 53,61 ---- ** @author Petr Luner */ ! class MonThreadMethod: public LI1, ! public LI2, ! public LI3, ! public IdObject, ! public MonStatData { public: *************** *** 81,112 **** method( NULL), thread( NULL) ! {}; /** Updates monitor statistics. ** Also updates monitor statistics of corresponding method. ** ! ** @param addHits number of hits to be added ! ** @param addTime wait time to be added */ ! virtual void addMonStat(jlong addHits, jlong addTime); /** Retrieves object's key. ** ! ** @param key where to store the key ! ** @return key ** ** @see Hash */ ! const MonThreadMethodKey& getKey(MonThreadMethodKey& key) { ! ! thread->getKey(key.envId); ! method->getKey(key.methodId); ! return key; ! } /** Compares object with given key. ** ** @param key key ** @return 1 (true); ** 0 (false) --- 76,107 ---- method( NULL), thread( NULL) + + {} ! /// Destructor. ! virtual ~MonThreadMethod() {} /** Updates monitor statistics. ** Also updates monitor statistics of corresponding method. ** ! ** @param addHits number of hits to be added ! ** @param addTime wait time to be added */ ! virtual void addMonStat( jlong addHits, jlong addTime); /** Retrieves object's key. ** ! ** @param key where to store the key ** + ** @return key + ** ** @see Hash */ ! const MonThreadMethodKey& getKey(MonThreadMethodKey& key); /** Compares object with given key. ** ** @param key key + ** ** @return 1 (true); ** 0 (false) *************** *** 114,131 **** ** @see Hash */ ! int operator==(const MonThreadMethodKey& key) { ! ! return (*thread == key.envId) && (*method == key.methodId); ! } /** Hash function. ** ! ** @param reference to a key ** @return hash value */ - - static int hashKey(const MonThreadMethodKey& key) { ! return Thread::hashKey(key.envId) ^ Method::hashKey(key.methodId); ! } /** Performs deactivation. */ --- 109,121 ---- ** @see Hash */ ! int operator==( const MonThreadMethodKey& key); /** Hash function. ** ! ** @param key reference to a key ! ** ** @return hash value */ ! static int hashKey( const MonThreadMethodKey& key); /** Performs deactivation. */ *************** *** 133,136 **** --- 123,127 ---- void deactivate(); + #ifdef USE_ALLOCATOR private: *************** *** 142,150 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} public: --- 133,142 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif public: *************** *** 152,156 **** /** Class identification. ** ! ** @return unique class type identified */ virtual eClassIdent getClassIdent() { return MON_THREAD_METHOD;} --- 144,148 ---- /** Class identification. ** ! ** @return unique class type identifier */ virtual eClassIdent getClassIdent() { return MON_THREAD_METHOD;} *************** *** 162,166 **** ** 1 (active) */ ! virtual int isActive() { return (method->isActive() && thread->isActive());} /** Indication that object has changed its data. --- 154,158 ---- ** 1 (active) */ ! virtual int isActive(); /** Indication that object has changed its data. *************** *** 173,181 **** /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged() { ! ! IdObject::setUnchanged(); ! clearDataChanged(); ! } }; --- 165,169 ---- /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged(); }; Index: monThreadTrace.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/mon/monThreadTrace.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** monThreadTrace.cpp 2001/09/18 22:19:28 1.3 --- monThreadTrace.cpp 2001/11/21 22:31:44 1.4 *************** *** 33,39 **** */ ! #include "../main/includes.h" ! Allocator MonThreadTrace::_allocator( sizeof( MonThreadTrace)); void MonThreadTrace::addMonStat(jlong addHits, jlong addTime) { --- 33,45 ---- */ ! #include "../mon/monThreadTrace.h" ! #include "../mon/monThreadMethod.h" ! #include "../shared/thread.h" ! #include "../mon/monTrace.h" ! #include "../prof/prof.h" ! #ifdef USE_ALLOCATOR ! Allocator MonThreadTrace::_allocator; ! #endif void MonThreadTrace::addMonStat(jlong addHits, jlong addTime) { *************** *** 46,49 **** void MonThreadTrace::deactivate() { ! Prof::prof().activeMonThreadTraces.removeNoRehash(this); } --- 52,84 ---- void MonThreadTrace::deactivate() { ! Prof::prof().activeMonThreadTraces.removeNoRehash(this); ! } ! ! const MonThreadTraceKey& MonThreadTrace::getKey( MonThreadTraceKey& key) { ! ! threadMethod->thread->getKey(key.envId); ! trace->getKey(key.traceKey); ! ! return key; ! } ! ! int MonThreadTrace::operator==( const MonThreadTraceKey& key) { ! ! return (*threadMethod->thread == key.envId) && (*trace == key.traceKey); ! } ! ! int MonThreadTrace::hashKey( const MonThreadTraceKey& key) { ! ! return Thread::hashKey(key.envId) ^ Trace::hashKey(key.traceKey); ! } ! ! int MonThreadTrace::isActive() { ! ! return (trace->isActive() && threadMethod->isActive()); ! } ! ! void MonThreadTrace::setUnchanged() { ! ! IdObject::setUnchanged(); ! clearDataChanged(); } Index: monThreadTrace.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/mon/monThreadTrace.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** monThreadTrace.h 2001/09/02 20:14:22 1.2 --- monThreadTrace.h 2001/11/21 22:31:44 1.3 *************** *** 36,53 **** #define _MON_THREAD_TRACE_H_ ! /** Key for MonThreadTrace class. ! ** Used for searching in hash tables. ! ** ! ** @author Petr Luner */ ! ! struct MonThreadTraceKey { - /// thread ID - JNIEnv* envId; - - /// trace key - TraceKey traceKey; - }; - /** Crossroad of threads and traces for monitor profiling. ** This class consists of statistic information about --- 36,46 ---- #define _MON_THREAD_TRACE_H_ ! #include "../main/includes.h" ! #include "../list/listItem.h" ! #include "../commun2/idObject.h" ! #include "../mon/monStatData.h" ! #include "../mon/monThreadTraceKey.h" ! #include "../allocator/allocator.h" /** Crossroad of threads and traces for monitor profiling. ** This class consists of statistic information about *************** *** 58,66 **** ** @author Petr Luner */ ! class MonThreadTrace: public IdObject, ! public LI1, ! public LI2, ! public LI3, ! public MonStatData { public: --- 51,59 ---- ** @author Petr Luner */ ! class MonThreadTrace: public LI1, ! public LI2, ! public LI3, ! public IdObject, ! public MonStatData { public: *************** *** 78,83 **** threadMethod( NULL), trace( NULL) ! {}; /** Updates monitor statistics. --- 71,79 ---- threadMethod( NULL), trace( NULL) + + {} ! /// Destructor. ! virtual ~MonThreadTrace() {} /** Updates monitor statistics. *************** *** 85,110 **** ** and MonThreadMethod. ** ! ** @param addHits number of hits to be added ! ** @param addTime wait time to be added */ ! virtual void addMonStat(jlong addHits, jlong addTime); /** Retrieves object's key. ** ! ** @param key where to store the key ** @return key ** ** @see Hash */ ! const MonThreadTraceKey& getKey(MonThreadTraceKey& key) { ! ! threadMethod->thread->getKey(key.envId); ! trace->getKey(key.traceKey); ! return key; ! } /** Compares object with given key. ** ** @param key key ** @return 1 (true); ** 0 (false) --- 81,103 ---- ** and MonThreadMethod. ** ! ** @param addHits number of hits to be added ! ** @param addTime wait time to be added */ ! virtual void addMonStat( jlong addHits, jlong addTime); /** Retrieves object's key. ** ! ** @param key where to store the key ! ** ** @return key ** ** @see Hash */ ! const MonThreadTraceKey& getKey( MonThreadTraceKey& key); /** Compares object with given key. ** ** @param key key + ** ** @return 1 (true); ** 0 (false) *************** *** 112,129 **** ** @see Hash */ ! int operator==(const MonThreadTraceKey& key) { ! ! return (*threadMethod->thread == key.envId) && (*trace == key.traceKey); ! } /** Hash function. ** ! ** @param reference to a key ** @return hash value */ - - static int hashKey(const MonThreadTraceKey& key) { ! return Thread::hashKey(key.envId) ^ Trace::hashKey(key.traceKey); ! } /** Performs deactivation. */ --- 105,117 ---- ** @see Hash */ ! int operator==( const MonThreadTraceKey& key); /** Hash function. ** ! ** @param key reference to a key ! ** ** @return hash value */ ! static int hashKey( const MonThreadTraceKey& key); /** Performs deactivation. */ *************** *** 131,134 **** --- 119,123 ---- void deactivate(); + #ifdef USE_ALLOCATOR private: *************** *** 140,148 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} public: --- 129,138 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif public: *************** *** 150,154 **** /** Class identification. ** ! ** @return unique class type identified */ virtual eClassIdent getClassIdent() { return MON_THREAD_TRACE;} --- 140,144 ---- /** Class identification. ** ! ** @return unique class type identifier */ virtual eClassIdent getClassIdent() { return MON_THREAD_TRACE;} *************** *** 160,164 **** ** 1 (active) */ ! virtual int isActive() { return (trace->isActive() && threadMethod->isActive());} /** Indication that object has changed its data. --- 150,154 ---- ** 1 (active) */ ! virtual int isActive(); /** Indication that object has changed its data. *************** *** 171,179 **** /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged() { ! ! IdObject::setUnchanged(); ! clearDataChanged(); ! } }; --- 161,165 ---- /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged(); }; Index: monTrace.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/mon/monTrace.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** monTrace.cpp 2001/09/18 22:19:28 1.3 --- monTrace.cpp 2001/11/21 22:31:44 1.4 *************** *** 33,39 **** */ ! #include "../main/includes.h" ! Allocator MonTrace::_allocator( sizeof( MonTrace)); void MonTrace::addMonStat(jlong addHits, jlong addTime) { --- 33,43 ---- */ ! #include "../mon/monTrace.h" ! #include "../shared/method.h" ! #include "../prof/prof.h" ! #ifdef USE_ALLOCATOR ! Allocator MonTrace::_allocator; ! #endif void MonTrace::addMonStat(jlong addHits, jlong addTime) { *************** *** 46,48 **** --- 50,63 ---- Prof::prof().activeMonTraces.removeNoRehash(this); + } + + int MonTrace::isActive() { + + return method->isActive(); + } + + void MonTrace::setUnchanged() { + + IdObject::setUnchanged(); + clearDataChanged(); } Index: monTrace.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/mon/monTrace.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** monTrace.h 2001/09/02 20:14:22 1.2 --- monTrace.h 2001/11/21 22:31:44 1.3 *************** *** 36,39 **** --- 36,48 ---- #define _MON_TRACE_H_ + #include "../main/includes.h" + #include "../list/listItem.h" + #include "../commun2/idObject.h" + #include "../shared/trace.h" + #include "../mon/monStatData.h" + #include "../list/list.h" + #include "../mon/monThreadTrace.h" + #include "../allocator/allocator.h" + /** Trace for monitor profiling. ** We decided to use different traces *************** *** 44,52 **** ** @author Petr Luner */ ! class MonTrace: public IdObject, ! public LI1, ! public LI2, public Trace, ! public MonStatData { public: --- 53,61 ---- ** @author Petr Luner */ ! class MonTrace: public LI1, ! public LI2, ! public IdObject, public Trace, ! public MonStatData { public: *************** *** 63,76 **** method( NULL) ! {}; /** Updates monitor statistics. ** Also updates monitor statistics of corresponding method. ** ! ** @param addHits number of hits to be added ! ** @param addTime wait time to be added */ ! virtual void addMonStat(jlong addHits, jlong addTime); /** Performs deactivation. */ --- 72,88 ---- method( NULL) + + {} ! /// Destructor. ! virtual ~MonTrace() {} /** Updates monitor statistics. ** Also updates monitor statistics of corresponding method. ** ! ** @param addHits number of hits to be added ! ** @param addTime wait time to be added */ ! virtual void addMonStat( jlong addHits, jlong addTime); /** Performs deactivation. */ *************** *** 78,81 **** --- 90,94 ---- void deactivate(); + #ifdef USE_ALLOCATOR private: *************** *** 87,95 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} public: --- 100,109 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif public: *************** *** 97,101 **** /** Class identification. ** ! ** @return unique class type identified */ virtual eClassIdent getClassIdent() { return MON_TRACE;} --- 111,115 ---- /** Class identification. ** ! ** @return unique class type identifier */ virtual eClassIdent getClassIdent() { return MON_TRACE;} *************** *** 107,111 **** ** 1 (active) */ ! virtual int isActive() { return method->isActive();} /** Indication that object has changed its data. --- 121,125 ---- ** 1 (active) */ ! virtual int isActive(); /** Indication that object has changed its data. *************** *** 118,126 **** /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged() { ! ! IdObject::setUnchanged(); ! clearDataChanged(); ! } }; --- 132,136 ---- /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged(); }; |
From: Marek P. <ma...@us...> - 2001-11-21 22:32:16
|
Update of /cvsroot/javaprofiler/library/src/main In directory usw-pr-cvs1:/tmp/cvs-serv12170/src/main Modified Files: Makefile.rules dir.info includes.h main.cpp Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux Index: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/src/main/Makefile.rules,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Makefile.rules 2001/07/22 23:37:58 1.2 --- Makefile.rules 2001/11/21 22:31:43 1.3 *************** *** 1,3 **** main.o \ ! main.obj: main.cpp includes.h $(CCC) $(CPPFLAGS) main.cpp --- 1,3 ---- main.o \ ! main.obj: main.cpp $(CCC) $(CPPFLAGS) main.cpp Index: dir.info =================================================================== RCS file: /cvsroot/javaprofiler/library/src/main/dir.info,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** dir.info 2001/07/28 04:11:17 1.4 --- dir.info 2001/11/21 22:31:43 1.5 *************** *** 1,3 **** FILES = main - CLEAN_FILES = *.pdb *.obj *.o --- 1,2 ---- Index: includes.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/main/includes.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -r1.25 -r1.26 *** includes.h 2001/09/18 22:19:28 1.25 --- includes.h 2001/11/21 22:31:43 1.26 *************** *** 33,178 **** */ #ifdef WIN32 ! #include <winsock2.h> ! #include <windows.h> ! #include <stdlib.h> ! #include <mmsystem.h> #else ! #include <pthread.h> ! #include <stdlib.h> #include <sys/types.h> #include <netinet/in.h> #include <sys/socket.h> #include <unistd.h> ! #include <sys/time.h> #include <sys/ipc.h> #include <sys/sem.h> #include <sys/shm.h> ! #include <netdb.h> ! #endif ! ! #include <assert.h> ! #include <iostream.h> #include <string.h> ! #include <jvmpi.h> #include <time.h> ! class IdObject; ! struct TraceKey; ! class Class; ! class Method; ! class Trace; ! class Thread; ! struct AllocObjectKey; ! struct AllocObjectMethodKey; ! struct AllocObjectTraceKey; ! struct AllocThreadMethodKey; ! struct AllocThreadTraceKey; ! struct AllocThreadObjectKey; ! struct AllocThreadObjectMethodKey; ! struct AllocThreadObjectTraceKey; ! class AllocTrace; class AllocObject; class AllocObjectMethod; class AllocObjectTrace; class AllocThreadMethod; - class AllocThreadTrace; class AllocThreadObject; class AllocThreadObjectMethod; class AllocThreadObjectTrace; ! ! struct CpuThreadMethodKey; ! struct CpuThreadTraceKey; ! ! class CpuTrace; class CpuThreadMethod; class CpuThreadTrace; ! ! struct MonThreadMethodKey; ! struct MonThreadTraceKey; ! ! class MonTrace; class MonThreadMethod; class MonThreadTrace; ! class AllocInstance; ! class Allocator; ! class Prof; ! class Setup; ! #include "../main/const.h" ! #include "../allocator/allocator.h" ! #include "../string/string.h" ! #include "../prof/lock.h" ! #include "../prof/synchronized.h" ! #include "../delay/delay.h" ! ! #include "../list/refCount.h" ! #include "../list/listItem.h" ! #include "../list/list.h" ! #include "../hash/hash.h" ! ! #include "../commun/buffer.h" ! #include "../commun/binaryFormat.h" ! #include "../commun/commun.h" ! #include "../commun/communSocket.h" ! #include "../commun/statDataModification.h" ! #include "../commun2/objectTable.h" ! #include "../commun2/counter.h" ! #include "../commun2/idObject.h" ! ! #include "../alloc/allocStatData.h" ! #include "../alloc/allocAbstractStatThreadObject.h" ! #include "../cpu/cpuStatData.h" ! #include "../mon/monStatData.h" ! ! #include "../commun/iprof.h" ! #include "../commun3/semaphore.h" ! #include "../commun3/sharedMemory.h" ! #include "../commun3/communShMem.h" ! ! #include "../cpu/cpuStack.h" ! #include "../cpu/sampling.h" ! ! #include "../shared/classField.h" ! #include "../shared/class.h" ! #include "../shared/method.h" ! #include "../shared/traceFrame.h" ! #include "../shared/trace.h" ! #include "../shared/groupThread.h" ! #include "../shared/thread.h" ! ! #include "../alloc/allocTrace.h" ! #include "../alloc/allocObject.h" ! #include "../alloc/allocObjectMethod.h" ! #include "../alloc/allocObjectTrace.h" ! #include "../alloc/allocThreadMethod.h" ! #include "../alloc/allocThreadTrace.h" ! #include "../alloc/allocThreadObject.h" ! #include "../alloc/allocThreadObjectMethod.h" ! #include "../alloc/allocThreadObjectTrace.h" ! ! #include "../cpu/cpuTrace.h" ! #include "../cpu/cpuThreadMethod.h" ! #include "../cpu/cpuThreadTrace.h" ! ! #include "../mon/monTrace.h" ! #include "../mon/monThreadMethod.h" ! #include "../mon/monThreadTrace.h" ! ! #include "../alloc/allocArena.h" ! #include "../alloc/allocInstance.h" ! ! #include "../alloc/allocGlobalRef.h" ! ! #include "../gc/gc.h" ! ! #include "../commun/iprof.h" ! #include "../setup/setup.h" ! #include "../prof/prof.h" --- 33,155 ---- */ + #ifndef _INCLUDES_H_ + #define _INCLUDES_H_ + #ifdef WIN32 ! // WIN32 headers #else ! #ifdef SUNOS ! // SUNOS headers ! #else ! // LINUX headers #include <sys/types.h> #include <netinet/in.h> #include <sys/socket.h> #include <unistd.h> ! #include <netdb.h> ! #include <stdlib.h> #include <sys/ipc.h> #include <sys/sem.h> #include <sys/shm.h> ! #include <sys/time.h> #include <string.h> ! #include <iostream.h> #include <time.h> + #include <signal.h> ! #ifndef USE_RAW_MONITORS ! #include <pthread.h> ! #endif ! #endif ! #endif ! #include <jvmpi.h> ! #ifdef PROF_ERROR_ON ! #define PROF_ERROR(context, error) \ ! Prof::dumpError(context, error, __FILE__, __LINE__) ! #else ! #define PROF_ERROR(context, error) ! #endif // PROF_ERROR_ON ! class Allocator; ! class AllocAbstractStatThreadObject; ! class AllocArena; ! class AllocGlobalRef; ! class AllocInstance; class AllocObject; class AllocObjectMethod; class AllocObjectTrace; + class AllocStatData; class AllocThreadMethod; class AllocThreadObject; class AllocThreadObjectMethod; class AllocThreadObjectTrace; ! class AllocThreadTrace; ! class AllocTrace; ! class Buffer; ! class Class; ! class ClassField; ! class Commun; ! class CommunShMem; ! class CommunSocket; ! class Counter; ! class CpuStack; ! class CpuStatData; class CpuThreadMethod; class CpuThreadTrace; ! class CpuTrace; ! class DataBinaryFormat; ! class Delay; ! class GC; ! class GroupThread; ! class IdObject; ! class InfoBinaryFormat; ! class IProf; ! class ListItem; ! class LI1; ! class LI2; ! class LI3; ! class LI4; ! class LI5; ! class Lock; ! class Method; ! class MonStatData; class MonThreadMethod; class MonThreadTrace; + class MonTrace; + class ObjectTable; + class Prof; + class RefCount; + class Sampling; + class Semaphore; + class Setup; + class SharedMemory; + class StatDataModification; + class String; + class Synchronized; + class Thread; + class Trace; ! template<class T, class K, class L> ! class Hash; ! template<class T, class L> ! class List; ! struct AllocObjectKey; ! struct AllocObjectMethodKey; ! struct AllocObjectTraceKey; ! struct AllocThreadMethodKey; ! struct AllocThreadObjectKey; ! struct AllocThreadObjectMethodKey; ! struct AllocThreadObjectTraceKey; ! struct AllocThreadTraceKey; ! struct CpuThreadTraceKey; ! struct MonThreadMethodKey; ! struct MonThreadTraceKey; ! struct TraceFrame; ! struct TraceKey; ! #endif // _INCLUDES_H_ Index: main.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/main/main.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -r1.24 -r1.25 *** main.cpp 2001/09/18 22:19:28 1.24 --- main.cpp 2001/11/21 22:31:43 1.25 *************** *** 34,37 **** --- 34,38 ---- #include "../main/includes.h" + #include "../prof/prof.h" extern "C" { *************** *** 58,126 **** if( jvm->GetEnv( (void**)&jvmpi_interface, JVMPI_VERSION_1) < 0) return JNI_ERR; - Prof* p = Prof::create( options); - jvmpi_interface->NotifyEvent = Prof::notifyEvent; ! p->jvmpiInterface = jvmpi_interface; ! ! jvmpi_interface->EnableEvent( JVMPI_EVENT_THREAD_END, NULL); ! jvmpi_interface->EnableEvent( JVMPI_EVENT_THREAD_START, NULL); ! ! jvmpi_interface->EnableEvent( JVMPI_EVENT_CLASS_LOAD, NULL); ! // jvmpi_interface->EnableEvent( JVMPI_EVENT_CLASS_LOAD_HOOK, NULL); ! jvmpi_interface->EnableEvent( JVMPI_EVENT_CLASS_UNLOAD, NULL); ! ! // jvmpi_interface->EnableEvent( JVMPI_EVENT_COMPILED_METHOD_LOAD, NULL); ! // jvmpi_interface->EnableEvent( JVMPI_EVENT_COMPILED_METHOD_UNLOAD, NULL); ! ! if( p->setup.cpu.turnedOn && (!p->setup.cpu.sampling)) { ! ! jvmpi_interface->EnableEvent( JVMPI_EVENT_METHOD_ENTRY, NULL); ! // jvmpi_interface->EnableEvent( JVMPI_EVENT_METHOD_ENTRY2, NULL); ! jvmpi_interface->EnableEvent( JVMPI_EVENT_METHOD_EXIT, NULL); ! } ! ! if( p->setup.alloc.turnedOn) { ! ! jvmpi_interface->EnableEvent( JVMPI_EVENT_ARENA_DELETE, NULL); ! jvmpi_interface->EnableEvent( JVMPI_EVENT_ARENA_NEW, NULL); ! ! jvmpi_interface->EnableEvent( JVMPI_EVENT_OBJECT_ALLOC, NULL); ! jvmpi_interface->EnableEvent( JVMPI_EVENT_OBJECT_FREE, NULL); ! jvmpi_interface->EnableEvent( JVMPI_EVENT_OBJECT_MOVE, NULL); - jvmpi_interface->EnableEvent( JVMPI_EVENT_JNI_GLOBALREF_ALLOC, NULL); - jvmpi_interface->EnableEvent( JVMPI_EVENT_JNI_GLOBALREF_FREE, NULL); - jvmpi_interface->EnableEvent( JVMPI_EVENT_JNI_WEAK_GLOBALREF_ALLOC, NULL); - jvmpi_interface->EnableEvent( JVMPI_EVENT_JNI_WEAK_GLOBALREF_FREE, NULL); - } - - if( p->setup.mon.turnedOn) { - - jvmpi_interface->EnableEvent( JVMPI_EVENT_MONITOR_CONTENDED_ENTER, NULL); - jvmpi_interface->EnableEvent( JVMPI_EVENT_MONITOR_CONTENDED_ENTERED, NULL); - // jvmpi_interface->EnableEvent( JVMPI_EVENT_MONITOR_CONTENDED_EXIT, NULL); - - // jvmpi_interface->EnableEvent( JVMPI_EVENT_MONITOR_WAIT, NULL); - jvmpi_interface->EnableEvent( JVMPI_EVENT_MONITOR_WAITED, NULL); - } - - // jvmpi_interface->EnableEvent( JVMPI_EVENT_RAW_MONITOR_CONTENDED_ENTER, NULL); - // jvmpi_interface->EnableEvent( JVMPI_EVENT_RAW_MONITOR_CONTENDED_ENTERED, NULL); - // jvmpi_interface->EnableEvent( JVMPI_EVENT_RAW_MONITOR_CONTENDED_EXIT, NULL); - - jvmpi_interface->EnableEvent( JVMPI_EVENT_GC_FINISH, NULL); - jvmpi_interface->EnableEvent( JVMPI_EVENT_GC_START, NULL); - - // jvmpi_interface->EnableEvent( JVMPI_EVENT_DATA_DUMP_REQUEST, NULL); - // jvmpi_interface->EnableEvent( JVMPI_EVENT_DATA_RESET_REQUEST, NULL); - - // jvmpi_interface->EnableEvent( JVMPI_EVENT_HEAP_DUMP, NULL); - // jvmpi_interface->EnableEvent( JVMPI_EVENT_MONITOR_DUMP, NULL); - // jvmpi_interface->EnableEvent( JVMPI_EVENT_OBJECT_DUMP, NULL); - jvmpi_interface->EnableEvent( JVMPI_EVENT_JVM_INIT_DONE, NULL); - jvmpi_interface->EnableEvent( JVMPI_EVENT_JVM_SHUT_DOWN, NULL); - - // jvmpi_interface->EnableEvent( JVMPI_EVENT_INSTRUCTION_START, NULL); return JNI_OK; --- 59,66 ---- if( jvm->GetEnv( (void**)&jvmpi_interface, JVMPI_VERSION_1) < 0) return JNI_ERR; jvmpi_interface->NotifyEvent = Prof::notifyEvent; ! Prof::create( options, jvmpi_interface); jvmpi_interface->EnableEvent( JVMPI_EVENT_JVM_INIT_DONE, NULL); return JNI_OK; |
From: Marek P. <ma...@us...> - 2001-11-21 22:32:16
|
Update of /cvsroot/javaprofiler/library/src/list In directory usw-pr-cvs1:/tmp/cvs-serv12170/src/list Modified Files: list.h listItem.h refCount.h Added Files: Makefile Makefile.mak Makefile.rules dir.info listItem.cpp Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux --- NEW FILE: Makefile --- include ../../config.mk include Makefile.rules --- NEW FILE: Makefile.mak --- !include ../../config.mk !include Makefile.rules --- NEW FILE: Makefile.rules --- listItem.o \ listItem.obj: listItem.cpp $(CCC) $(CPPFLAGS) listItem.cpp --- NEW FILE: dir.info --- FILES = listItem CLEAN_FILES = *.pdb *.obj *.o --- NEW FILE: listItem.cpp --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ #include "../list/listItem.h" ListItem* ListItem::add( ListItem** list) { _next = *list; _prev = NULL; _list = list; if( _next) _next->_prev = this; addRef(); return this; } ListItem* ListItem::remove() { if( _prev) _prev->_next = _next; if( _next) _next->_prev = _prev; ListItem* p = _next; _next = NULL; _prev = NULL; if( _list && *_list == this) *_list = p; _list = NULL; releaseRef(); return p; } Index: list.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/list/list.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** list.h 2001/09/02 20:14:21 1.8 --- list.h 2001/11/21 22:31:43 1.9 *************** *** 36,39 **** --- 36,42 ---- #define _LIST_H_ + #include "../main/includes.h" + #include "../list/listItem.h" + /** List template. This template class implements a list of objects inherited ** generally from ListItem class. Better use one of the direct descendants *************** *** 71,75 **** _list( NULL) ! {}; /** Destructor. It destroys the list. The item of the list --- 74,78 ---- _list( NULL) ! {} /** Destructor. It destroys the list. The item of the list *************** *** 78,84 **** ** ** @see destroy() */ ! virtual ~List() { while( _list) destroy( (T*)(L*)_list);}; /** First item of the list. This method returns pointer ** to the first item of the list or NULL if the list is empty. --- 81,94 ---- ** ** @see destroy() */ + + ~List() { clear();} + + /** Clears the whole list. */ ! void clear() { + while( _list) destroy( static_cast<T*>( static_cast<L*>( _list))); + } + /** First item of the list. This method returns pointer ** to the first item of the list or NULL if the list is empty. *************** *** 88,103 **** ** @see next() */ ! T* first() const { return (T*)(L*)_list;} /** Gets next item in the list for iterating. ** Returns NULL if the end of the list was reached. ** - ** @param item pointer to list item ** @return pointer to the next list item or NULL ** ** @see first() */ ! T* next(T* item) const { return (T*)(L*)(((L*)item)->next()); } /** Check for empty list. This method returns non-zero value ** if the list is empty or zero if it isn't. --- 98,117 ---- ** @see next() */ ! T* first() const { return static_cast<T*>( static_cast<L*>( _list));} /** Gets next item in the list for iterating. ** Returns NULL if the end of the list was reached. + ** + ** @param item pointer to list item ** ** @return pointer to the next list item or NULL ** ** @see first() */ ! T* next( T* item) const { + return static_cast<T*>( static_cast<L*>( item->L::next())); + } + /** Check for empty list. This method returns non-zero value ** if the list is empty or zero if it isn't. *************** *** 119,125 **** T* add( T* p) { - if ( !p) return NULL; - ((L*)p)->add(&_list); return p; } --- 133,141 ---- T* add( T* p) { + + if( !p) return NULL; + + _list = p->L::add( &_list); return p; } *************** *** 138,144 **** T* remove( T* p) { ! if( !p) return NULL; ! ((L*)p)->remove(); return p; } --- 154,163 ---- T* remove( T* p) { ! if( !p) return NULL; ! ! ListItem* q = p->L::remove(); ! if( p == static_cast<T*>( static_cast<L*>( _list))) _list = q; ! return p; } *************** *** 154,160 **** void destroy( T* p) { ! if( !p) return; ! ((L*)remove( p))->destroy(); } --- 173,180 ---- void destroy( T* p) { ! if( !p) return; ! ! remove( p)->L::destroy(); } *************** *** 167,171 **** ** code as 'f'. Else when it finishes it returns 0. ** ! ** @param f pointer to function ** @param inout the second argument of 'f' function ** --- 187,191 ---- ** code as 'f'. Else when it finishes it returns 0. ** ! ** @param f pointer to function ** @param inout the second argument of 'f' function ** *************** *** 178,184 **** while( p) { if( rc = f( p, inout)) return rc; ! p = next(p); } return 0; } --- 198,206 ---- while( p) { + if( rc = f( p, inout)) return rc; ! p = next( p); } + return 0; } *************** *** 191,195 **** int len = 0; ! for (T* p = first(); p; p = next(p), len++); return len; } --- 213,217 ---- int len = 0; ! for( T* p = first(); p; p = next( p), len++); return len; } *************** *** 197,199 **** #endif // _LIST_H_ - --- 219,220 ---- Index: listItem.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/list/listItem.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** listItem.h 2001/09/02 20:14:21 1.8 --- listItem.h 2001/11/21 22:31:43 1.9 *************** *** 36,39 **** --- 36,42 ---- #define _LIST_ITEM_H_ + #include "../main/includes.h" + #include "../list/refCount.h" + /** List item implementation. This class implements one item of the list. ** In truth it implements the list itself. This class has all needed methods *************** *** 55,61 **** /// pointer to next ListItem object in the list ListItem* _next; ! /// pointer to self link pointer ! ListItem** _self; public: --- 58,67 ---- /// pointer to next ListItem object in the list ListItem* _next; + + /// pointer to previous ListItem object in the list + ListItem* _prev; ! /// pointer where pointer to head of list is stored ! ListItem** _list; public: *************** *** 65,71 **** _next( NULL), ! _self( NULL) ! {}; /// Destructor. --- 71,78 ---- _next( NULL), ! _prev( NULL), ! _list( NULL) ! {} /// Destructor. *************** *** 79,111 **** ListItem* next() const { return _next;} ! /** Adds self to the list. ** ! ** @param list list ** ** @see remove() */ - - void add( ListItem** list) { - - _next = *list; - if (_next) _next->_self = &_next; - *list = this; - _self = list; ! addRef(); ! } /** Removes self from a list. ** ** @see add() */ - - void remove() { ! *_self = _next; ! if (_next) _next->_self = _self; ! _next = NULL; ! _self = NULL; ! ! releaseRef(); ! } }; --- 86,106 ---- ListItem* next() const { return _next;} ! /** Adds self to the head of list. ! ** ! ** @param list pointer to pointer to head of list ** ! ** @return new head of list ** ** @see remove() */ ! ListItem* add( ListItem** list); /** Removes self from a list. ** + ** @return pointer to next item in the list + ** ** @see add() */ ! ListItem* remove(); }; *************** *** 151,153 **** #endif // _LIST_ITEM_H_ - --- 146,147 ---- Index: refCount.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/list/refCount.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** refCount.h 2001/09/02 20:14:21 1.4 --- refCount.h 2001/11/21 22:31:43 1.5 *************** *** 36,39 **** --- 36,41 ---- #define _REF_COUNT_H_ + #include "../main/includes.h" + /** An abstract class for reference counting. ** Each class, which needs reference counting, must be a descendant *************** *** 54,68 **** protected: ! /// Default constructor. RefCount() : _count( 0) ! {}; public: /// Destructor. It does nothing. ! virtual ~RefCount() {}; /** Reference count incrementation. --- 56,70 ---- protected: ! /// Default _PROTECTED_ constructor. RefCount() : _count( 0) ! {} public: /// Destructor. It does nothing. ! virtual ~RefCount() {} /** Reference count incrementation. *************** *** 83,93 **** ** this method destroys the instance it was called for. ** The object should be created dynamically ;-) */ - - virtual void destroy() { ! if( !_count) delete this; ! } }; #endif // _REF_COUNT_H_ - --- 85,91 ---- ** this method destroys the instance it was called for. ** The object should be created dynamically ;-) */ ! virtual void destroy() { if( !_count) delete this;} }; #endif // _REF_COUNT_H_ |
From: Marek P. <ma...@us...> - 2001-11-21 22:32:16
|
Update of /cvsroot/javaprofiler/library/src/hash In directory usw-pr-cvs1:/tmp/cvs-serv12170/src/hash Modified Files: hash.h Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux Index: hash.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/hash/hash.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** hash.h 2001/09/02 20:14:21 1.20 --- hash.h 2001/11/21 22:31:43 1.21 *************** *** 36,39 **** --- 36,42 ---- #define _HASH_H_ + #include "../main/includes.h" + #include "../list/list.h" + /** Hash table template. ** *************** *** 85,88 **** --- 88,93 ---- }; + private: + /// an array of lists List<T,L>* _table; *************** *** 100,177 **** unsigned int _index; - private: - - /** Converts argument to an index to the hash table. - ** Used in conjunction with hash function. - ** Robert Jenkins' 32-bit mix function is used for hashing. - ** - ** @param x typically result of a hash function - ** - ** @return hash table index */ - - unsigned int makeIndex( int x) { - - unsigned int key = (unsigned)x; - - key += (key << 12); - key ^= (key >> 22); - key += (key << 4); - key ^= (key >> 9); - key += (key << 10); - key ^= (key >> 2); - key += (key << 7); - key ^= (key >> 12); - - unsigned int index = key & _mask; - if( index >= _size) index >>= 1; - - return index; - } - - /** Rehashing. This method resizes hashtable and - ** rehashes its items. - ** - ** @param sz new size of hashtable */ - - void rehash( int sz) { - - int size = _size; - List<T,L>* table = _table; - - _size = sz; - _table = new List<T,L>[_size]; - - _mask = _size-1; - - List<T,L>* p = table; - T* t; - K key; - int h; - - for( int i = 0; i < size; i++, p++) { - while( t = p->remove( p->first())) { - h = T::hashKey(t->getKey(key)); - _table[makeIndex(h)].add( t); - } - } - - delete[] table; - } - public: /// Default constructor. ! Hash() : _size( 1<<10), _numItems( 0), _index(0) { _table = new List<T,L>[_size]; - _mask = _size-1; } /// Destructor. ! virtual ~Hash() { delete[] _table;}; /** Gets the first item in the hash table for iterating. ! ** Returns NULL if the hash table is empty; ** ** @return pointer to an item or NULL --- 105,135 ---- unsigned int _index; public: /// Default constructor. ! Hash() : ! ! _size( 1<<10), ! _numItems( 0), ! _index(0) { _table = new List<T,L>[_size]; _mask = _size-1; } /// Destructor. ! ~Hash() { delete[] _table;} ! ! /** Clears the whole hashtable. Its size remains unchanged. ! ** Don't use it - for testing only. */ ! ! void clear() { + List<T,L>* p = _table; + for( unsigned int i = 0; i < _size; i++, p++) p->clear(); + } + /** Gets the first item in the hash table for iterating. ! ** Returns NULL if the hash table is empty. ** ** @return pointer to an item or NULL *************** *** 180,187 **** T* first() { - T* p; - for (_index = 0; _index < _size; _index++) - if (p = _table[_index].first()) return p; return NULL; } --- 138,148 ---- T* first() { + + List<T,L>* p = _table; + T* q; + + for( _index = 0; _index < _size; _index++, p++) + if( q = p->first()) return q; return NULL; } *************** *** 190,204 **** ** Returns NULL if the end of the hash table was reached. ** ! ** @param item pointer to an item ** @return pointer to the next item or NULL ** ** @see first() */ ! T* next(T* item) { - T* p = (T*)(L*)((L*)item)->next(); - if (p) return p; - for (_index++ ; _index < _size; _index++) - if (p = _table[_index].first()) return p; return NULL; } --- 151,170 ---- ** Returns NULL if the end of the hash table was reached. ** ! ** @param item pointer to an item ! ** ** @return pointer to the next item or NULL ** ** @see first() */ + + T* next( T* item) { + + T* q = static_cast<T*>( static_cast<L*>( item->L::next())); + if( q) return q; + + List<T,L>* p = &_table[++_index]; ! for( ; _index < _size; _index++) ! if( q = p->first()) return q; return NULL; } *************** *** 206,222 **** /** Adds an item to the hash table without rehashing. ** ! ** @param item pointer to an item ** @return pointer to the inserted item ** ** @see add(), remove(), removeNoRehash() */ ! T* addNoRehash(T* item) { ! if (!item) return NULL; K key; ! int h = T::hashKey(item->getKey(key)); ! _table[makeIndex(h)].add(item); _numItems++; --- 172,189 ---- /** Adds an item to the hash table without rehashing. ** ! ** @param item pointer to an item ! ** ** @return pointer to the inserted item ** ** @see add(), remove(), removeNoRehash() */ ! T* addNoRehash( T* item) { ! if( !item) return NULL; K key; ! int h = T::hashKey( item->getKey( key)); ! _table[makeIndex( h)].add( item); _numItems++; *************** *** 225,253 **** /** Adds an item to the hash table. ** - ** @param item pointer to an item ** @return pointer to the inserted item ** ** @see addNoRehash(), remove(), removeNoRehash() */ ! T* add(T* item) { ! if (!addNoRehash(item)) return NULL; if( _numItems > _size*HASH_LIST_LIMIT+5) rehash( _size<<1); return item; } /** Removes an item from the hash table without rehashing. ** - ** @param item pointer to an item ** @return pointer to the removed item ** ** @see remove(), add(), addNoRehash() */ ! T* removeNoRehash(T* item) { ! if (!item) return NULL; ! ((L*)item)->remove(); _numItems--; --- 192,224 ---- /** Adds an item to the hash table. + ** + ** @param item pointer to an item ** ** @return pointer to the inserted item ** ** @see addNoRehash(), remove(), removeNoRehash() */ ! T* add( T* item) { ! if( !addNoRehash( item)) return NULL; if( _numItems > _size*HASH_LIST_LIMIT+5) rehash( _size<<1); + return item; } /** Removes an item from the hash table without rehashing. + ** + ** @param item pointer to an item ** ** @return pointer to the removed item ** ** @see remove(), add(), addNoRehash() */ ! T* removeNoRehash( T* item) { ! if( !item) return NULL; ! ! item->L::remove(); _numItems--; *************** *** 256,290 **** /** Removes an item from the hash table. ** - ** @param item pointer to an item ** @return pointer to the removed item ** ** @see add(), addNoRehash(), removeNoRehash() */ ! T* remove(T* item) { ! if (!removeNoRehash(item)) return NULL; unsigned int sz = _size>>1; ! if(_numItems < sz*HASH_LIST_LIMIT) rehash( sz); return item; } /** Searches the hash table for an item corresponing ! ** to the specified key. If no item is found NULL is ** returned. ** ! ** @param key key to search for ** @return pointer to the found item */ ! T* get(const K& key) { ! int h = T::hashKey(key); ! List<T,L>* list = &_table[makeIndex(h)]; T* p = list->first(); ! while (p && (!(*p == key))) p = list->next(p); ! if (p) { ! ((L*)p)->remove(); ! list->add(p); ! } return p; } --- 227,265 ---- /** Removes an item from the hash table. + ** + ** @param item pointer to an item ** ** @return pointer to the removed item ** ** @see add(), addNoRehash(), removeNoRehash() */ ! T* remove( T* item) { ! if( !removeNoRehash( item)) return NULL; ! unsigned int sz = _size>>1; ! if( _numItems < sz*HASH_LIST_LIMIT) rehash( sz); ! return item; } /** Searches the hash table for an item corresponing ! ** to the specified key. If no item is found, NULL is ** returned. ** ! ** @param key key to search for ! ** ** @return pointer to the found item */ ! T* get( const K& key) { ! int h = T::hashKey( key); ! List<T,L>* list = &_table[makeIndex( h)]; T* p = list->first(); ! ! while( p && !(*p == key)) p = list->next( p); ! ! if( p) list->add( list->remove( p)); ! return p; } *************** *** 299,304 **** ** as 'f', else when it stops it returns 0. ** ! ** @param f pointer to function ! ** @param inout the second argument of 'f' function ** ** @return value --- 274,279 ---- ** as 'f', else when it stops it returns 0. ** ! ** @param f pointer to function ! ** @param inout the second argument of 'f' function ** ** @return value *************** *** 308,312 **** int forEach( int (*f)( T*, void**), void** inout) { ! List<T,L>* p = &_table[0]; for( unsigned int i = 0; i < _size; i++, p++) { --- 283,287 ---- int forEach( int (*f)( T*, void**), void** inout) { ! List<T,L>* p = _table; for( unsigned int i = 0; i < _size; i++, p++) { *************** *** 319,323 **** --- 294,355 ---- } + private: + + /** Converts argument to an index to the hash table. + ** Used in conjunction with hash function. + ** Robert Jenkins' 32-bit mix function is used for hashing. + ** + ** @param x typically result of a hash function + ** + ** @return hash table index */ + + unsigned int makeIndex( int x) { + + unsigned int key = (unsigned)x; + + key += (key << 12); + key ^= (key >> 22); + key += (key << 4); + key ^= (key >> 9); + key += (key << 10); + key ^= (key >> 2); + key += (key << 7); + key ^= (key >> 12); + + unsigned int index = key & _mask; + if( index >= _size) index >>= 1; + + return index; + } + + /** Rehashing. This method resizes hashtable and + ** rehashes its items. + ** + ** @param sz new size of hashtable */ + + void rehash( unsigned int sz) { + + unsigned int size = _size; + List<T,L>* table = _table; + + _size = sz; + _table = new List<T,L>[_size]; + + _mask = _size-1; + _numItems = 0; + + _index = 0; + + List<T,L>* p = table; + + for( unsigned int i = 0; i < size; i++, p++) + while( addNoRehash( p->remove( p->first()))); + + delete[] table; + } + #ifdef _DEBUG + public: + /** Print statistics. This method prints statistic about ** the hashtable to standard output. It is used for debugging *************** *** 362,364 **** #endif // _HASH_H_ - --- 394,395 ---- |
From: Marek P. <ma...@us...> - 2001-11-21 22:32:16
|
Update of /cvsroot/javaprofiler/library/src/gc In directory usw-pr-cvs1:/tmp/cvs-serv12170/src/gc Modified Files: Makefile.rules dir.info gc.cpp gc.h Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux Index: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/src/gc/Makefile.rules,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Makefile.rules 2001/07/28 04:11:17 1.1 --- Makefile.rules 2001/11/21 22:31:43 1.2 *************** *** 1,3 **** gc.o \ ! gc.obj: gc.cpp ../main/includes.h $(CCC) $(CPPFLAGS) gc.cpp --- 1,3 ---- gc.o \ ! gc.obj: gc.cpp $(CCC) $(CPPFLAGS) gc.cpp Index: dir.info =================================================================== RCS file: /cvsroot/javaprofiler/library/src/gc/dir.info,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** dir.info 2001/07/28 04:11:17 1.1 --- dir.info 2001/11/21 22:31:43 1.2 *************** *** 1,3 **** FILES = gc - CLEAN_FILES = *.pdb *.obj *.o --- 1,2 ---- Index: gc.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/gc/gc.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** gc.cpp 2001/09/02 20:14:21 1.2 --- gc.cpp 2001/11/21 22:31:43 1.3 *************** *** 33,37 **** */ ! #include "../main/includes.h" ! Allocator GC::_allocator( sizeof( GC)); --- 33,50 ---- */ ! #include "../gc/gc.h" ! #ifdef USE_ALLOCATOR ! Allocator GC::_allocator; ! #endif ! ! Buffer& GC::infoToBin( Buffer& b) { ! ! b += usedObjects; ! b += usedObjectSpace; ! b += totalObjectSpace; ! b += (jlong)startTime; ! b += (jlong)endTime; ! ! return b; ! } Index: gc.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/gc/gc.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** gc.h 2001/09/02 20:14:21 1.11 --- gc.h 2001/11/21 22:31:43 1.12 *************** *** 36,39 **** --- 36,46 ---- #define _GC_H_ + #include "../main/includes.h" + #include "../list/listItem.h" + #include "../commun2/idObject.h" + #include "../commun/binaryFormat.h" + #include "../commun/buffer.h" + #include "../allocator/allocator.h" + /** Garbage collector profiling data. This class contains ** Java heap statistic data gained by receiving *************** *** 42,47 **** ** @author Marek Przeczek */ ! class GC: public LI1, public IdObject, ! public InfoBinaryFormat { public: --- 49,55 ---- ** @author Marek Przeczek */ ! class GC: public LI1, ! public IdObject, ! public InfoBinaryFormat { public: *************** *** 71,76 **** startTime( 0), endTime( 0) ! {}; /** Convert info to binary. This method converts information --- 79,87 ---- startTime( 0), endTime( 0) + + {} ! /// Destructor. ! virtual ~GC() {} /** Convert info to binary. This method converts information *************** *** 81,96 **** ** ** @return reference to same Buffer object as argument 'b' */ - - virtual Buffer& infoToBin( Buffer& b) { - - b += usedObjects; - b += usedObjectSpace; - b += totalObjectSpace; - b += (jlong)startTime; - b += (jlong)endTime; ! return b; ! } private: --- 92,99 ---- ** ** @return reference to same Buffer object as argument 'b' */ ! virtual Buffer& infoToBin( Buffer& b); + #ifdef USE_ALLOCATOR private: *************** *** 102,110 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} public: --- 105,114 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif public: |
From: Marek P. <ma...@us...> - 2001-11-21 22:32:16
|
Update of /cvsroot/javaprofiler/library/src/delay In directory usw-pr-cvs1:/tmp/cvs-serv12170/src/delay Modified Files: Makefile.rules delay.cpp delay.h dir.info Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux Index: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/src/delay/Makefile.rules,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Makefile.rules 2001/08/23 23:57:31 1.1 --- Makefile.rules 2001/11/21 22:31:43 1.2 *************** *** 1,3 **** delay.o \ ! delay.obj: delay.cpp ../main/includes.h $(CCC) $(CPPFLAGS) delay.cpp --- 1,3 ---- delay.o \ ! delay.obj: delay.cpp $(CCC) $(CPPFLAGS) delay.cpp Index: delay.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/delay/delay.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** delay.cpp 2001/09/02 20:14:21 1.4 --- delay.cpp 2001/11/21 22:31:43 1.5 *************** *** 33,37 **** */ ! #include "../main/includes.h" void Delay::delay( long ms) { --- 33,37 ---- */ ! #include "../delay/delay.h" void Delay::delay( long ms) { Index: delay.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/delay/delay.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** delay.h 2001/09/02 20:14:21 1.4 --- delay.h 2001/11/21 22:31:43 1.5 *************** *** 36,39 **** --- 36,41 ---- #define _DELAY_H_ + #include "../main/includes.h" + /** Delay in milliseconds. This class should be used when ** sleeping for N milliseconds is necessary. Its implementation *************** *** 44,48 **** class Delay { - public: --- 46,49 ---- Index: dir.info =================================================================== RCS file: /cvsroot/javaprofiler/library/src/delay/dir.info,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** dir.info 2001/08/23 23:57:31 1.1 --- dir.info 2001/11/21 22:31:43 1.2 *************** *** 1,3 **** FILES = delay - CLEAN_FILES = *.pdb *.obj *.o --- 1,2 ---- |
From: Marek P. <ma...@us...> - 2001-11-21 22:32:16
|
Update of /cvsroot/javaprofiler/library/src/cpu In directory usw-pr-cvs1:/tmp/cvs-serv12170/src/cpu Modified Files: Makefile.rules cpuStack.cpp cpuStack.h cpuStatData.cpp cpuStatData.h cpuThreadMethod.cpp cpuThreadMethod.h cpuThreadTrace.cpp cpuThreadTrace.h cpuTrace.cpp cpuTrace.h dir.info sampling.cpp sampling.h Added Files: cpuThreadMethodKey.h cpuThreadTraceKey.h Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux --- NEW FILE: cpuThreadMethodKey.h --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ #ifndef _CPU_THREAD_METHOD_KEY_H_ #define _CPU_THREAD_METHOD_KEY_H_ #include "../main/includes.h" /** Key for CpuThreadMethod class. ** Used for searching in hash tables. ** ** @author Petr Luner */ struct CpuThreadMethodKey { /// thread ID JNIEnv* envId; /// method ID jmethodID methodId; }; #endif // _CPU_THREAD_METHOD_KEY_H_ --- NEW FILE: cpuThreadTraceKey.h --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ #ifndef _CPU_THREAD_TRACE_KEY_H_ #define _CPU_THREAD_TRACE_KEY_H_ #include "../main/includes.h" #include "../shared/traceKey.h" /** Key for CpuThreadTrace class. ** Used for searching in hash tables. ** ** @author Petr Luner */ struct CpuThreadTraceKey { /// thread ID JNIEnv* envId; /// trace key TraceKey traceKey; }; #endif // _CPU_THREAD_TRACE_KEY_H_ Index: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/Makefile.rules,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** Makefile.rules 2001/07/30 15:41:26 1.3 --- Makefile.rules 2001/11/21 22:31:42 1.4 *************** *** 1,23 **** cpuStack.o \ ! cpuStack.obj: cpuStack.cpp ../main/includes.h $(CCC) $(CPPFLAGS) cpuStack.cpp cpuStatData.o \ ! cpuStatData.obj: cpuStatData.cpp ../main/includes.h $(CCC) $(CPPFLAGS) cpuStatData.cpp cpuTrace.o \ ! cpuTrace.obj: cpuTrace.cpp ../main/includes.h $(CCC) $(CPPFLAGS) cpuTrace.cpp cpuThreadMethod.o \ ! cpuThreadMethod.obj: cpuThreadMethod.cpp ../main/includes.h $(CCC) $(CPPFLAGS) cpuThreadMethod.cpp cpuThreadTrace.o \ ! cpuThreadTrace.obj: cpuThreadTrace.cpp ../main/includes.h $(CCC) $(CPPFLAGS) cpuThreadTrace.cpp sampling.o \ ! sampling.obj: sampling.cpp ../main/includes.h $(CCC) $(CPPFLAGS) sampling.cpp --- 1,23 ---- cpuStack.o \ ! cpuStack.obj: cpuStack.cpp $(CCC) $(CPPFLAGS) cpuStack.cpp cpuStatData.o \ ! cpuStatData.obj: cpuStatData.cpp $(CCC) $(CPPFLAGS) cpuStatData.cpp cpuTrace.o \ ! cpuTrace.obj: cpuTrace.cpp $(CCC) $(CPPFLAGS) cpuTrace.cpp cpuThreadMethod.o \ ! cpuThreadMethod.obj: cpuThreadMethod.cpp $(CCC) $(CPPFLAGS) cpuThreadMethod.cpp cpuThreadTrace.o \ ! cpuThreadTrace.obj: cpuThreadTrace.cpp $(CCC) $(CPPFLAGS) cpuThreadTrace.cpp sampling.o \ ! sampling.obj: sampling.cpp $(CCC) $(CPPFLAGS) sampling.cpp Index: cpuStack.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/cpuStack.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** cpuStack.cpp 2001/09/02 20:14:21 1.3 --- cpuStack.cpp 2001/11/21 22:31:42 1.4 *************** *** 33,37 **** */ ! #include "../main/includes.h" CpuStack::~CpuStack() { --- 33,37 ---- */ ! #include "../cpu/cpuStack.h" CpuStack::~CpuStack() { *************** *** 78,80 **** size = newSize; } - --- 78,79 ---- Index: cpuStack.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/cpuStack.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** cpuStack.h 2001/09/02 20:14:21 1.3 --- cpuStack.h 2001/11/21 22:31:42 1.4 *************** *** 36,43 **** #define _CPU_STACK_H_ /** Stack for CPU profiling purposes. ** Essentially this class represents an image of a thread call ** stack and serves for recording method entry times and other ! ** information needed for computation of method total and pure ** time consumation. The events JVMPI_EVENT_METHOD_ENTRY and ** JVMPI_EVENT_METHOD_EXIT are used to update the stack --- 36,45 ---- #define _CPU_STACK_H_ + #include "../main/includes.h" + /** Stack for CPU profiling purposes. ** Essentially this class represents an image of a thread call ** stack and serves for recording method entry times and other ! ** information needed for computing of method total and pure ** time consumation. The events JVMPI_EVENT_METHOD_ENTRY and ** JVMPI_EVENT_METHOD_EXIT are used to update the stack *************** *** 49,53 **** class CpuStack { - private: /// Internal stack frame --- 51,54 ---- *************** *** 63,85 **** jlong calleesTime; }; ! // stack array Frame* stack; ! // stack size long size; ! // top stack index long top; public: ! /// Constructor ! CpuStack() { ! stack = NULL; ! size = 0; ! top = -1; ! } /// Destructor --- 64,89 ---- jlong calleesTime; }; + + private: ! /// stack array Frame* stack; ! /// stack size long size; ! /// top stack index long top; public: + + /// Default constructor. + CpuStack() : ! stack( NULL), ! size( 0), ! top( -1) ! {} /// Destructor *************** *** 88,108 **** /** Pushes method call on the stack. ** ! ** @param callFrame JVMPI method call frame ! ** @param entryTime time of method entry */ ! void push(JVMPI_CallFrame& callFrame, jlong entryTime); /** Bills the cost of a top method and pops it from the stack. ** ! ** @param exitTime top method exit time ! ** @param totalTime total time consumed by top method ! ** @param pureTime pure time consumed by top method */ ! void pop(jlong exitTime, jlong& totalTime, jlong& pureTime); /** Gets top call trace. ** ! ** @param maxFrames maximum frames to return ! ** @param frames buffer for returned frames ** ** @return number of frames returned */ --- 92,112 ---- /** Pushes method call on the stack. ** ! ** @param callFrame JVMPI method call frame ! ** @param entryTime time of method entry */ ! void push( JVMPI_CallFrame& callFrame, jlong entryTime); /** Bills the cost of a top method and pops it from the stack. ** ! ** @param exitTime top method exit time ! ** @param totalTime total time consumed by top method ! ** @param pureTime pure time consumed by top method */ ! void pop( jlong exitTime, jlong& totalTime, jlong& pureTime); /** Gets top call trace. ** ! ** @param maxFrames maximum frames to return ! ** @param frames buffer for returned frames ** ** @return number of frames returned */ *************** *** 117,119 **** #endif // _CPU_STACK_H_ - --- 121,122 ---- Index: cpuStatData.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/cpuStatData.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** cpuStatData.cpp 2001/09/02 20:14:21 1.6 --- cpuStatData.cpp 2001/11/21 22:31:42 1.7 *************** *** 33,37 **** */ ! #include "../main/includes.h" void CpuStatData::addCpuStat(jlong addHits, jlong addPureTime) { --- 33,37 ---- */ ! #include "../cpu/cpuStatData.h" void CpuStatData::addCpuStat(jlong addHits, jlong addPureTime) { Index: cpuStatData.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/cpuStatData.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** cpuStatData.h 2001/09/23 16:50:15 1.7 --- cpuStatData.h 2001/11/21 22:31:42 1.8 *************** *** 36,39 **** --- 36,44 ---- #define _CPU_STAT_DATA_H_ + #include "../main/includes.h" + #include "../commun/binaryFormat.h" + #include "../commun/statDataModification.h" + #include "../commun/buffer.h" + /** CPU statistics data. ** Used as a base class for other classes to hold CPU usage *************** *** 46,50 **** class CpuStatData: public DataBinaryFormat, public StatDataModification { - public: --- 51,54 ---- *************** *** 57,84 **** public: ! /** Constructor. ** Performs statistics initialization. */ ! CpuStatData() { ! pureTime = (jlong)0; ! hits = (jlong)0; ! }; /** Updates statistics. ** ! ** @param addHits number of hits to be added ! ** @param addPureTime pure time to be added */ ! virtual void addCpuStat(jlong addHits, jlong addPureTime); /** Converts statistics data to a binary format used ** for communication with client. ** ! ** @param b buffer where to append data ** ** @return reference to same Buffer object as argument 'b' */ ! virtual Buffer& dataToBin(Buffer& b); public: --- 61,92 ---- public: ! /** Default constructor. ** Performs statistics initialization. */ + + CpuStatData() : ! pureTime( 0), ! hits( 0) ! {} + /// Destructor. + virtual ~CpuStatData() {} + /** Updates statistics. ** ! ** @param addHits number of hits to be added ! ** @param addPureTime pure time to be added */ ! virtual void addCpuStat( jlong addHits, jlong addPureTime); /** Converts statistics data to a binary format used ** for communication with client. ** ! ** @param b buffer where to append data ** ** @return reference to same Buffer object as argument 'b' */ ! virtual Buffer& dataToBin( Buffer& b); public: *************** *** 90,92 **** #endif // _CPU_STAT_DATA_H_ - --- 98,99 ---- Index: cpuThreadMethod.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/cpuThreadMethod.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** cpuThreadMethod.cpp 2001/09/18 22:19:28 1.7 --- cpuThreadMethod.cpp 2001/11/21 22:31:42 1.8 *************** *** 33,40 **** */ ! #include "../main/includes.h" - Allocator CpuThreadMethod::_allocator( sizeof( CpuThreadMethod)); - void CpuThreadMethod::addCpuStat(jlong addHits, jlong addPureTime) { --- 33,45 ---- */ ! #include "../cpu/cpuThreadMethod.h" ! #include "../shared/method.h" ! #include "../prof/prof.h" ! #include "../cpu/cpuThreadTrace.h" ! ! #ifdef USE_ALLOCATOR ! Allocator CpuThreadMethod::_allocator; ! #endif void CpuThreadMethod::addCpuStat(jlong addHits, jlong addPureTime) { *************** *** 52,54 **** --- 57,88 ---- tt = threadTraces.next(tt); } + } + + const CpuThreadMethodKey& CpuThreadMethod::getKey( CpuThreadMethodKey& key) { + + thread->getKey(key.envId); + method->getKey(key.methodId); + + return key; + } + + int CpuThreadMethod::operator==( const CpuThreadMethodKey& key) { + + return (*thread == key.envId) && (*method == key.methodId); + } + + int CpuThreadMethod::hashKey( const CpuThreadMethodKey& key) { + + return Thread::hashKey(key.envId) ^ Method::hashKey(key.methodId); + } + + int CpuThreadMethod::isActive() { + + return (method->isActive() && thread->isActive()); + } + + void CpuThreadMethod::setUnchanged() { + + IdObject::setUnchanged(); + clearDataChanged(); } Index: cpuThreadMethod.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/cpuThreadMethod.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** cpuThreadMethod.h 2001/09/02 20:14:21 1.9 --- cpuThreadMethod.h 2001/11/21 22:31:42 1.10 *************** *** 36,53 **** #define _CPU_THREAD_METHOD_H_ ! /** Key for CpuThreadMethod class. ! ** Used for searching in hash tables. ! ** ! ** @author Petr Luner */ ! ! struct CpuThreadMethodKey { - /// thread ID - JNIEnv* envId; - - /// method ID - jmethodID methodId; - }; - /** Crossroad of threads and methods for CPU profiling. ** This class consists of statistic information about --- 36,48 ---- #define _CPU_THREAD_METHOD_H_ ! #include "../main/includes.h" ! #include "../list/listItem.h" ! #include "../commun2/idObject.h" ! #include "../cpu/cpuStatData.h" ! #include "../list/list.h" ! #include "../cpu/cpuThreadTrace.h" ! #include "../cpu/cpuThreadMethodKey.h" ! #include "../allocator/allocator.h" /** Crossroad of threads and methods for CPU profiling. ** This class consists of statistic information about *************** *** 58,66 **** ** @author Petr Luner */ ! class CpuThreadMethod: public IdObject, ! public LI1, ! public LI2, ! public LI3, ! public CpuStatData { public: --- 53,61 ---- ** @author Petr Luner */ ! class CpuThreadMethod: public LI1, ! public LI2, ! public LI3, ! public IdObject, ! public CpuStatData { public: *************** *** 81,112 **** method( NULL), thread( NULL) ! {}; /** Updates CPU statistics. ** Also updates CPU statistics of corresponding method. ** ! ** @param addHits number of hits to be added ! ** @param addPureTime pure time to be added */ ! virtual void addCpuStat(jlong addHits, jlong addPureTime); /** Retrieves object's key. ** ! ** @param key where to store the key ! ** @return key ** ** @see Hash */ ! const CpuThreadMethodKey& getKey(CpuThreadMethodKey& key) { ! ! thread->getKey(key.envId); ! method->getKey(key.methodId); ! return key; ! } /** Compares object with given key. ** ** @param key key ** @return 1 (true); ** 0 (false) --- 76,107 ---- method( NULL), thread( NULL) + + {} ! /// Destructor. ! virtual ~CpuThreadMethod() {} /** Updates CPU statistics. ** Also updates CPU statistics of corresponding method. ** ! ** @param addHits number of hits to be added ! ** @param addPureTime pure time to be added */ ! virtual void addCpuStat( jlong addHits, jlong addPureTime); /** Retrieves object's key. ** ! ** @param key where to store the key ** + ** @return key + ** ** @see Hash */ ! const CpuThreadMethodKey& getKey( CpuThreadMethodKey& key); /** Compares object with given key. ** ** @param key key + ** ** @return 1 (true); ** 0 (false) *************** *** 114,131 **** ** @see Hash */ ! int operator==(const CpuThreadMethodKey& key) { ! ! return (*thread == key.envId) && (*method == key.methodId); ! } /** Hash function. ** ! ** @param reference to a key ** @return hash value */ - - static int hashKey(const CpuThreadMethodKey& key) { ! return Thread::hashKey(key.envId) ^ Method::hashKey(key.methodId); ! } /** Performs deactivation. */ --- 109,121 ---- ** @see Hash */ ! int operator==( const CpuThreadMethodKey& key); /** Hash function. ** ! ** @param key reference to a key ! ** ** @return hash value */ ! static int hashKey( const CpuThreadMethodKey& key); /** Performs deactivation. */ *************** *** 133,136 **** --- 123,127 ---- void deactivate(); + #ifdef USE_ALLOCATOR private: *************** *** 142,150 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} public: --- 133,142 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif public: *************** *** 152,156 **** /** Class identification. ** ! ** @return unique class type identified */ virtual eClassIdent getClassIdent() { return CPU_THREAD_METHOD;} --- 144,148 ---- /** Class identification. ** ! ** @return unique class type identifier */ virtual eClassIdent getClassIdent() { return CPU_THREAD_METHOD;} *************** *** 162,166 **** ** 1 (active) */ ! virtual int isActive() { return (method->isActive() && thread->isActive());} /** Indication that object has changed its data. --- 154,158 ---- ** 1 (active) */ ! virtual int isActive(); /** Indication that object has changed its data. *************** *** 173,181 **** /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged() { ! ! IdObject::setUnchanged(); ! clearDataChanged(); ! } }; --- 165,169 ---- /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged(); }; Index: cpuThreadTrace.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/cpuThreadTrace.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** cpuThreadTrace.cpp 2001/09/18 22:19:28 1.7 --- cpuThreadTrace.cpp 2001/11/21 22:31:42 1.8 *************** *** 33,39 **** */ ! #include "../main/includes.h" ! Allocator CpuThreadTrace::_allocator( sizeof( CpuThreadTrace)); void CpuThreadTrace::addCpuStat(jlong addHits, jlong addPureTime) { --- 33,44 ---- */ ! #include "../cpu/cpuThreadTrace.h" ! #include "../cpu/cpuThreadMethod.h" ! #include "../cpu/cpuTrace.h" ! #include "../prof/prof.h" ! #ifdef USE_ALLOCATOR ! Allocator CpuThreadTrace::_allocator; ! #endif void CpuThreadTrace::addCpuStat(jlong addHits, jlong addPureTime) { *************** *** 47,49 **** --- 52,82 ---- Prof::prof().activeCpuThreadTraces.removeNoRehash(this); + } + + const CpuThreadTraceKey& CpuThreadTrace::getKey(CpuThreadTraceKey& key) { + + threadMethod->thread->getKey(key.envId); + trace->getKey(key.traceKey); + return key; + } + + int CpuThreadTrace::operator==(const CpuThreadTraceKey& key) { + + return (*threadMethod->thread == key.envId) && (*trace == key.traceKey); + } + + int CpuThreadTrace::hashKey(const CpuThreadTraceKey& key) { + + return Thread::hashKey(key.envId) ^ Trace::hashKey(key.traceKey); + } + + int CpuThreadTrace::isActive() { + + return (trace->isActive() && threadMethod->isActive()); + } + + void CpuThreadTrace::setUnchanged() { + + IdObject::setUnchanged(); + clearDataChanged(); } Index: cpuThreadTrace.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/cpuThreadTrace.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** cpuThreadTrace.h 2001/09/02 20:14:21 1.9 --- cpuThreadTrace.h 2001/11/21 22:31:42 1.10 *************** *** 36,53 **** #define _CPU_THREAD_TRACE_H_ ! /** Key for CpuThreadTrace class. ! ** Used for searching in hash tables. ! ** ! ** @author Petr Luner */ ! ! struct CpuThreadTraceKey { - /// thread ID - JNIEnv* envId; - - /// trace key - TraceKey traceKey; - }; - /** Crossroad of threads and traces for CPU profiling. ** This class consists of statistic information about --- 36,46 ---- #define _CPU_THREAD_TRACE_H_ ! #include "../main/includes.h" ! #include "../list/listItem.h" ! #include "../commun2/idObject.h" ! #include "../cpu/cpuStatData.h" ! #include "../cpu/cpuThreadTraceKey.h" ! #include "../allocator/allocator.h" /** Crossroad of threads and traces for CPU profiling. ** This class consists of statistic information about *************** *** 58,66 **** ** @author Petr Luner */ ! class CpuThreadTrace: public IdObject, ! public LI1, ! public LI2, ! public LI3, ! public CpuStatData { public: --- 51,59 ---- ** @author Petr Luner */ ! class CpuThreadTrace: public LI1, ! public LI2, ! public LI3, ! public IdObject, ! public CpuStatData { public: *************** *** 78,83 **** threadMethod( NULL), trace( NULL) ! {}; /** Updates CPU statistics. --- 71,79 ---- threadMethod( NULL), trace( NULL) + + {} ! /// Destructor. ! virtual ~CpuThreadTrace() {} /** Updates CPU statistics. *************** *** 85,110 **** ** and CpuThreadMethod. ** ! ** @param addHits number of hits to be added ! ** @param addPureTime pure time to be added */ ! virtual void addCpuStat(jlong addHits, jlong addPureTime); /** Retrieves object's key. ** ! ** @param key where to store the key ** @return key ** ** @see Hash */ ! const CpuThreadTraceKey& getKey(CpuThreadTraceKey& key) { ! ! threadMethod->thread->getKey(key.envId); ! trace->getKey(key.traceKey); ! return key; ! } /** Compares object with given key. ** ** @param key key ** @return 1 (true); ** 0 (false) --- 81,103 ---- ** and CpuThreadMethod. ** ! ** @param addHits number of hits to be added ! ** @param addPureTime pure time to be added */ ! virtual void addCpuStat( jlong addHits, jlong addPureTime); /** Retrieves object's key. ** ! ** @param key where to store the key ! ** ** @return key ** ** @see Hash */ ! const CpuThreadTraceKey& getKey( CpuThreadTraceKey& key); /** Compares object with given key. ** ** @param key key + ** ** @return 1 (true); ** 0 (false) *************** *** 112,129 **** ** @see Hash */ ! int operator==(const CpuThreadTraceKey& key) { ! ! return (*threadMethod->thread == key.envId) && (*trace == key.traceKey); ! } /** Hash function. ** ! ** @param reference to a key ** @return hash value */ - - static int hashKey(const CpuThreadTraceKey& key) { ! return Thread::hashKey(key.envId) ^ Trace::hashKey(key.traceKey); ! } /** Performs deactivation. */ --- 105,117 ---- ** @see Hash */ ! int operator==( const CpuThreadTraceKey& key); /** Hash function. ** ! ** @param key reference to a key ! ** ** @return hash value */ ! static int hashKey( const CpuThreadTraceKey& key); /** Performs deactivation. */ *************** *** 131,134 **** --- 119,123 ---- void deactivate(); + #ifdef USE_ALLOCATOR private: *************** *** 140,148 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} public: --- 129,138 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif public: *************** *** 150,154 **** /** Class identification. ** ! ** @return unique class type identified */ virtual eClassIdent getClassIdent() { return CPU_THREAD_TRACE;} --- 140,144 ---- /** Class identification. ** ! ** @return unique class type identifier */ virtual eClassIdent getClassIdent() { return CPU_THREAD_TRACE;} *************** *** 160,164 **** ** 1 (active) */ ! virtual int isActive() { return (trace->isActive() && threadMethod->isActive());} /** Indication that object has changed its data. --- 150,154 ---- ** 1 (active) */ ! virtual int isActive(); /** Indication that object has changed its data. *************** *** 171,179 **** /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged() { ! ! IdObject::setUnchanged(); ! clearDataChanged(); ! } }; --- 161,165 ---- /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged(); }; Index: cpuTrace.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/cpuTrace.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** cpuTrace.cpp 2001/09/18 22:19:28 1.7 --- cpuTrace.cpp 2001/11/21 22:31:42 1.8 *************** *** 33,39 **** */ ! #include "../main/includes.h" ! Allocator CpuTrace::_allocator( sizeof( CpuTrace)); void CpuTrace::addCpuStat(jlong addHits, jlong addPureTime) { --- 33,43 ---- */ ! #include "../cpu/cpuTrace.h" ! #include "../shared/method.h" ! #include "../prof/prof.h" ! #ifdef USE_ALLOCATOR ! Allocator CpuTrace::_allocator; ! #endif void CpuTrace::addCpuStat(jlong addHits, jlong addPureTime) { *************** *** 46,48 **** --- 50,63 ---- Prof::prof().activeCpuTraces.removeNoRehash(this); + } + + int CpuTrace::isActive() { + + return method->isActive(); + } + + void CpuTrace::setUnchanged() { + + IdObject::setUnchanged(); + clearDataChanged(); } Index: cpuTrace.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/cpuTrace.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** cpuTrace.h 2001/09/02 20:14:21 1.9 --- cpuTrace.h 2001/11/21 22:31:42 1.10 *************** *** 36,39 **** --- 36,48 ---- #define _CPU_TRACE_H_ + #include "../main/includes.h" + #include "../list/listItem.h" + #include "../commun2/idObject.h" + #include "../shared/trace.h" + #include "../cpu/cpuStatData.h" + #include "../list/list.h" + #include "../cpu/cpuThreadTrace.h" + #include "../allocator/allocator.h" + /** Trace for CPU profiling. ** We decided to use different traces *************** *** 44,52 **** ** @author Petr Luner */ ! class CpuTrace: public IdObject, ! public LI1, ! public LI2, public Trace, ! public CpuStatData { public: --- 53,61 ---- ** @author Petr Luner */ ! class CpuTrace: public LI1, ! public LI2, ! public IdObject, public Trace, ! public CpuStatData { public: *************** *** 63,74 **** method( NULL) ! {}; /** Updates CPU statistics. ** Also updates CPU statistics of corresponding method. ** ! ** @param addHits number of hits to be added ! ** @param addPureTime pure time to be added */ virtual void addCpuStat(jlong addHits, jlong addPureTime); --- 72,86 ---- method( NULL) + + {} ! /// Destructor. ! virtual ~CpuTrace() {} /** Updates CPU statistics. ** Also updates CPU statistics of corresponding method. ** ! ** @param addHits number of hits to be added ! ** @param addPureTime pure time to be added */ virtual void addCpuStat(jlong addHits, jlong addPureTime); *************** *** 78,81 **** --- 90,94 ---- void deactivate(); + #ifdef USE_ALLOCATOR private: *************** *** 87,95 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} public: --- 100,109 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif public: *************** *** 97,101 **** /** Class identification. ** ! ** @return unique class type identified */ virtual eClassIdent getClassIdent() { return CPU_TRACE;} --- 111,115 ---- /** Class identification. ** ! ** @return unique class type identifier */ virtual eClassIdent getClassIdent() { return CPU_TRACE;} *************** *** 107,111 **** ** 1 (active) */ ! virtual int isActive() { return method->isActive();} /** Indication that object has changed its data. --- 121,125 ---- ** 1 (active) */ ! virtual int isActive(); /** Indication that object has changed its data. *************** *** 118,126 **** /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged() { ! ! IdObject::setUnchanged(); ! clearDataChanged(); ! } }; --- 132,136 ---- /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged(); }; Index: dir.info =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/dir.info,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** dir.info 2001/07/30 15:41:26 1.4 --- dir.info 2001/11/21 22:31:42 1.5 *************** *** 1,3 **** FILES = cpuStack cpuStatData cpuThreadMethod cpuThreadTrace cpuTrace sampling - CLEAN_FILES = *.pdb *.obj *.o --- 1,2 ---- Index: sampling.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/sampling.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** sampling.cpp 2001/09/18 22:19:28 1.9 --- sampling.cpp 2001/11/21 22:31:42 1.10 *************** *** 33,42 **** */ ! #include "../main/includes.h" ! Sampling::Sampling() { _cmd = CMD_TURN_ON; #ifdef WIN32 _turnedOn = CreateEvent(NULL, TRUE, TRUE, NULL); --- 33,54 ---- */ ! #include "../cpu/sampling.h" ! #include "../prof/prof.h" ! #include "../delay/delay.h" ! #include "../prof/synchronized.h" ! #include "../cpu/cpuThreadMethod.h" ! #include "../cpu/cpuThreadTrace.h" ! #include "../cpu/cpuTrace.h" ! Sampling::Sampling( JVMPI_Interface* jvmpi) : + #ifdef USE_RAW_MONITORS + _lock( "_sampling_raw_monitor", jvmpi), + #endif + _terminated( 1) { + _cmd = CMD_TURN_ON; + #ifndef USE_RAW_MONITORS #ifdef WIN32 _turnedOn = CreateEvent(NULL, TRUE, TRUE, NULL); *************** *** 46,49 **** --- 58,62 ---- pthread_mutex_init(&_mutex, NULL); #endif + #endif #ifdef _DEBUG *************** *** 56,59 **** --- 69,73 ---- Sampling::~Sampling() { + #ifndef USE_RAW_MONITORS #ifdef WIN32 CloseHandle(_turnedOn); *************** *** 63,70 **** --- 77,87 ---- pthread_mutex_destroy(&_mutex); #endif + #endif } void Sampling::main() { + _terminated = 0; + Prof* _prof = &Prof::prof(); unsigned long waitTime = 1; *************** *** 74,98 **** unsigned long endTime; ! #ifdef _DEBUG start = Delay::getMilliticks(); ! #endif for (;;) { #ifdef WIN32 - WaitForSingleObject(_turnedOn, INFINITE); - #else - pthread_mutex_lock(&_mutex); while (_cmd == CMD_TURN_OFF) pthread_cond_wait(&_cond, &_mutex); pthread_mutex_unlock(&_mutex); #endif ! if (_cmd == CMD_TERMINATE) return; _prof->gcLock.wait(); _prof->jvmpiInterface->DisableGC(); --- 91,125 ---- unsigned long endTime; ! #ifdef _DEBUG start = Delay::getMilliticks(); ! #endif for (;;) { + #ifndef USE_RAW_MONITORS #ifdef WIN32 WaitForSingleObject(_turnedOn, INFINITE); #else pthread_mutex_lock(&_mutex); while (_cmd == CMD_TURN_OFF) pthread_cond_wait(&_cond, &_mutex); pthread_mutex_unlock(&_mutex); + #endif + #endif + #ifdef USE_RAW_MONITORS + Synchronized sync( _lock); #endif ! if (_cmd == CMD_TERMINATE) { + _terminated = 1; + return; + } + + #ifdef USE_RAW_MONITORS + sync.release(); + #endif + _prof->gcLock.wait(); _prof->jvmpiInterface->DisableGC(); *************** *** 110,116 **** endTime = Delay::getMilliticks(); ! #ifdef _DEBUG finish = endTime; ! #endif _prof->dataLock.release(); --- 137,143 ---- endTime = Delay::getMilliticks(); ! #ifdef _DEBUG finish = endTime; ! #endif _prof->dataLock.release(); *************** *** 136,141 **** int Sampling::startThread(int turnedOn) { #ifdef WIN32 - if (turnedOn) { --- 163,168 ---- int Sampling::startThread(int turnedOn) { + #ifndef USE_RAW_MONITORS #ifdef WIN32 if (turnedOn) { *************** *** 148,157 **** ResetEvent(_turnedOn); } - #else - if (turnedOn) _cmd = CMD_TURN_ON; else _cmd = CMD_TURN_OFF; #endif --- 175,188 ---- ResetEvent(_turnedOn); } #else if (turnedOn) _cmd = CMD_TURN_ON; else _cmd = CMD_TURN_OFF; + #endif + #else + if( !turnedOn) { + _cmd = CMD_TURN_OFF; + return 0; + } #endif *************** *** 163,168 **** void Sampling::terminateThread() { #ifdef WIN32 - EnterCriticalSection(&_cs); --- 194,199 ---- void Sampling::terminateThread() { + #ifndef USE_RAW_MONITORS #ifdef WIN32 EnterCriticalSection(&_cs); *************** *** 171,177 **** LeaveCriticalSection(&_cs); - #else - pthread_mutex_lock(&_mutex); --- 202,206 ---- *************** *** 180,191 **** pthread_mutex_unlock(&_mutex); ! #endif } void Sampling::turnOn() { #ifdef WIN32 - EnterCriticalSection(&_cs); --- 209,223 ---- pthread_mutex_unlock(&_mutex); ! #endif ! #else ! Synchronized sync( _lock); ! _cmd = CMD_TERMINATE; #endif } + #ifndef USE_RAW_MONITORS void Sampling::turnOn() { #ifdef WIN32 EnterCriticalSection(&_cs); *************** *** 197,203 **** LeaveCriticalSection(&_cs); - #else - pthread_mutex_lock(&_mutex); --- 229,233 ---- *************** *** 209,213 **** pthread_mutex_unlock(&_mutex); - #endif } --- 239,242 ---- *************** *** 216,220 **** #ifdef WIN32 - EnterCriticalSection(&_cs); --- 245,248 ---- *************** *** 226,232 **** LeaveCriticalSection(&_cs); - #else - pthread_mutex_lock(&_mutex); --- 254,258 ---- *************** *** 237,243 **** pthread_mutex_unlock(&_mutex); - #endif } void Sampling::doOneSample() { --- 263,269 ---- pthread_mutex_unlock(&_mutex); #endif } + #endif // !USE_RAW_MONITORS void Sampling::doOneSample() { *************** *** 254,260 **** CpuStatData* stat; ! #ifdef _DEBUG samples++; ! #endif if (_prof->setup.cpu.level == Setup::LEVEL_METHOD) traceDepth = 1; --- 280,286 ---- CpuStatData* stat; ! #ifdef _DEBUG samples++; ! #endif if (_prof->setup.cpu.level == Setup::LEVEL_METHOD) traceDepth = 1; *************** *** 349,351 **** --- 375,386 ---- Prof::prof().sampling.main(); + } + + int Sampling::isTerminated() { + + #ifdef USE_RAW_MONITORS + Synchronized sync( _lock); + #endif + + return _terminated; } Index: sampling.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/sampling.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** sampling.h 2001/09/02 20:14:21 1.8 --- sampling.h 2001/11/21 22:31:43 1.9 *************** *** 36,39 **** --- 36,42 ---- #define _SAMPLING_H_ + #include "../main/includes.h" + #include "../prof/lock.h" + /** CPU Sampling. ** This class implements sampling method for CPU profiling. *************** *** 53,64 **** }; /// current command CMD _cmd; #ifdef WIN32 /// handle to 'turned on' event object HANDLE _turnedOn; ! /// for thread control synchronization CRITICAL_SECTION _cs; #else --- 56,73 ---- }; + private: + /// current command CMD _cmd; + #ifdef USE_RAW_MONITORS + /// critical section + Lock _lock; + #else #ifdef WIN32 /// handle to 'turned on' event object HANDLE _turnedOn; ! /// thread synchronization control CRITICAL_SECTION _cs; #else *************** *** 69,87 **** pthread_mutex_t _mutex; #endif ! ! private: ! ! /// Thread main function. ! void main(); ! ! /// Performs one sample. ! void doOneSample(); public: ! /// Consctructor ! Sampling(); ! /// Destructor ~Sampling(); --- 78,93 ---- pthread_mutex_t _mutex; #endif ! #endif public: ! /** Constructor. It initializes locks needed ! ** while sampling. ! ** ! ** @param jvmpi pointer to JVMPI interface */ ! ! Sampling( JVMPI_Interface* jvmpi); ! /// Destructor. ~Sampling(); *************** *** 90,94 **** ** profiler start-up. ** ! ** @param turnedOn whether sampling is turned on or off ** ** @return 0 (ok) --- 96,100 ---- ** profiler start-up. ** ! ** @param turnedOn whether sampling is turned on or off ** ** @return 0 (ok) *************** *** 98,117 **** /** Terminates sampling thread. ! ** The operation is asynchronyous to prevent deadlocks. */ void terminateThread(); /** Turns sampling on. ! ** The operation is asynchronyous to prevent deadlocks. */ void turnOn(); /** Turns sampling off. ! ** The operation is asynchronyous to prevent deadlocks. */ void turnOff(); private: /** Start routine for sampling thread. ** --- 104,133 ---- /** Terminates sampling thread. ! ** The operation is asynchronous to prevent deadlocks. */ void terminateThread(); + #ifndef USE_RAW_MONITORS /** Turns sampling on. ! ** The operation is asynchronous to prevent deadlocks. */ void turnOn(); /** Turns sampling off. ! ** The operation is asynchronous to prevent deadlocks. */ void turnOff(); + #endif private: + /// Main thread function. + void main(); + + /// Performs one sample. + void doOneSample(); + + private: + /** Start routine for sampling thread. ** *************** *** 126,131 **** unsigned long finish; unsigned long samples; ! #endif }; --- 142,161 ---- unsigned long finish; unsigned long samples; + #endif // _DEBUG ! private: ! ! /// thread termination flag ! int _terminated; ! ! public: ! ! /** Returns true/false in dependance on sampling thread has ! ** been terminated or not yet. ! ** ! ** @return 1 (thread stopped); ! ** 0 (still runnning) */ ! ! int isTerminated(); }; |
Update of /cvsroot/javaprofiler/library/src/commun3 In directory usw-pr-cvs1:/tmp/cvs-serv12170/src/commun3 Modified Files: Makefile.rules communShMem.cpp communShMem.h dir.info semaphore.h sharedMemory.h Added Files: semaphore.cpp sharedMemory.cpp Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux --- NEW FILE: semaphore.cpp --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ #include "../commun3/semaphore.h" Semaphore::Semaphore( const String& name, int locked) { #ifdef WIN32 _semid = CreateSemaphore( NULL, (( locked) ? 0 : 1), 1, name); #else _semid = semget( *(key_t*)(const char*)name, 1, 0666 | IPC_CREAT); _initLocked = locked; #endif } Semaphore::~Semaphore() { #ifdef WIN32 CloseHandle( _semid); #else #endif } void Semaphore::wait() { #ifdef WIN32 WaitForSingleObject( _semid, INFINITE); Sleep( 0); #else if( _initLocked) { static sembuf sop = { 0, -1, SEM_UNDO}; semop( _semid, &sop, 1); } else { static sembuf sop[2] = { 0, 0, 0, 0, 1, SEM_UNDO}; semop( _semid, sop, 2); } #endif } void Semaphore::release() { #ifdef WIN32 ReleaseSemaphore( _semid, 1, NULL); //Sleep( 0); #else if( _initLocked) { static sembuf sop = { 0, 1, SEM_UNDO}; semop( _semid, &sop, 1); } else { static sembuf sop = { 0, -1, SEM_UNDO | IPC_NOWAIT}; semop( _semid, &sop, 1); } #endif } int Semaphore::waitNoBlock() { #ifdef WIN32 unsigned long rc = WaitForSingleObject( _semid, 0); Sleep( 0); if( rc == WAIT_FAILED) return -1; if( rc == WAIT_TIMEOUT) return 0; #else if( _initLocked) { static sembuf sop = { 0, -1, SEM_UNDO | IPC_NOWAIT}; if( semop( _semid, &sop, 1)) return 0; } else { static sembuf sop[2] = { 0, 0, IPC_NOWAIT, 0, 1, SEM_UNDO}; if( semop( _semid, sop, 2)) return 0; } #endif return 1; } --- NEW FILE: sharedMemory.cpp --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ #include "../commun3/sharedMemory.h" #include "../setup/setup.h" SharedMemory::SharedMemory( const String& name, int size) : _size( size) { #ifdef WIN32 _shmid = CreateFileMapping( INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE | SEC_COMMIT, 0, _size, name); _address = MapViewOfFile( _shmid, FILE_MAP_ALL_ACCESS, 0, 0, 0); #else _size = Setup::COMMUN_SHMEM_SIZE; _shmid = shmget( *(key_t*)(const char*)name, _size, 0666 | IPC_CREAT); _address = shmat( _shmid, NULL, 0666); #endif } SharedMemory::~SharedMemory() { #ifdef WIN32 UnmapViewOfFile( _address); CloseHandle( _shmid); #else shmdt( _address); #endif } Index: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun3/Makefile.rules,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Makefile.rules 2001/08/09 23:22:55 1.1 --- Makefile.rules 2001/11/21 22:31:42 1.2 *************** *** 1,3 **** communShMem.o \ ! communShMem.obj: communShMem.cpp ../main/includes.h $(CCC) $(CPPFLAGS) communShMem.cpp --- 1,11 ---- communShMem.o \ ! communShMem.obj: communShMem.cpp $(CCC) $(CPPFLAGS) communShMem.cpp + + semaphore.o \ + semaphore.obj: semaphore.cpp + $(CCC) $(CPPFLAGS) semaphore.cpp + + sharedMemory.o \ + sharedMemory.obj: sharedMemory.cpp + $(CCC) $(CPPFLAGS) sharedMemory.cpp Index: communShMem.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun3/communShMem.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** communShMem.cpp 2001/09/02 20:14:21 1.5 --- communShMem.cpp 2001/11/21 22:31:42 1.6 *************** *** 33,37 **** */ ! #include "../main/includes.h" Commun& CommunShMem::operator>>( Buffer& b) { --- 33,37 ---- */ ! #include "../commun3/communShMem.h" Commun& CommunShMem::operator>>( Buffer& b) { *************** *** 42,46 **** _isem.wait(); ! jint size = ntohl( *(jint*)p); if( size < 0) { --- 42,46 ---- _isem.wait(); ! jint size = (signed)ntohl( *(jint*)p); if( size < 0) { *************** *** 95,99 **** _isem.wait(); ! if( ntohl( *(jint*)p) < 0) { _failed = 1; --- 95,99 ---- _isem.wait(); ! if( (signed)ntohl( *(jint*)p) < 0) { _failed = 1; *************** *** 142,146 **** _isem.wait(); ! _failed = ( ntohl( *(jint*)_shmem.getAddress()) < 0); _isem.release(); --- 142,146 ---- _isem.wait(); ! _failed = ( (signed)ntohl( *(jint*)(_shmem.getAddress())) < 0); _isem.release(); *************** *** 156,160 **** _isem.wait(); ! *(jint*)_shmem.getAddress() = htonl( 0); _failed = 0; _isem.release(); --- 156,160 ---- _isem.wait(); ! *(jint*)(_shmem.getAddress()) = htonl( 0); _failed = 0; _isem.release(); *************** *** 164,166 **** --- 164,196 ---- return 1; + } + + CommunShMem::CommunShMem( const String& shmemId, int size) : + + _sem1( String( "1") + shmemId + "XXXXXXXXXX"), + _sem2( String( "2") + shmemId + "XXXXXXXXXX"), + _isem( String( "3") + shmemId + "XXXXXXXXXX", 1), + _shmem( String( "4") + shmemId + "XXXXXXXXXX", size) { + + _sem1.release(); + _sem1.wait(); + + _sem2.release(); + _sem2.wait(); + + *(jint*)(_shmem.getAddress()) = htonl( 0); + + _isem.release(); + }; + + CommunShMem::~CommunShMem() { + + _isem.wait(); + + _sem2.release(); + _sem1.release(); + + *(jint*)(_shmem.getAddress()) = htonl( (unsigned)(-1)); + + _isem.release(); } Index: communShMem.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun3/communShMem.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** communShMem.h 2001/09/02 20:14:21 1.4 --- communShMem.h 2001/11/21 22:31:42 1.5 *************** *** 36,39 **** --- 36,46 ---- #define _COMMUN_SH_MEM_H_ + #include "../main/includes.h" + #include "../commun/commun.h" + #include "../commun3/semaphore.h" + #include "../commun3/sharedMemory.h" + #include "../string/string.h" + #include "../commun/buffer.h" + /** Shared memory communication. This class implements shared memory ** communication and offers the user of this class the standard *************** *** 48,53 **** class CommunShMem: public Commun { - private: - /// read-write semaphore Semaphore _sem1; --- 55,58 ---- *************** *** 69,104 **** ** ** @param shmemId shared memory identifier (3 characters long only) ! ** @param size shared memory size */ ! ! CommunShMem( const String& shmemId, int size) : ! ! _sem1( String( "1") + shmemId + "XXXXXXXXXX"), ! _sem2( String( "2") + shmemId + "XXXXXXXXXX"), ! _isem( String( "3") + shmemId + "XXXXXXXXXX", 1), ! _shmem( String( "4") + shmemId + "XXXXXXXXXX", size) { ! ! _sem1.release(); ! _sem1.wait(); ! _sem2.release(); ! _sem2.wait(); - *(jint*)_shmem.getAddress() = htonl( 0); - - _isem.release(); - }; - /// Destructor. ! virtual ~CommunShMem() { ! ! _isem.wait(); ! ! _sem2.release(); ! _sem1.release(); ! ! *(jint*)_shmem.getAddress() = htonl( -1); ! ! _isem.release(); ! } /** Initialization of communication. This method only waits --- 74,83 ---- ** ** @param shmemId shared memory identifier (3 characters long only) ! ** @param size shared memory size */ ! CommunShMem( const String& shmemId, int size); /// Destructor. ! virtual ~CommunShMem(); /** Initialization of communication. This method only waits Index: dir.info =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun3/dir.info,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** dir.info 2001/08/09 23:22:55 1.1 --- dir.info 2001/11/21 22:31:42 1.2 *************** *** 1,3 **** ! FILES = communShMem ! CLEAN_FILES = *.pdb *.obj *.o --- 1,2 ---- ! FILES = communShMem semaphore sharedMemory CLEAN_FILES = *.pdb *.obj *.o Index: semaphore.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun3/semaphore.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** semaphore.h 2001/09/02 20:14:21 1.5 --- semaphore.h 2001/11/21 22:31:42 1.6 *************** *** 36,39 **** --- 36,42 ---- #define _SEMAPHORE_H_ + #include "../main/includes.h" + #include "../string/string.h" + /** Binary semaphore. This class implements IPC semaphore. ** Implementation of this class is platform/system dependent. *************** *** 59,83 **** ** If semaphore doesn't exist, new one is created. ** ! ** @param name unique name (4 characters long only) ** @param locked semaphore should be locked after it has been initialized */ ! Semaphore( const String& name, int locked = 0) { - #ifdef WIN32 - _semid = CreateSemaphore( NULL, (( locked) ? 0 : 1), 1, name); - #else - _semid = semget( *(key_t*)(const char*)name, 1, 0666 | IPC_CREAT); - _initLocked = locked; - #endif - } - /// Destructor. ! ~Semaphore() { ! ! #ifdef WIN32 ! CloseHandle( _semid); ! #else ! #endif ! } /** Lock semaphore. If the semaphore is already locked, --- 62,72 ---- ** If semaphore doesn't exist, new one is created. ** ! ** @param name unique name (4 characters long only) ** @param locked semaphore should be locked after it has been initialized */ ! Semaphore( const String& name, int locked = 0); /// Destructor. ! ~Semaphore(); /** Lock semaphore. If the semaphore is already locked, *************** *** 86,108 **** ** ** @see release() */ - - void wait() { - - #ifdef WIN32 - WaitForSingleObject( _semid, INFINITE); - Sleep( 0); - #else - if( _initLocked) { ! static sembuf sop = { 0, -1, SEM_UNDO}; ! semop( _semid, &sop, 1); ! } ! else { ! ! static sembuf sop[2] = { 0, 0, 0, 0, 1, SEM_UNDO}; ! semop( _semid, sop, 2); ! } ! #endif ! } /** Unlock semaphore. This method releases semaphore --- 75,80 ---- ** ** @see release() */ ! void wait(); /** Unlock semaphore. This method releases semaphore *************** *** 111,133 **** ** @see wait() */ ! void release() { - #ifdef WIN32 - ReleaseSemaphore( _semid, 1, NULL); - // Sleep( 0); - #else - if( _initLocked) { - - static sembuf sop = { 0, 1, SEM_UNDO}; - semop( _semid, &sop, 1); - } - else { - - static sembuf sop = { 0, -1, SEM_UNDO | IPC_NOWAIT}; - semop( _semid, &sop, 1); - } - #endif - } - /** Lock semaphore but don't block. This method locks semaphore ** if it is possible, if not, it returns immediatelly without locking. --- 83,88 ---- ** @see wait() */ ! void release(); /** Lock semaphore but don't block. This method locks semaphore ** if it is possible, if not, it returns immediatelly without locking. *************** *** 136,164 **** ** 1 (okay, successfully locked); ** -1 (failure) */ - - int waitNoBlock() { ! #ifdef WIN32 ! unsigned long rc = WaitForSingleObject( _semid, 0); ! Sleep( 0); ! ! if( rc == WAIT_FAILED) return -1; ! if( rc == WAIT_TIMEOUT) return 0; ! #else ! if( _initLocked) { ! ! static sembuf sop = { 0, -1, SEM_UNDO | IPC_NOWAIT}; ! if( semop( _semid, &sop, 1)) return 0; ! } ! else { ! ! static sembuf sop[2] = { 0, 0, IPC_NOWAIT, 0, 1, SEM_UNDO}; ! if( semop( _semid, sop, 2)) return 0; ! } ! #endif ! return 1; ! } }; #endif // _SEMAPHORE_H_ - --- 91,97 ---- ** 1 (okay, successfully locked); ** -1 (failure) */ ! int waitNoBlock(); }; #endif // _SEMAPHORE_H_ Index: sharedMemory.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun3/sharedMemory.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** sharedMemory.h 2001/09/02 20:14:21 1.4 --- sharedMemory.h 2001/11/21 22:31:42 1.5 *************** *** 36,39 **** --- 36,42 ---- #define _SHARED_MEMORY_H_ + #include "../main/includes.h" + #include "../string/string.h" + /** Shared memory. This class manages IPC shared memory. ** Implementation of this class is platform/system dependent. *************** *** 69,85 **** ** @param name name of shared block of memory ** @param size size of shared memory (in bytes) */ - - SharedMemory( const String& name, int size) : _size( size) { ! #ifdef WIN32 ! _shmid = CreateFileMapping( INVALID_HANDLE_VALUE, NULL, ! PAGE_READWRITE | SEC_COMMIT, 0, _size, name); ! _address = MapViewOfFile( _shmid, FILE_MAP_ALL_ACCESS, 0, 0, 0); ! #else ! _size = IProf::COMMUN_SHMEM_SIZE; ! _shmid = shmget( *(key_t*)(const char*)name, _size, 0666 | IPC_CREAT); ! _address = shmat( _shmid, NULL, 0666); ! #endif ! } /** Destructor. It deattaches attached shared memory --- 72,77 ---- ** @param name name of shared block of memory ** @param size size of shared memory (in bytes) */ ! SharedMemory( const String& name, int size); /** Destructor. It deattaches attached shared memory *************** *** 87,99 **** ** block of shared memory is destroyed. */ ! ~SharedMemory() { ! ! #ifdef WIN32 ! UnmapViewOfFile( _address); ! CloseHandle( _shmid); ! #else ! shmdt( _address); ! #endif ! } /** Address of shared memory block. This method returns --- 79,83 ---- ** block of shared memory is destroyed. */ ! ~SharedMemory(); /** Address of shared memory block. This method returns *************** *** 113,115 **** #endif // _SHARED_MEMORY_H_ - --- 97,98 ---- |
Update of /cvsroot/javaprofiler/library/src/commun2 In directory usw-pr-cvs1:/tmp/cvs-serv12170/src/commun2 Modified Files: Makefile.rules counter.h dir.info idObject.h objectTable.cpp objectTable.h prof_interface.cpp Added Files: counter.cpp idObject.cpp Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux --- NEW FILE: counter.cpp --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ #include "../commun2/counter.h" Counter* Counter::getCounter() { static Counter c; return &c; } --- NEW FILE: idObject.cpp --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ #include "../commun2/idObject.h" #include "../commun2/counter.h" IdObject::IdObject() : _active( 0) { Counter* p = Counter::getCounter(); profId = p->getValue(); p->table.add( new ObjectTable( profId, this)); } int IdObject::activeChanged() { if( _active != isActive()) { _active = isActive(); return 1; } return 0; } Index: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun2/Makefile.rules,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** Makefile.rules 2001/07/28 04:11:17 1.3 --- Makefile.rules 2001/11/21 22:31:42 1.4 *************** *** 1,11 **** ! communThread.o \ ! communThread.obj: communThread.cpp ../main/includes.h ! $(CCC) $(CPPFLAGS) communThread.cpp objectTable.o \ ! objectTable.obj: objectTable.cpp ../main/includes.h $(CCC) $(CPPFLAGS) objectTable.cpp prof_interface.o \ ! prof_interface.obj: prof_interface.cpp ../main/includes.h $(CCC) $(CPPFLAGS) prof_interface.cpp --- 1,15 ---- ! counter.o \ ! counter.obj: counter.cpp ! $(CCC) $(CPPFLAGS) counter.cpp + idObject.o \ + idObject.obj: idObject.cpp + $(CCC) $(CPPFLAGS) idObject.cpp + objectTable.o \ ! objectTable.obj: objectTable.cpp $(CCC) $(CPPFLAGS) objectTable.cpp prof_interface.o \ ! prof_interface.obj: prof_interface.cpp $(CCC) $(CPPFLAGS) prof_interface.cpp Index: counter.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun2/counter.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** counter.h 2001/09/02 20:14:21 1.3 --- counter.h 2001/11/21 22:31:42 1.4 *************** *** 36,39 **** --- 36,44 ---- #define _COUNTER_H_ + #include "../main/includes.h" + #include "../hash/hash.h" + #include "../list/listItem.h" + #include "../commun2/objectTable.h" + /** Internal counter. This class implements counter. ** Each call to getValue() method increments stored *************** *** 65,69 **** _value( 1) ! {}; /** Get current value. This method returns current value --- 70,74 ---- _value( 1) ! {} /** Get current value. This method returns current value *************** *** 80,90 **** ** @return pointer to object */ ! static Counter* getCounter() { ! ! static Counter c; ! return &c; ! } }; #endif // _COUNTER_H_ - --- 85,90 ---- ** @return pointer to object */ ! static Counter* getCounter(); }; #endif // _COUNTER_H_ Index: dir.info =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun2/dir.info,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** dir.info 2001/08/05 01:37:10 1.4 --- dir.info 2001/11/21 22:31:42 1.5 *************** *** 1,3 **** ! FILES = objectTable prof_interface ! CLEAN_FILES = *.pdb *.obj *.o --- 1,2 ---- ! FILES = counter idObject objectTable prof_interface CLEAN_FILES = *.pdb *.obj *.o Index: idObject.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun2/idObject.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** idObject.h 2001/09/02 20:14:21 1.8 --- idObject.h 2001/11/21 22:31:42 1.9 *************** *** 36,39 **** --- 36,41 ---- #define _ID_OBJECT_H_ + #include "../main/includes.h" + /** Unique ID of object. Each class inherited from this ** class contains special private unique ID. Each instance *************** *** 57,63 **** enum eClassIdent { ! ALLOC = 1, // 001b ! CPU = 2, // 010b ! MON = 4, // 100b ALLOC_ARENA = ( 1 << 8), --- 59,65 ---- enum eClassIdent { ! ALLOC = 1, // 0001b ! CPU = 2, // 0010b ! MON = 4, // 0100b ALLOC_ARENA = ( 1 << 8), *************** *** 74,78 **** CPU_THREAD_TRACE = (12 << 8) | CPU, CPU_TRACE = (13 << 8) | CPU, ! GARBAGE_C = (14 << 8), // don't use GC !!! CLASS = (15 << 8), CLASS_FIELD = (16 << 8), --- 76,80 ---- CPU_THREAD_TRACE = (12 << 8) | CPU, CPU_TRACE = (13 << 8) | CPU, ! GARBAGE_C = (14 << 8), // don't use GC as a name of type !!! CLASS = (15 << 8), CLASS_FIELD = (16 << 8), *************** *** 91,101 **** ** to special ObjectTable hashtable. */ ! IdObject() : ! ! _active( 0) { ! ! profId = Counter::getCounter()->getValue(); ! Counter::getCounter()->table.add( new ObjectTable( profId, this)); ! } /** Get object ID. This method returns ID --- 93,100 ---- ** to special ObjectTable hashtable. */ ! IdObject(); ! ! /// Destructor. ! virtual ~IdObject() {} /** Get object ID. This method returns ID *************** *** 120,124 **** /** Class identification. ** ! ** @return unique class type identified */ virtual eClassIdent getClassIdent() = 0; --- 119,123 ---- /** Class identification. ** ! ** @return unique class type identifier */ virtual eClassIdent getClassIdent() = 0; *************** *** 137,150 **** ** 1 (changed) */ ! int activeChanged() { ! ! if( _active != isActive()) { ! ! _active = isActive(); ! return 1; ! } ! ! return 0; ! } /** Indication that object has changed its data. --- 136,140 ---- ** 1 (changed) */ ! int activeChanged(); /** Indication that object has changed its data. *************** *** 161,163 **** #endif // _ID_OBJECT_H_ - --- 151,152 ---- Index: objectTable.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun2/objectTable.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** objectTable.cpp 2001/09/02 20:14:21 1.2 --- objectTable.cpp 2001/11/21 22:31:42 1.3 *************** *** 33,37 **** */ ! #include "../main/includes.h" ! Allocator ObjectTable::_allocator( sizeof( ObjectTable)); --- 33,39 ---- */ ! #include "../commun2/objectTable.h" ! #ifdef USE_ALLOCATOR ! Allocator ObjectTable::_allocator; ! #endif Index: objectTable.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun2/objectTable.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** objectTable.h 2001/09/02 20:14:21 1.5 --- objectTable.h 2001/11/21 22:31:42 1.6 *************** *** 36,44 **** #define _OBJECT_TABLE_H_ /** Couple (object_id, pointer_to_object). This class consists ** of two items: unique ID of the object in profiler library's memory ** (having information about corresponding Java object) and ** pointer to this object. ID is used during the communication ! ** between Java and C++ parts of Java profiler, ID uniquely ** identifies the object - pointers to objects cannot be transfered ** between Java and C++ - profiled JVM can be run on various platforms --- 36,48 ---- #define _OBJECT_TABLE_H_ + #include "../main/includes.h" + #include "../list/listItem.h" + #include "../allocator/allocator.h" + /** Couple (object_id, pointer_to_object). This class consists ** of two items: unique ID of the object in profiler library's memory ** (having information about corresponding Java object) and ** pointer to this object. ID is used during the communication ! ** between Java and C++ part of Java profiler, ID uniquely ** identifies the object - pointers to objects cannot be transfered ** between Java and C++ - profiled JVM can be run on various platforms *************** *** 71,92 **** id( i), obj( o) ! {}; /** Retrieves object's key. ** ! ** @param key where to store the key ! ** @return key ** ** @see Hash */ ! const jint& getKey(jint& key) { ! ! return key = id; ! } /** Compares object with given key. ** ** @param key key ** @return 1 (true); ** 0 (false) --- 75,98 ---- id( i), obj( o) + + {} ! /// Destructor. ! virtual ~ObjectTable() {} /** Retrieves object's key. + ** + ** @param key where to store the key ** ! ** @return key ** ** @see Hash */ ! const jint& getKey( jint& key) { return key = id;} /** Compares object with given key. ** ** @param key key + ** ** @return 1 (true); ** 0 (false) *************** *** 94,112 **** ** @see Hash */ ! int operator==(const jint& key) { ! ! return (id == key); ! } /** Hash function. ** ! ** @param reference to a key ** @return hash value */ - - static int hashKey(const jint& key) { ! return (int)key; ! } private: --- 100,114 ---- ** @see Hash */ ! int operator==( const jint& key) { return (id == key);} /** Hash function. ** ! ** @param key reference to a key ! ** ** @return hash value */ ! static int hashKey( const jint& key) { return (int)key;} + #ifdef USE_ALLOCATOR private: *************** *** 118,126 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} }; --- 120,129 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif }; Index: prof_interface.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun2/prof_interface.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** prof_interface.cpp 2001/09/02 20:14:21 1.12 --- prof_interface.cpp 2001/11/21 22:31:42 1.13 *************** *** 33,37 **** */ ! #include "../main/includes.h" void Prof::shutdown() { --- 33,60 ---- */ ! #include "../prof/prof.h" ! #include "../prof/synchronized.h" [...1197 lines suppressed...] + break; + } + case IdObject::CPU_TRACE: { // optionalArg ... number of hits + + CpuStatData* cpu = static_cast<CpuTrace*>( o); + if( cpu->hits < optionalArg) return 0; + + break; + } + case IdObject::MON_TRACE: { // optionalArg ... number of hits + + MonStatData* mon = static_cast<MonTrace*>( o); + if( mon->hits < optionalArg) return 0; + + break; + } + } + + return 1; } |
Update of /cvsroot/javaprofiler/library/src/alloc In directory usw-pr-cvs1:/tmp/cvs-serv12170/src/alloc Modified Files: Makefile.rules allocAbstractStatThreadObject.h allocArena.cpp allocArena.h allocGlobalRef.cpp allocGlobalRef.h allocInstance.cpp allocInstance.h allocObject.cpp allocObject.h allocObjectMethod.cpp allocObjectMethod.h allocObjectTrace.cpp allocObjectTrace.h allocStatData.cpp allocStatData.h allocThreadMethod.cpp allocThreadMethod.h allocThreadObject.cpp allocThreadObject.h allocThreadObjectMethod.cpp allocThreadObjectMethod.h allocThreadObjectTrace.cpp allocThreadObjectTrace.h allocThreadTrace.cpp allocThreadTrace.h allocTrace.cpp allocTrace.h dir.info Added Files: allocAbstractStatThreadObject.cpp allocObjectKey.h allocObjectMethodKey.h allocObjectTraceKey.h allocThreadMethodKey.h allocThreadObjectKey.h allocThreadObjectMethodKey.h allocThreadObjectTraceKey.h allocThreadTraceKey.h Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux --- NEW FILE: allocAbstractStatThreadObject.cpp --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ #include "../alloc/allocAbstractStatThreadObject.h" void AllocAbstractStatThreadObject::addMemoryStat( jint size) { if( !_flagModified) AllocStatData::addMemoryStat( size); _flagModified = 1; } void AllocAbstractStatThreadObject::subMemoryStat( jint size) { if( !_flagModified) AllocStatData::subMemoryStat( size); _flagModified = 1; } Index: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/Makefile.rules,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** Makefile.rules 2001/07/28 04:11:17 1.4 --- Makefile.rules 2001/11/21 22:31:41 1.5 *************** *** 1,51 **** allocObjectMethod.o \ ! allocObjectMethod.obj: allocObjectMethod.cpp ../main/includes.h $(CCC) $(CPPFLAGS) allocObjectMethod.cpp allocThreadObjectTrace.o \ ! allocThreadObjectTrace.obj: allocThreadObjectTrace.cpp ../main/includes.h $(CCC) $(CPPFLAGS) allocThreadObjectTrace.cpp allocThreadTrace.o \ ! allocThreadTrace.obj: allocThreadTrace.cpp ../main/includes.h $(CCC) $(CPPFLAGS) allocThreadTrace.cpp allocStatData.o \ ! allocStatData.obj: allocStatData.cpp ../main/includes.h $(CCC) $(CPPFLAGS) allocStatData.cpp allocObjectTrace.o \ ! allocObjectTrace.obj: allocObjectTrace.cpp ../main/includes.h $(CCC) $(CPPFLAGS) allocObjectTrace.cpp allocThreadMethod.o \ ! allocThreadMethod.obj: allocThreadMethod.cpp ../main/includes.h $(CCC) $(CPPFLAGS) allocThreadMethod.cpp allocThreadObject.o \ ! allocThreadObject.obj: allocThreadObject.cpp ../main/includes.h $(CCC) $(CPPFLAGS) allocThreadObject.cpp allocObject.o \ ! allocObject.obj: allocObject.cpp ../main/includes.h $(CCC) $(CPPFLAGS) allocObject.cpp allocThreadObjectMethod.o \ ! allocThreadObjectMethod.obj: allocThreadObjectMethod.cpp ../main/includes.h $(CCC) $(CPPFLAGS) allocThreadObjectMethod.cpp allocTrace.o \ ! allocTrace.obj: allocTrace.cpp ../main/includes.h $(CCC) $(CPPFLAGS) allocTrace.cpp allocArena.o \ ! allocArena.obj: allocArena.cpp ../main/includes.h $(CCC) $(CPPFLAGS) allocArena.cpp allocGlobalRef.o \ ! allocGlobalRef.obj: $(CCC) $(CPPFLAGS) allocGlobalRef.cpp allocInstance.o \ ! allocInstance.obj: $(CCC) $(CPPFLAGS) allocInstance.cpp --- 1,55 ---- allocObjectMethod.o \ ! allocObjectMethod.obj: allocObjectMethod.cpp $(CCC) $(CPPFLAGS) allocObjectMethod.cpp allocThreadObjectTrace.o \ ! allocThreadObjectTrace.obj: allocThreadObjectTrace.cpp $(CCC) $(CPPFLAGS) allocThreadObjectTrace.cpp allocThreadTrace.o \ ! allocThreadTrace.obj: allocThreadTrace.cpp $(CCC) $(CPPFLAGS) allocThreadTrace.cpp allocStatData.o \ ! allocStatData.obj: allocStatData.cpp $(CCC) $(CPPFLAGS) allocStatData.cpp allocObjectTrace.o \ ! allocObjectTrace.obj: allocObjectTrace.cpp $(CCC) $(CPPFLAGS) allocObjectTrace.cpp allocThreadMethod.o \ ! allocThreadMethod.obj: allocThreadMethod.cpp $(CCC) $(CPPFLAGS) allocThreadMethod.cpp allocThreadObject.o \ ! allocThreadObject.obj: allocThreadObject.cpp $(CCC) $(CPPFLAGS) allocThreadObject.cpp allocObject.o \ ! allocObject.obj: allocObject.cpp $(CCC) $(CPPFLAGS) allocObject.cpp allocThreadObjectMethod.o \ ! allocThreadObjectMethod.obj: allocThreadObjectMethod.cpp $(CCC) $(CPPFLAGS) allocThreadObjectMethod.cpp allocTrace.o \ ! allocTrace.obj: allocTrace.cpp $(CCC) $(CPPFLAGS) allocTrace.cpp allocArena.o \ ! allocArena.obj: allocArena.cpp $(CCC) $(CPPFLAGS) allocArena.cpp allocGlobalRef.o \ ! allocGlobalRef.obj: allocGlobalRef.cpp $(CCC) $(CPPFLAGS) allocGlobalRef.cpp allocInstance.o \ ! allocInstance.obj: allocInstance.cpp $(CCC) $(CPPFLAGS) allocInstance.cpp + + allocAbstractStatThreadObject.o \ + allocAbstractStatThreadObject.obj: allocAbstractStatThreadObject.cpp + $(CCC) $(CPPFLAGS) allocAbstractStatThreadObject.cpp Index: allocAbstractStatThreadObject.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocAbstractStatThreadObject.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** allocAbstractStatThreadObject.h 2001/09/02 20:14:21 1.9 --- allocAbstractStatThreadObject.h 2001/11/21 22:31:41 1.10 *************** *** 36,39 **** --- 36,42 ---- #define _ALLOC_ABSTRACT_STAT_THREAD_OBJECT_H_ + #include "../main/includes.h" + #include "../alloc/allocStatData.h" + /** An abstract statistic class. This class is an ancestor ** of AllocThreadObject, AllocThreadObjectMethod and AllocThreadObjectTrace *************** *** 58,63 **** _flagModified( 0) ! {}; /** Addition of the object's size to statistics. --- 61,69 ---- _flagModified( 0) + + {} ! /// Destructor. ! virtual ~AllocAbstractStatThreadObject() {} /** Addition of the object's size to statistics. *************** *** 68,77 **** ** ** @see subMemoryStat() */ - - virtual void addMemoryStat( jint size) { ! if( !_flagModified) AllocStatData::addMemoryStat( size); ! _flagModified = 1; ! } /** Subtraction of the object's size from statistics. --- 74,79 ---- ** ** @see subMemoryStat() */ ! virtual void addMemoryStat( jint size); /** Subtraction of the object's size from statistics. *************** *** 83,91 **** ** @see addMemoryStat() */ ! virtual void subMemoryStat( jint size) { ! ! if( !_flagModified) AllocStatData::subMemoryStat( size); ! _flagModified = 1; ! } /** Clearing of flag. This method sets --- 85,89 ---- ** @see addMemoryStat() */ ! virtual void subMemoryStat( jint size); /** Clearing of flag. This method sets *************** *** 103,105 **** #endif // _ALLOC_ABSTRACT_STAT_THREAD_OBJECT_H_ - --- 101,102 ---- Index: allocArena.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocArena.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** allocArena.cpp 2001/09/02 20:14:21 1.2 --- allocArena.cpp 2001/11/21 22:31:41 1.3 *************** *** 33,37 **** */ ! #include "../main/includes.h" ! Allocator AllocArena::_allocator( sizeof( AllocArena)); --- 33,46 ---- */ ! #include "../alloc/allocArena.h" ! #ifdef USE_ALLOCATOR ! Allocator AllocArena::_allocator; ! #endif ! ! Buffer& AllocArena::infoToBin( Buffer& b) { ! ! b += arenaName; ! ! return b; ! } Index: allocArena.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocArena.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** allocArena.h 2001/09/02 20:14:21 1.13 --- allocArena.h 2001/11/21 22:31:41 1.14 *************** *** 36,39 **** --- 36,49 ---- #define _ALLOC_ARENA_H_ + #include "../main/includes.h" + #include "../list/listItem.h" + #include "../commun2/idObject.h" + #include "../commun/binaryFormat.h" + #include "../string/string.h" + #include "../list/list.h" + #include "../alloc/allocInstance.h" + #include "../commun/buffer.h" + #include "../allocator/allocator.h" + /** Arena. This class consists of arena data acquired ** by receiving the JVMPI_EVENT_ARENA_NEW event. *************** *** 45,50 **** ** @author Marek Przeczek */ ! class AllocArena: public LI1, public IdObject, ! public InfoBinaryFormat { public: --- 55,61 ---- ** @author Marek Przeczek */ ! class AllocArena: public LI1, ! public IdObject, ! public InfoBinaryFormat { public: *************** *** 68,73 **** arenaId( 0), active( 1) ! {}; /** Convert info to binary. This method converts information --- 79,87 ---- arenaId( 0), active( 1) + + {} ! /// Destructor. ! virtual ~AllocArena() {} /** Convert info to binary. This method converts information *************** *** 78,89 **** ** ** @return reference to same Buffer object as argument 'b' */ - - virtual Buffer& infoToBin( Buffer& b) { - - b += arenaName; ! return b; ! } private: --- 92,99 ---- ** ** @return reference to same Buffer object as argument 'b' */ ! virtual Buffer& infoToBin( Buffer& b); + #ifdef USE_ALLOCATOR private: *************** *** 95,103 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} public: --- 105,114 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif public: *************** *** 105,109 **** /** Class identification. ** ! ** @return unique class type identified */ virtual eClassIdent getClassIdent() { return ALLOC_ARENA;} --- 116,120 ---- /** Class identification. ** ! ** @return unique class type identifier */ virtual eClassIdent getClassIdent() { return ALLOC_ARENA;} Index: allocGlobalRef.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocGlobalRef.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** allocGlobalRef.cpp 2001/09/02 20:14:21 1.2 --- allocGlobalRef.cpp 2001/11/21 22:31:41 1.3 *************** *** 33,37 **** */ ! #include "../main/includes.h" ! Allocator AllocGlobalRef::_allocator( sizeof( AllocGlobalRef)); --- 33,39 ---- */ ! #include "../alloc/allocGlobalRef.h" ! #ifdef USE_ALLOCATOR ! Allocator AllocGlobalRef::_allocator; ! #endif Index: allocGlobalRef.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocGlobalRef.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** allocGlobalRef.h 2001/09/02 20:14:21 1.6 --- allocGlobalRef.h 2001/11/21 22:31:41 1.7 *************** *** 36,39 **** --- 36,43 ---- #define _ALLOC_GLOBAL_REF_H_ + #include "../main/includes.h" + #include "../list/listItem.h" + #include "../allocator/allocator.h" + /** JNI global reference. This class consists of data ** about JNI global reference acquired by receiving *************** *** 59,80 **** instance( NULL), refId( 0) ! {}; /** Retrieves object's key. ** ! ** @param key where to store the key ** @return key ** ** @see Hash */ ! const jobject& getKey(jobject& key) { ! ! return key = refId; ! } /** Compares object with given key. ** ** @param key key ** @return 1 (true); ** 0 (false) --- 63,86 ---- instance( NULL), refId( 0) + + {} ! /// Destructor. ! virtual ~AllocGlobalRef() {} /** Retrieves object's key. ** ! ** @param key where to store the key ! ** ** @return key ** ** @see Hash */ ! const jobject& getKey(jobject& key) { return key = refId;} /** Compares object with given key. ** ** @param key key + ** ** @return 1 (true); ** 0 (false) *************** *** 82,100 **** ** @see Hash */ ! int operator==(const jobject& key) { ! ! return (refId == key); ! } /** Hash function. ** ! ** @param reference to a key ** @return hash value */ - - static int hashKey(const jobject& key) { ! return (int)key; ! } private: --- 88,102 ---- ** @see Hash */ ! int operator==(const jobject& key) { return (refId == key);} /** Hash function. ** ! ** @param key reference to a key ! ** ** @return hash value */ ! static int hashKey(const jobject& key) { return (int)key;} + #ifdef USE_ALLOCATOR private: *************** *** 106,114 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} }; --- 108,117 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif }; Index: allocInstance.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocInstance.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** allocInstance.cpp 2001/09/02 20:14:21 1.2 --- allocInstance.cpp 2001/11/21 22:31:41 1.3 *************** *** 33,37 **** */ ! #include "../main/includes.h" ! Allocator AllocInstance::_allocator( sizeof( AllocInstance)); --- 33,39 ---- */ ! #include "../alloc/allocInstance.h" ! #ifdef USE_ALLOCATOR ! Allocator AllocInstance::_allocator; ! #endif Index: allocInstance.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocInstance.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** allocInstance.h 2001/09/02 20:14:21 1.12 --- allocInstance.h 2001/11/21 22:31:41 1.13 *************** *** 36,39 **** --- 36,43 ---- #define _ALLOC_INSTANCE_H_ + #include "../main/includes.h" + #include "../list/listItem.h" + #include "../allocator/allocator.h" + /** Instance. This class consists of data gained ** by receiving the JVMPI_EVENT_OBJECT_ALLOC event. *************** *** 48,52 **** ** @author Marek Przeczek, Petr Luner */ ! class AllocInstance: public LI1, public LI2 { public: --- 52,57 ---- ** @author Marek Przeczek, Petr Luner */ ! class AllocInstance: public LI1, ! public LI2 { public: *************** *** 74,95 **** arena( NULL), objectMethodTraceThread( NULL) ! {}; /** Retrieves object's key. ** ! ** @param key where to store the key ** @return key ** ** @see Hash */ ! const jobjectID& getKey(jobjectID& key) { ! ! return key = objId; ! } /** Compares object with given key. ** ** @param key key ** @return 1 (true); ** 0 (false) --- 79,102 ---- arena( NULL), objectMethodTraceThread( NULL) + + {} ! /// Destructor. ! virtual ~AllocInstance() {} /** Retrieves object's key. ** ! ** @param key where to store the key ! ** ** @return key ** ** @see Hash */ ! const jobjectID& getKey(jobjectID& key) { return key = objId;} /** Compares object with given key. ** ** @param key key + ** ** @return 1 (true); ** 0 (false) *************** *** 97,115 **** ** @see Hash */ ! int operator==(const jobjectID& key) { ! ! return (objId == key); ! } /** Hash function. ** ! ** @param reference to a key ** @return hash value */ - - static int hashKey(const jobjectID& key) { ! return (int)key; ! } private: --- 104,118 ---- ** @see Hash */ ! int operator==(const jobjectID& key) { return (objId == key);} /** Hash function. ** ! ** @param key reference to a key ! ** ** @return hash value */ ! static int hashKey(const jobjectID& key) { return (int)key;} + #ifdef USE_ALLOCATOR private: *************** *** 121,129 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} }; --- 124,133 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif }; Index: allocObject.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocObject.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** allocObject.cpp 2001/09/18 22:19:28 1.12 --- allocObject.cpp 2001/11/21 22:31:41 1.13 *************** *** 33,40 **** */ ! #include "../main/includes.h" - Allocator AllocObject::_allocator( sizeof( AllocObject)); - Buffer& AllocObject::infoToBin( Buffer& b) { --- 33,44 ---- */ ! #include "../alloc/allocObject.h" ! #include "../prof/prof.h" ! #include "../alloc/allocObjectMethod.h" ! ! #ifdef USE_ALLOCATOR ! Allocator AllocObject::_allocator; ! #endif Buffer& AllocObject::infoToBin( Buffer& b) { *************** *** 73,75 **** --- 77,109 ---- om = objectMethods.next(om); } + } + + const AllocObjectKey& AllocObject::getKey(AllocObjectKey& key) { + + key.classId = classId; + key.isArray = isArray; + return key; + } + + int AllocObject::operator==(const AllocObjectKey& key) { + + if (isArray != key.isArray) return 0; + if (clss) return *clss == key.classId; + else return classId == key.classId; + } + + int AllocObject::hashKey(const AllocObjectKey& key) { + + return Class::hashKey(key.classId); + } + + int AllocObject::isActive() { + + return (clss) ? clss->active : 1; + } + + void AllocObject::setUnchanged() { + + IdObject::setUnchanged(); + clearDataChanged(); } Index: allocObject.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocObject.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** allocObject.h 2001/09/02 20:14:21 1.18 --- allocObject.h 2001/11/21 22:31:41 1.19 *************** *** 36,52 **** #define _ALLOC_OBJECT_H_ ! /** Key for AllocObject class. ! ** Used for searching in hash tables. ! ** ! ** @author Marek Przeczek, Petr Luner */ ! ! struct AllocObjectKey { ! ! /// class ID ! jobjectID classId; ! ! /// is array? ! jint isArray; ! }; /** Type of Java object. This class consists of data --- 36,50 ---- #define _ALLOC_OBJECT_H_ ! #include "../main/includes.h" ! #include "../list/listItem.h" ! #include "../alloc/allocAbstractStatThreadObject.h" ! #include "../commun2/idObject.h" ! #include "../commun/binaryFormat.h" ! #include "../list/list.h" ! #include "../alloc/allocObjectMethod.h" ! #include "../alloc/allocThreadObject.h" ! #include "../alloc/allocObjectKey.h" ! #include "../commun/buffer.h" ! #include "../allocator/allocator.h" /** Type of Java object. This class consists of data *************** *** 61,67 **** ** @author Marek Przeczek, Petr Luner */ ! class AllocObject: public LI1, public LI2, public AllocAbstractStatThreadObject, ! public IdObject, ! public InfoBinaryFormat { public: --- 59,67 ---- ** @author Marek Przeczek, Petr Luner */ ! class AllocObject: public LI1, ! public LI2, ! public AllocAbstractStatThreadObject, ! public IdObject, ! public InfoBinaryFormat { public: *************** *** 98,118 **** {} /** Retrieves object's key. ** - ** @param key where to store the key ** @return key ** ** @see Hash */ ! const AllocObjectKey& getKey(AllocObjectKey& key) { ! ! key.classId = classId; ! key.isArray = isArray; ! return key; ! } /** Compares object with given key. ** ** @param key key ** @return 1 (true); ** 0 (false) --- 98,118 ---- {} + /// Destructor. + virtual ~AllocObject() {} + /** Retrieves object's key. + ** + ** @param key where to store the key ** ** @return key ** ** @see Hash */ ! const AllocObjectKey& getKey(AllocObjectKey& key); /** Compares object with given key. ** ** @param key key + ** ** @return 1 (true); ** 0 (false) *************** *** 120,139 **** ** @see Hash */ ! int operator==(const AllocObjectKey& key) { - if (isArray != key.isArray) return 0; - if (clss) return *clss == key.classId; - else return classId == key.classId; - } - /** Hash function. ** ! ** @param reference to a key ** @return hash value */ - - static int hashKey(const AllocObjectKey& key) { ! return Class::hashKey(key.classId); ! } /** Convert info to binary. This method converts information --- 120,132 ---- ** @see Hash */ ! int operator==(const AllocObjectKey& key); /** Hash function. ** ! ** @param key reference to a key ! ** ** @return hash value */ ! static int hashKey(const AllocObjectKey& key); /** Convert info to binary. This method converts information *************** *** 151,154 **** --- 144,148 ---- void deactivate(); + #ifdef USE_ALLOCATOR private: *************** *** 160,168 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} public: --- 154,163 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif public: *************** *** 170,174 **** /** Class identification. ** ! ** @return unique class type identified */ virtual eClassIdent getClassIdent() { return ALLOC_OBJECT;} --- 165,169 ---- /** Class identification. ** ! ** @return unique class type identifier */ virtual eClassIdent getClassIdent() { return ALLOC_OBJECT;} *************** *** 180,184 **** ** 1 (active) */ ! virtual int isActive() { return (clss) ? clss->active : 1;} /** Indication that object has changed its data. --- 175,179 ---- ** 1 (active) */ ! virtual int isActive(); /** Indication that object has changed its data. *************** *** 191,199 **** /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged() { ! ! IdObject::setUnchanged(); ! clearDataChanged(); ! } }; --- 186,190 ---- /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged(); }; Index: allocObjectMethod.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocObjectMethod.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** allocObjectMethod.cpp 2001/09/18 22:19:28 1.11 --- allocObjectMethod.cpp 2001/11/21 22:31:41 1.12 *************** *** 33,40 **** */ ! #include "../main/includes.h" - Allocator AllocObjectMethod::_allocator( sizeof( AllocObjectMethod)); - void AllocObjectMethod::addMemoryStat( jint size) { --- 33,45 ---- */ ! #include "../alloc/allocObjectMethod.h" ! #include "../prof/prof.h" ! #include "../alloc/allocObject.h" ! #include "../alloc/allocObjectTrace.h" ! ! #ifdef USE_ALLOCATOR ! Allocator AllocObjectMethod::_allocator; ! #endif void AllocObjectMethod::addMemoryStat( jint size) { *************** *** 75,77 **** --- 80,110 ---- ot = objectTraces.next(ot); } + } + + const AllocObjectMethodKey& AllocObjectMethod::getKey(AllocObjectMethodKey& key) { + + object->getKey(key.objectKey); + method->getKey(key.methodId); + return key; + } + + int AllocObjectMethod::operator==(const AllocObjectMethodKey& key) { + + return (*object == key.objectKey) && (*method == key.methodId); + } + + int AllocObjectMethod::hashKey(const AllocObjectMethodKey& key) { + + return AllocObject::hashKey(key.objectKey) ^ Method::hashKey(key.methodId); + } + + int AllocObjectMethod::isActive() { + + return (method->isActive() && object->isActive()); + } + + void AllocObjectMethod::setUnchanged() { + + IdObject::setUnchanged(); + clearDataChanged(); } Index: allocObjectMethod.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocObjectMethod.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** allocObjectMethod.h 2001/09/02 20:14:21 1.17 --- allocObjectMethod.h 2001/11/21 22:31:41 1.18 *************** *** 36,53 **** #define _ALLOC_OBJECT_METHOD_H_ ! /** Key for AllocObjectMethod class. ! ** Used for searching in hash tables. ! ** ! ** @author Marek Przeczek, Petr Luner */ ! ! struct AllocObjectMethodKey { - /// object key - AllocObjectKey objectKey; - - /// method ID - jmethodID methodId; - }; - /** Crossroad of objects and methods. This class defines ** a relation between an object and a method. Each object can --- 36,49 ---- #define _ALLOC_OBJECT_METHOD_H_ ! #include "../main/includes.h" ! #include "../list/listItem.h" ! #include "../alloc/allocAbstractStatThreadObject.h" ! #include "../commun2/idObject.h" ! #include "../list/list.h" ! #include "../alloc/allocObjectTrace.h" ! #include "../alloc/allocThreadObjectMethod.h" ! #include "../alloc/allocObjectMethodKey.h" ! #include "../allocator/allocator.h" /** Crossroad of objects and methods. This class defines ** a relation between an object and a method. Each object can *************** *** 60,66 **** ** @author Marek Przeczek, Petr Luner */ ! class AllocObjectMethod: public LI1, public LI2, public AllocAbstractStatThreadObject, ! public IdObject, ! public LI3 { public: --- 56,64 ---- ** @author Marek Przeczek, Petr Luner */ ! class AllocObjectMethod: public LI1, ! public LI2, ! public LI3, ! public AllocAbstractStatThreadObject, ! public IdObject { public: *************** *** 87,90 **** --- 85,91 ---- {} + /// Destructor. + virtual ~AllocObjectMethod() {} + /** Addition of the object's size to statistics. ** This method adds size of object to the statistic data. *************** *** 114,132 **** /** Retrieves object's key. ** ! ** @param key where to store the key ** @return key ** ** @see Hash */ - - const AllocObjectMethodKey& getKey(AllocObjectMethodKey& key) { ! object->getKey(key.objectKey); ! method->getKey(key.methodId); ! return key; ! } /** Compares object with given key. ** ** @param key key ** @return 1 (true); ** 0 (false) --- 115,130 ---- /** Retrieves object's key. ** ! ** @param key where to store the key ! ** ** @return key ** ** @see Hash */ ! const AllocObjectMethodKey& getKey(AllocObjectMethodKey& key); /** Compares object with given key. ** ** @param key key + ** ** @return 1 (true); ** 0 (false) *************** *** 134,151 **** ** @see Hash */ ! int operator==(const AllocObjectMethodKey& key) { - return (*object == key.objectKey) && (*method == key.methodId); - } - /** Hash function. ** ! ** @param reference to a key ** @return hash value */ - - static int hashKey(const AllocObjectMethodKey& key) { ! return AllocObject::hashKey(key.objectKey) ^ Method::hashKey(key.methodId); ! } /** Performs deactivation. */ --- 132,144 ---- ** @see Hash */ ! int operator==(const AllocObjectMethodKey& key); /** Hash function. ** ! ** @param key reference to a key ! ** ** @return hash value */ ! static int hashKey(const AllocObjectMethodKey& key); /** Performs deactivation. */ *************** *** 153,156 **** --- 146,150 ---- void deactivate(); + #ifdef USE_ALLOCATOR private: *************** *** 162,170 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} public: --- 156,165 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif public: *************** *** 172,176 **** /** Class identification. ** ! ** @return unique class type identified */ virtual eClassIdent getClassIdent() { return ALLOC_OBJECT_METHOD;} --- 167,171 ---- /** Class identification. ** ! ** @return unique class type identifier */ virtual eClassIdent getClassIdent() { return ALLOC_OBJECT_METHOD;} *************** *** 182,186 **** ** 1 (active) */ ! virtual int isActive() { return (method->isActive() && object->isActive());} /** Indication that object has changed its data. --- 177,181 ---- ** 1 (active) */ ! virtual int isActive(); /** Indication that object has changed its data. *************** *** 193,201 **** /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged() { ! ! IdObject::setUnchanged(); ! clearDataChanged(); ! } }; --- 188,192 ---- /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged(); }; Index: allocObjectTrace.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocObjectTrace.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** allocObjectTrace.cpp 2001/09/18 22:19:28 1.11 --- allocObjectTrace.cpp 2001/11/21 22:31:41 1.12 *************** *** 33,44 **** */ ! #include "../main/includes.h" - Allocator AllocObjectTrace::_allocator( sizeof( AllocObjectTrace)); - void AllocObjectTrace::addMemoryStat( jint size) { if( !modified()) { ! AllocAbstractStatThreadObject::addMemoryStat( size); --- 33,50 ---- */ ! #include "../alloc/allocObjectTrace.h" ! #include "../prof/prof.h" ! #include "../alloc/allocTrace.h" ! #include "../alloc/allocObjectMethod.h" ! #include "../alloc/allocObject.h" ! ! #ifdef USE_ALLOCATOR ! Allocator AllocObjectTrace::_allocator; ! #endif void AllocObjectTrace::addMemoryStat( jint size) { if( !modified()) { ! AllocAbstractStatThreadObject::addMemoryStat( size); *************** *** 71,72 **** --- 77,105 ---- } + const AllocObjectTraceKey& AllocObjectTrace::getKey(AllocObjectTraceKey& key) { + + objectMethod->object->getKey(key.objectKey); + trace->getKey(key.traceKey); + return key; + } + + int AllocObjectTrace::operator==(const AllocObjectTraceKey& key) { + + return (*objectMethod->object == key.objectKey) && (*trace == key.traceKey); + } + + int AllocObjectTrace::hashKey(const AllocObjectTraceKey& key) { + + return AllocObject::hashKey(key.objectKey) ^ Trace::hashKey(key.traceKey); + } + + int AllocObjectTrace::isActive() { + + return (trace->isActive() && objectMethod->isActive()); + } + + void AllocObjectTrace::setUnchanged() { + + IdObject::setUnchanged(); + clearDataChanged(); + } Index: allocObjectTrace.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocObjectTrace.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** allocObjectTrace.h 2001/09/02 20:14:21 1.17 --- allocObjectTrace.h 2001/11/21 22:31:41 1.18 *************** *** 36,54 **** #define _ALLOC_OBJECT_TRACE_H_ ! /** Key for AllocObjectTrace class. ! ** Key used for searching in hash tables. ! ** ! ** @author Marek Przeczek, Petr Luner */ ! ! struct AllocObjectTraceKey { ! ! /// object key ! AllocObjectKey objectKey; - /// trace key - TraceKey traceKey; - }; - - /** Crossroad of traces and objects-methods. This class defines ** a relation between traces (specify where an object was allocated) and --- 36,48 ---- #define _ALLOC_OBJECT_TRACE_H_ ! #include "../main/includes.h" ! #include "../list/listItem.h" ! #include "../alloc/allocAbstractStatThreadObject.h" ! #include "../commun2/idObject.h" ! #include "../list/list.h" ! #include "../alloc/allocThreadObjectTrace.h" ! #include "../alloc/allocObjectTraceKey.h" ! #include "../allocator/allocator.h" /** Crossroad of traces and objects-methods. This class defines ** a relation between traces (specify where an object was allocated) and *************** *** 70,76 **** ** @author Marek Przeczek, Petr Luner */ ! class AllocObjectTrace: public LI1, public LI2, public AllocAbstractStatThreadObject, ! public IdObject, ! public LI3 { public: --- 64,72 ---- ** @author Marek Przeczek, Petr Luner */ ! class AllocObjectTrace: public LI1, ! public LI2, ! public LI3, ! public AllocAbstractStatThreadObject, ! public IdObject { public: *************** *** 94,97 **** --- 90,96 ---- {} + /// Destructor. + virtual ~AllocObjectTrace() {} + /** Addition of the object's size to statistics. ** This method adds size of object to the statistic data. *************** *** 121,139 **** /** Retrieves object's key. ** ! ** @param key where to store the key ** @return key ** ** @see Hash */ - - const AllocObjectTraceKey& getKey(AllocObjectTraceKey& key) { ! objectMethod->object->getKey(key.objectKey); ! trace->getKey(key.traceKey); ! return key; ! } /** Compares object with given key. ** ** @param key key ** @return 1 (true); ** 0 (false) --- 120,135 ---- /** Retrieves object's key. ** ! ** @param key where to store the key ! ** ** @return key ** ** @see Hash */ ! const AllocObjectTraceKey& getKey(AllocObjectTraceKey& key); /** Compares object with given key. ** ** @param key key + ** ** @return 1 (true); ** 0 (false) *************** *** 141,158 **** ** @see Hash */ ! int operator==(const AllocObjectTraceKey& key) { - return (*objectMethod->object == key.objectKey) && (*trace == key.traceKey); - } - /** Hash function. ** ! ** @param reference to a key ** @return hash value */ - - static int hashKey(const AllocObjectTraceKey& key) { ! return AllocObject::hashKey(key.objectKey) ^ Trace::hashKey(key.traceKey); ! } /** Performs deactivation. */ --- 137,149 ---- ** @see Hash */ ! int operator==(const AllocObjectTraceKey& key); /** Hash function. ** ! ** @param key reference to a key ! ** ** @return hash value */ ! static int hashKey(const AllocObjectTraceKey& key); /** Performs deactivation. */ *************** *** 160,163 **** --- 151,155 ---- void deactivate(); + #ifdef USE_ALLOCATOR private: *************** *** 169,177 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} public: --- 161,170 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif public: *************** *** 179,183 **** /** Class identification. ** ! ** @return unique class type identified */ virtual eClassIdent getClassIdent() { return ALLOC_OBJECT_TRACE;} --- 172,176 ---- /** Class identification. ** ! ** @return unique class type identifier */ virtual eClassIdent getClassIdent() { return ALLOC_OBJECT_TRACE;} *************** *** 189,193 **** ** 1 (active) */ ! virtual int isActive() { return (trace->isActive() && objectMethod->isActive());} /** Indication that object has changed its data. --- 182,186 ---- ** 1 (active) */ ! virtual int isActive(); /** Indication that object has changed its data. *************** *** 200,208 **** /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged() { ! ! IdObject::setUnchanged(); ! clearDataChanged(); ! } }; --- 193,197 ---- /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged(); }; Index: allocStatData.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocStatData.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** allocStatData.cpp 2001/09/02 20:14:21 1.6 --- allocStatData.cpp 2001/11/21 22:31:41 1.7 *************** *** 33,37 **** */ ! #include "../main/includes.h" void AllocStatData::addMemoryStat( jint size) { --- 33,37 ---- */ ! #include "../alloc/allocStatData.h" void AllocStatData::addMemoryStat( jint size) { Index: allocStatData.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocStatData.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** allocStatData.h 2001/09/02 20:14:21 1.8 --- allocStatData.h 2001/11/21 22:31:41 1.9 *************** *** 36,39 **** --- 36,44 ---- #define _ALLOC_STAT_DATA_H_ + #include "../main/includes.h" + #include "../commun/binaryFormat.h" + #include "../commun/statDataModification.h" + #include "../commun/buffer.h" + /** Statistic data for memory profiling. This class is a base class ** for other classes used in memory profiling; it consists *************** *** 43,47 **** class AllocStatData: public DataBinaryFormat, ! public StatDataModification { public: --- 48,52 ---- class AllocStatData: public DataBinaryFormat, ! public StatDataModification { public: *************** *** 75,80 **** allocSizeInstancesLive( 0), allocSizeInstancesTotal( 0) ! {}; /** Addition of the object's size to statistics. --- 80,88 ---- allocSizeInstancesLive( 0), allocSizeInstancesTotal( 0) + + {} ! /// Destructor. ! virtual ~AllocStatData() {} /** Addition of the object's size to statistics. *************** *** 116,118 **** #endif // _ALLOC_STAT_DATA_H_ - --- 124,125 ---- Index: allocThreadMethod.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocThreadMethod.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** allocThreadMethod.cpp 2001/09/18 22:19:28 1.9 --- allocThreadMethod.cpp 2001/11/21 22:31:41 1.10 *************** *** 33,43 **** */ ! #include "../main/includes.h" ! Allocator AllocThreadMethod::_allocator( sizeof( AllocThreadMethod)); void AllocThreadMethod::deactivate() { ! Prof::prof().activeAllocThreadMethods.removeNoRehash(this); AllocThreadTrace* tt = threadTraces.first(); --- 33,47 ---- */ ! #include "../alloc/allocThreadMethod.h" ! #include "../prof/prof.h" ! #include "../alloc/allocThreadTrace.h" ! #ifdef USE_ALLOCATOR ! Allocator AllocThreadMethod::_allocator; ! #endif void AllocThreadMethod::deactivate() { ! Prof::prof().activeAllocThreadMethods.removeNoRehash(this); AllocThreadTrace* tt = threadTraces.first(); *************** *** 46,48 **** --- 50,80 ---- tt = threadTraces.next(tt); } + } + + const AllocThreadMethodKey& AllocThreadMethod::getKey(AllocThreadMethodKey& key) { + + thread->getKey(key.envId); + method->getKey(key.methodId); + return key; + } + + int AllocThreadMethod::operator==(const AllocThreadMethodKey& key) { + + return (*thread == key.envId) && (*method == key.methodId); + } + + int AllocThreadMethod::hashKey(const AllocThreadMethodKey& key) { + + return Thread::hashKey(key.envId) ^ Method::hashKey(key.methodId); + } + + int AllocThreadMethod::isActive() { + + return (thread->isActive() && method->isActive()); + } + + void AllocThreadMethod::setUnchanged() { + + IdObject::setUnchanged(); + clearDataChanged(); } Index: allocThreadMethod.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocThreadMethod.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** allocThreadMethod.h 2001/09/02 20:14:21 1.15 --- allocThreadMethod.h 2001/11/21 22:31:41 1.16 *************** *** 36,53 **** #define _ALLOC_THREAD_METHOD_H_ ! /** Key for AllocThreadMethod class. ! ** Used for searching in hash tables. ! ** ! ** @author Marek Przeczek, Petr Luner */ ! ! struct AllocThreadMethodKey { - /// thread ID - JNIEnv* envId; - - /// method ID - jmethodID methodId; - }; - /** Crossroad of threads and methods. This class consists ** of statistic information about method while running in the thread. --- 36,49 ---- #define _ALLOC_THREAD_METHOD_H_ ! #include "../main/includes.h" ! #include "../list/listItem.h" ! #include "../alloc/allocStatData.h" ! #include "../commun2/idObject.h" ! #include "../list/list.h" ! #include "../alloc/allocThreadObjectMethod.h" ! #include "../alloc/allocThreadTrace.h" ! #include "../alloc/allocThreadMethodKey.h" ! #include "../allocator/allocator.h" /** Crossroad of threads and methods. This class consists ** of statistic information about method while running in the thread. *************** *** 60,65 **** ** @author Marek Przeczek, Petr Luner */ ! class AllocThreadMethod: public LI1, public AllocStatData, ! public IdObject, public LI2, public LI3 { public: --- 56,64 ---- ** @author Marek Przeczek, Petr Luner */ ! class AllocThreadMethod: public LI1, ! public LI2, ! public LI3, ! public AllocStatData, ! public IdObject { public: *************** *** 86,106 **** {} /** Retrieves object's key. ** ! ** @param key where to store the key ** @return key ** ** @see Hash */ ! const AllocThreadMethodKey& getKey(AllocThreadMethodKey& key) { ! ! thread->getKey(key.envId); ! method->getKey(key.methodId); ! return key; ! } /** Compares object with given key. ** ** @param key key ** @return 1 (true); ** 0 (false) --- 85,105 ---- {} + /// Destructor. + virtual ~AllocThreadMethod() {} + /** Retrieves object's key. ** ! ** @param key where to store the key ! ** ** @return key ** ** @see Hash */ ! const AllocThreadMethodKey& getKey(AllocThreadMethodKey& key); /** Compares object with given key. ** ** @param key key + ** ** @return 1 (true); ** 0 (false) *************** *** 108,125 **** ** @see Hash */ ! int operator==(const AllocThreadMethodKey& key) { ! ! return (*thread == key.envId) && (*method == key.methodId); ! } /** Hash function. ** ! ** @param reference to a key ** @return hash value */ - - static int hashKey(const AllocThreadMethodKey& key) { ! return Thread::hashKey(key.envId) ^ Method::hashKey(key.methodId); ! } /** Performs deactivation. */ --- 107,119 ---- ** @see Hash */ ! int operator==(const AllocThreadMethodKey& key); /** Hash function. ** ! ** @param key reference to a key ! ** ** @return hash value */ ! static int hashKey(const AllocThreadMethodKey& key); /** Performs deactivation. */ *************** *** 127,130 **** --- 121,125 ---- void deactivate(); + #ifdef USE_ALLOCATOR private: *************** *** 136,144 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} public: --- 131,140 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif public: *************** *** 146,150 **** /** Class identification. ** ! ** @return unique class type identified */ virtual eClassIdent getClassIdent() { return ALLOC_THREAD_METHOD;} --- 142,146 ---- /** Class identification. ** ! ** @return unique class type identifier */ virtual eClassIdent getClassIdent() { return ALLOC_THREAD_METHOD;} *************** *** 156,160 **** ** 1 (active) */ ! virtual int isActive() { return (thread->isActive() && method->isActive());} /** Indication that object has changed its data. --- 152,156 ---- ** 1 (active) */ ! virtual int isActive(); /** Indication that object has changed its data. *************** *** 167,175 **** /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged() { ! ! IdObject::setUnchanged(); ! clearDataChanged(); ! } }; --- 163,167 ---- /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged(); }; Index: allocThreadObject.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocThreadObject.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** allocThreadObject.cpp 2001/09/18 22:19:28 1.13 --- allocThreadObject.cpp 2001/11/21 22:31:41 1.14 *************** *** 33,40 **** */ ! #include "../main/includes.h" - Allocator AllocThreadObject::_allocator( sizeof( AllocThreadObject)); - void AllocThreadObject::addMemoryStat( jint size) { --- 33,45 ---- */ ! #include "../alloc/allocThreadObject.h" ! #include "../prof/prof.h" ! #include "../alloc/allocObject.h" ! #include "../alloc/allocThreadObjectMethod.h" ! ! #ifdef USE_ALLOCATOR ! Allocator AllocThreadObject::_allocator; ! #endif void AllocThreadObject::addMemoryStat( jint size) { *************** *** 75,77 **** --- 80,110 ---- tom = threadObjectMethods.next(tom); } + } + + const AllocThreadObjectKey& AllocThreadObject::getKey(AllocThreadObjectKey& key) { + + thread->getKey(key.envId); + object->getKey(key.objectKey); + return key; + } + + int AllocThreadObject::operator==(const AllocThreadObjectKey& key) { + + return (*thread == key.envId) && (*object == key.objectKey); + } + + int AllocThreadObject::hashKey(const AllocThreadObjectKey& key) { + + return Thread::hashKey(key.envId) ^ AllocObject::hashKey(key.objectKey); + } + + int AllocThreadObject::isActive() { + + return (object->isActive() && thread->isActive()); + } + + void AllocThreadObject::setUnchanged() { + + IdObject::setUnchanged(); + clearDataChanged(); } Index: allocThreadObject.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocThreadObject.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** allocThreadObject.h 2001/09/02 20:14:21 1.18 --- allocThreadObject.h 2001/11/21 22:31:41 1.19 *************** *** 36,53 **** #define _ALLOC_THREAD_OBJECT_H_ ! /** Key for AllocThreadObject class. ! ** Used for searching in hash tables. ! ** ! ** @author Marek Przeczek, Petr Luner */ ! ! struct AllocThreadObjectKey { - /// thread ID - JNIEnv* envId; - - /// object key - AllocObjectKey objectKey; - }; - /** Crossroad of objects and threads. This class defines ** a relation between a thread and an object. Each object specified --- 36,48 ---- #define _ALLOC_THREAD_OBJECT_H_ ! #include "../main/includes.h" ! #include "../list/listItem.h" ! #include "../alloc/allocAbstractStatThreadObject.h" ! #include "../commun2/idObject.h" ! #include "../list/list.h" ! #include "../alloc/allocThreadObjectMethod.h" ! #include "../alloc/allocThreadObjectKey.h" ! #include "../allocator/allocator.h" /** Crossroad of objects and threads. This class defines ** a relation between a thread and an object. Each object specified *************** *** 60,66 **** ** @author Marek Przeczek, Petr Luner */ ! class AllocThreadObject: public LI1, public LI2, ! public AllocAbstractStatThreadObject, ! public IdObject, public LI3 { public: --- 55,63 ---- ** @author Marek Przeczek, Petr Luner */ ! class AllocThreadObject: public LI1, ! public LI2, ! public LI3, ! public AllocAbstractStatThreadObject, ! public IdObject { public: *************** *** 81,86 **** thread( NULL), object( NULL) ! {}; /** Addition of the object's size to statistics. --- 78,86 ---- thread( NULL), object( NULL) + + {} ! /// Destructor. ! virtual ~AllocThreadObject() {} /** Addition of the object's size to statistics. *************** *** 111,129 **** /** Retrieves object's key. ** ! ** @param key where to store the key ** @return key ** ** @see Hash */ ! const AllocThreadObjectKey& getKey(AllocThreadObjectKey& key) { ! ! thread->getKey(key.envId); ! object->getKey(key.objectKey); ! return key; ! } /** Compares object with given key. ** ** @param key key ** @return 1 (true); ** 0 (false) --- 111,126 ---- /** Retrieves object's key. ** ! ** @param key where to store the key ! ** ** @return key ** ** @see Hash */ ! const AllocThreadObjectKey& getKey(AllocThreadObjectKey& key); /** Compares object with given key. ** ** @param key key + ** ** @return 1 (true); ** 0 (false) *************** *** 131,148 **** ** @see Hash */ ! int operator==(const AllocThreadObjectKey& key) { ! ! return (*thread == key.envId) && (*object == key.objectKey); ! } /** Hash function. ** ! ** @param reference to a key ** @return hash value */ - - static int hashKey(const AllocThreadObjectKey& key) { ! return Thread::hashKey(key.envId) ^ AllocObject::hashKey(key.objectKey); ! } /** Performs deactivation. */ --- 128,140 ---- ** @see Hash */ ! int operator==(const AllocThreadObjectKey& key); /** Hash function. ** ! ** @param key reference to a key ! ** ** @return hash value */ ! static int hashKey(const AllocThreadObjectKey& key); /** Performs deactivation. */ *************** *** 150,153 **** --- 142,146 ---- void deactivate(); + #ifdef USE_ALLOCATOR private: *************** *** 159,167 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} public: --- 152,161 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif public: *************** *** 169,173 **** /** Class identification. ** ! ** @return unique class type identified */ virtual eClassIdent getClassIdent() { return ALLOC_THREAD_OBJECT;} --- 163,167 ---- /** Class identification. ** ! ** @return unique class type identifier */ virtual eClassIdent getClassIdent() { return ALLOC_THREAD_OBJECT;} *************** *** 179,183 **** ** 1 (active) */ ! virtual int isActive() { return (object->isActive() && thread->isActive());} /** Indication that object has changed its data. --- 173,177 ---- ** 1 (active) */ ! virtual int isActive(); /** Indication that object has changed its data. *************** *** 190,198 **** /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged() { ! ! IdObject::setUnchanged(); ! clearDataChanged(); ! } }; --- 184,188 ---- /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged(); }; Index: allocThreadObjectMethod.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocThreadObjectMethod.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** allocThreadObjectMethod.cpp 2001/09/18 22:19:28 1.13 --- allocThreadObjectMethod.cpp 2001/11/21 22:31:41 1.14 *************** *** 33,40 **** */ ! #include "../main/includes.h" - Allocator AllocThreadObjectMethod::_allocator( sizeof( AllocThreadObjectMethod)); - void AllocThreadObjectMethod::addMemoryStat( jint size) { --- 33,47 ---- */ ! #include "../alloc/allocThreadObjectMethod.h" ! #include "../prof/prof.h" ! #include "../alloc/allocThreadMethod.h" ! #include "../alloc/allocObjectMethod.h" ! #include "../alloc/allocThreadObject.h" ! #include "../alloc/allocThreadObjectTrace.h" ! ! #ifdef USE_ALLOCATOR ! Allocator AllocThreadObjectMethod::_allocator; ! #endif void AllocThreadObjectMethod::addMemoryStat( jint size) { *************** *** 78,80 **** --- 85,117 ---- tot = threadObjectTraces.next(tot); } + } + + const AllocThreadObjectMethodKey& AllocThreadObjectMethod::getKey(AllocThreadObjectMethodKey& key) { + + threadObject->thread->getKey(key.envId); + objectMethod->getKey(key.objectMethodKey); + return key; + } + + int AllocThreadObjectMethod::operator==(const AllocThreadObjectMethodKey& key) { + + return (*threadObject->thread == key.envId) && (*objectMethod == key.objectMethodKey); + } + + int AllocThreadObjectMethod::hashKey(const AllocThreadObjectMethodKey& key) { + + return Thread::hashKey(key.envId) ^ AllocObjectMethod::hashKey(key.objectMethodKey); + } + + int AllocThreadObjectMethod::isActive() { + + return (objectMethod->isActive() && + threadObject->isActive() && + threadMethod->isActive()); + } + + void AllocThreadObjectMethod::setUnchanged() { + + IdObject::setUnchanged(); + clearDataChanged(); } Index: allocThreadObjectMethod.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocThreadObjectMethod.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** allocThreadObjectMethod.h 2001/09/02 20:14:21 1.18 --- allocThreadObjectMethod.h 2001/11/21 22:31:41 1.19 *************** *** 36,53 **** #define _ALLOC_THREAD_OBJECT_METHOD_H_ ! /** Key for AllocThreadObjectMethod class. ! ** Used for searching in hash tables. ! ** ! ** @author Marek Przeczek, Petr Luner */ ! ! struct AllocThreadObjectMethodKey { - /// thread ID - JNIEnv* envId; - - /// AllocObjectMethod key - AllocObjectMethodKey objectMethodKey; - }; - /** Thread-Object-Method information crossing. This class contains ** statistic information about an object allocated by a method call --- 36,48 ---- #define _ALLOC_THREAD_OBJECT_METHOD_H_ ! #include "../main/includes.h" ! #include "../list/listItem.h" ! #include "../alloc/allocAbstractStatThreadObject.h" ! #include "../commun2/idObject.h" ! #include "../list/list.h" ! #include "../alloc/allocThreadObjectTrace.h" ! #include "../alloc/allocThreadObjectMethodKey.h" ! #include "../allocator/allocator.h" /** Thread-Object-Method information crossing. This class contains ** statistic information about an object allocated by a method call *************** *** 60,66 **** ** @author Marek Przeczek, Petr Luner */ ! class AllocThreadObjectMethod: public LI1, public LI2, public LI3, ! public AllocAbstractStatThreadObject, ! public IdObject, public LI4 { public: --- 55,64 ---- ** @author Marek Przeczek, Petr Luner */ ! class AllocThreadObjectMethod: public LI1, ! public LI2, ! public LI3, ! public LI4, ! public AllocAbstractStatThreadObject, ! public IdObject { public: *************** *** 85,90 **** objectMethod( NULL), threadMethod( NULL) ! {}; /** Addition of the object's size to statistics. --- 83,91 ---- objectMethod( NULL), threadMethod( NULL) + + {} ! /// Destructor. ! virtual ~AllocThreadObjectMethod() {} /** Addition of the object's size to statistics. *************** *** 115,133 **** /** Retrieves object's key. ** ! ** @param key where to store the key ** @return key ** ** @see Hash */ ! const AllocThreadObjectMethodKey& getKey(AllocThreadObjectMethodKey& key) { ! ! threadObject->thread->getKey(key.envId); ! objectMethod->getKey(key.objectMethodKey); ! return key; ! } /** Compares object with given key. ** ** @param key key ** @return 1 (true); ** 0 (false) --- 116,131 ---- /** Retrieves object's key. ** ! ** @param key where to store the key ! ** ** @return key ** ** @see Hash */ ! const AllocThreadObjectMethodKey& getKey(AllocThreadObjectMethodKey& key); /** Compares object with given key. ** ** @param key key + ** ** @return 1 (true); ** 0 (false) *************** *** 135,152 **** ** @see Hash */ ! int operator==(const AllocThreadObjectMethodKey& key) { ! ! return (*threadObject->thread == key.envId) && (*objectMethod == key.objectMethodKey); ! } /** Hash function. ** ! ** @param reference to a key ** @return hash value */ - - static int hashKey(const AllocThreadObjectMethodKey& key) { ! return Thread::hashKey(key.envId) ^ AllocObjectMethod::hashKey(key.objectMethodKey); ! } /** Performs deactivation. */ --- 133,145 ---- ** @see Hash */ ! int operator==(const AllocThreadObjectMethodKey& key); /** Hash function. ** ! ** @param key reference to a key ! ** ** @return hash value */ ! static int hashKey(const AllocThreadObjectMethodKey& key); /** Performs deactivation. */ *************** *** 154,157 **** --- 147,151 ---- void deactivate(); + #ifdef USE_ALLOCATOR private: *************** *** 163,171 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ ... [truncated message content] |
From: Marek P. <ma...@us...> - 2001-11-21 22:32:15
|
Update of /cvsroot/javaprofiler/library/src/commun In directory usw-pr-cvs1:/tmp/cvs-serv12170/src/commun Modified Files: Makefile.rules binaryFormat.h buffer.cpp buffer.h commun.h communSocket.cpp communSocket.h dir.info iprof.cpp iprof.h statDataModification.h Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux Index: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun/Makefile.rules,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Makefile.rules 2001/07/22 23:37:58 1.2 --- Makefile.rules 2001/11/21 22:31:42 1.3 *************** *** 1,12 **** buffer.o \ ! buffer.obj: buffer.cpp ../main/includes.h $(CCC) $(CPPFLAGS) buffer.cpp communSocket.o \ ! communSocket.obj: communSocket.cpp ../main/includes.h $(CCC) $(CPPFLAGS) communSocket.cpp iprof.o \ ! iprof.obj: iprof.cpp ../main/includes.h $(CCC) $(CPPFLAGS) iprof.cpp --- 1,12 ---- buffer.o \ ! buffer.obj: buffer.cpp $(CCC) $(CPPFLAGS) buffer.cpp communSocket.o \ ! communSocket.obj: communSocket.cpp $(CCC) $(CPPFLAGS) communSocket.cpp iprof.o \ ! iprof.obj: iprof.cpp $(CCC) $(CPPFLAGS) iprof.cpp Index: binaryFormat.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun/binaryFormat.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** binaryFormat.h 2001/09/18 22:19:28 1.4 --- binaryFormat.h 2001/11/21 22:31:42 1.5 *************** *** 36,39 **** --- 36,42 ---- #define _BINARY_FORMAT_H_ + #include "../main/includes.h" + #include "../commun/buffer.h" + /** Statistic data binary format. Each class ** which has statistic data must be inherited from *************** *** 49,52 **** --- 52,61 ---- public: + /// Default constructor. + DataBinaryFormat() {} + + /// Destructor. + virtual ~DataBinaryFormat() {} + /** Convert data to binary. This method converts statistic ** data to binary format in which it is sent thru communication *************** *** 72,75 **** --- 81,90 ---- public: + /// Default constructor. + InfoBinaryFormat() {} + + /// Destructor. + virtual ~InfoBinaryFormat() {} + /** Convert info to binary. This method converts information ** data to binary format in which it is sent thru communication *************** *** 85,87 **** #endif // _BINARY_FORMAT_H_ - --- 100,101 ---- Index: buffer.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun/buffer.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** buffer.cpp 2001/09/02 20:14:21 1.4 --- buffer.cpp 2001/11/21 22:31:42 1.5 *************** *** 33,37 **** */ ! #include "../main/includes.h" Buffer::Buffer( const Buffer& b) { --- 33,37 ---- */ ! #include "../commun/buffer.h" Buffer::Buffer( const Buffer& b) { Index: buffer.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun/buffer.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** buffer.h 2001/09/02 20:14:21 1.4 --- buffer.h 2001/11/21 22:31:42 1.5 *************** *** 36,39 **** --- 36,42 ---- #define _BUFFER_H_ + #include "../main/includes.h" + #include "../string/string.h" + /** I/O buffer. This class implements an input/output buffer ** needed during communication between profiler dynamic library *************** *** 62,65 **** --- 65,70 ---- }; + private: + /// pointer to buffer char* _buf; *************** *** 80,84 **** _bufSize( 0) ! {}; /// Copy constructor. --- 85,89 ---- _bufSize( 0) ! {} /// Copy constructor. *************** *** 171,173 **** #endif // _BUFFER_H_ - --- 176,177 ---- Index: commun.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun/commun.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** commun.h 2001/09/23 16:50:15 1.5 --- commun.h 2001/11/21 22:31:42 1.6 *************** *** 36,39 **** --- 36,42 ---- #define _COMMUN_H_ + #include "../main/includes.h" + #include "../commun/buffer.h" + /** Communication. This abstract class offers standard ** interface for all inherited communication classes. *************** *** 49,53 **** class Commun { - protected: --- 52,55 ---- *************** *** 62,71 **** _failed( 0) ! {}; public: /// Destructor. ! virtual ~Commun() {}; /** Initialization of communication. This method should --- 64,73 ---- _failed( 0) ! {} public: /// Destructor. ! virtual ~Commun() {} /** Initialization of communication. This method should *************** *** 119,121 **** #endif // _COMMUN_H_ - --- 121,122 ---- Index: communSocket.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun/communSocket.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** communSocket.cpp 2001/09/02 20:14:21 1.8 --- communSocket.cpp 2001/11/21 22:31:42 1.9 *************** *** 33,37 **** */ ! #include "../main/includes.h" CommunSocket::CommunSocket( int connectMode, const String& hostname, unsigned short port) : --- 33,37 ---- */ ! #include "../commun/communSocket.h" CommunSocket::CommunSocket( int connectMode, const String& hostname, unsigned short port) : *************** *** 41,44 **** --- 41,46 ---- _port( port) { + FD_ZERO( &_fds); + #ifdef WIN32 _csock = INVALID_SOCKET; *************** *** 145,148 **** --- 147,156 ---- } + if( !_failed) { + + FD_ZERO( &_fds); + FD_SET( _csock, &_fds); + } + return !_failed; } *************** *** 170,176 **** jint nsize; - int rc = recv( _csock, (char*)&nsize, sizeof( nsize), 0); ! #ifdef WIN32 if( _failed = (rc == SOCKET_ERROR || rc < sizeof( nsize))) return *this; --- 178,183 ---- jint nsize; int rc = recv( _csock, (char*)&nsize, sizeof( nsize), 0); ! #ifdef WIN32 if( _failed = (rc == SOCKET_ERROR || rc < sizeof( nsize))) return *this; *************** *** 183,189 **** if( size) { ! char* buf = new char[size]; ! rc = recv( _csock, buf, size, 0); --- 190,196 ---- if( size) { ! char* buf = new char[size]; ! rc = recv( _csock, buf, size, 0); *************** *** 205,218 **** int CommunSocket::isReady() { - fd_set fds; - - FD_ZERO( &fds); - FD_SET( _csock, &fds); - timeval tv; ! tv.tv_sec = 0; ! tv.tv_usec = 1000; ! int rc = select( _csock+1, &fds, NULL, NULL, &tv); #ifdef WIN32 --- 212,220 ---- int CommunSocket::isReady() { timeval tv; ! tv.tv_sec = 5; ! tv.tv_usec = 0; // wait 5s before timeout ! int rc = select( _csock+1, &_fds, NULL, NULL, &tv); #ifdef WIN32 Index: communSocket.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun/communSocket.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** communSocket.h 2001/09/23 16:50:15 1.8 --- communSocket.h 2001/11/21 22:31:42 1.9 *************** *** 36,39 **** --- 36,44 ---- #define _COMMUN_SOCKET_H_ + #include "../main/includes.h" + #include "../commun/commun.h" + #include "../string/string.h" + #include "../commun/buffer.h" + /** Socket communication. This class implements TCP/IP socket ** communication and offers the user of this class the standard *************** *** 62,65 **** --- 67,73 ---- #endif + /// temporary FDSET for select() call + fd_set _fds; + /** Hostname. It is used only when connectMode is set ** to 'client' (1); it contains target host's name. */ *************** *** 139,141 **** #endif // _COMMUN_SOCKET_H_ - --- 147,148 ---- Index: dir.info =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun/dir.info,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** dir.info 2001/07/28 04:11:17 1.5 --- dir.info 2001/11/21 22:31:42 1.6 *************** *** 1,3 **** FILES = buffer communSocket iprof - CLEAN_FILES = *.pdb *.obj *.o --- 1,2 ---- Index: iprof.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun/iprof.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** iprof.cpp 2001/09/02 20:14:21 1.9 --- iprof.cpp 2001/11/21 22:31:42 1.10 *************** *** 33,43 **** */ ! #include "../main/includes.h" ! Allocator IProf::sID::_allocator( sizeof( IProf::sID)); ! IProf::IProf( const Setup& setup) : ! ! communLock( "_commun_lock"), conEstabl( 0) { --- 33,50 ---- */ ! #include "../commun/iprof.h" ! #include "../commun/communSocket.h" ! #include "../commun3/communShMem.h" ! #include "../delay/delay.h" ! #include "../prof/synchronized.h" ! #include "../prof/prof.h" ! ! #ifdef USE_ALLOCATOR ! Allocator IProf::sID::_allocator; ! #endif ! IProf::IProf( const Setup& setup, JVMPI_Interface* jvmpi) : ! communLock( "_commun_lock", jvmpi), conEstabl( 0) { *************** *** 52,56 **** _func[F_GET_CHANGED] = &IProf::_getChanged; ! if( setup.com.communType == COMMUN_SOCKET) _commun = new CommunSocket( setup.com.connectMode, --- 59,63 ---- _func[F_GET_CHANGED] = &IProf::_getChanged; ! if( setup.com.communType == Setup::COMMUN_SOCKET) _commun = new CommunSocket( setup.com.connectMode, *************** *** 74,92 **** Buffer buf; while( 1) { - - Synchronized sync( communLock, 0); ! while( 1) { ! ! sync.enter(); ! if( _commun->isReady()) break; ! sync.release(); if( _commun->hasFailed()) return (conEstabl = 0); ! ! Delay::delay( 1); } buf.clear(); (*_commun) >> buf; if( _commun->hasFailed()) return (conEstabl = 0); --- 81,95 ---- Buffer buf; while( 1) { ! if( !_commun->isReady()) { if( _commun->hasFailed()) return (conEstabl = 0); ! continue; } + Synchronized sync( communLock); + buf.clear(); + (*_commun) >> buf; if( _commun->hasFailed()) return (conEstabl = 0); *************** *** 187,190 **** --- 190,198 ---- b += s->infoId; b += s->objId; + + b += s->parentLeftObjId; + b += s->parentUpObjId; + b += s->parentRightObjId; + b += s->active; *************** *** 201,228 **** if( s->hasMonData) s->mon.dataToBin( b); ! return 0; ! } ! ! void IProf::_getAll( Buffer& b) { ! const char* buf = b.getBuffer()+sizeof( jint); // jump the "action" field ! jint objId = ntohl( *(const jint*)buf); ! buf += sizeof( objId); ! jint what = ntohl( *(const jint*)buf); ! ! seqID seq; ! jint rc = getAll( objId, (eSeqType)what, seq); ! ! b.clear( seq.length()*sizeof( sID)); ! b += rc; ! ! if( rc < 0) return; ! void* buf2 = &b; ! seq.forEach( sToBin, &buf2); } ! void IProf::_getChanged( Buffer& b) { const char* buf = b.getBuffer()+sizeof( jint); // jump the "action" field --- 209,224 ---- if( s->hasMonData) s->mon.dataToBin( b); ! b += s->hasInfo; ! if( s->hasInfo) { ! b += s->infoType; ! s->info->infoToBin( b); ! } ! return 0; } ! void IProf::_getAllOrChanged( int all, Buffer& b) { const char* buf = b.getBuffer()+sizeof( jint); // jump the "action" field *************** *** 230,237 **** jint objId = ntohl( *(const jint*)buf); buf += sizeof( objId); jint what = ntohl( *(const jint*)buf); seqID seq; ! jint rc = getChanged( objId, (eSeqType)what, seq); b.clear( seq.length()*sizeof( sID)); --- 226,243 ---- jint objId = ntohl( *(const jint*)buf); buf += sizeof( objId); + jint what = ntohl( *(const jint*)buf); + buf += sizeof( what); + jint includeInfo = ntohl( *(const jint*)buf); + buf += sizeof( includeInfo); + + jint optionalArg = ntohl( *(const jint*)buf); + seqID seq; ! jint rc; ! ! if( all) rc = getAll( objId, (eSeqType)what, includeInfo, optionalArg, seq); ! else rc = getChanged( objId, (eSeqType)what, includeInfo, optionalArg, seq); b.clear( seq.length()*sizeof( sID)); Index: iprof.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun/iprof.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** iprof.h 2001/09/02 20:14:21 1.12 --- iprof.h 2001/11/21 22:31:42 1.13 *************** *** 36,39 **** --- 36,50 ---- #define _IPROF_H_ + #include "../main/includes.h" + #include "../commun/buffer.h" + #include "../prof/lock.h" + #include "../alloc/allocStatData.h" + #include "../cpu/cpuStatData.h" + #include "../mon/monStatData.h" + #include "../allocator/allocator.h" + #include "../list/list.h" + #include "../setup/setup.h" + #include "../list/listItem.h" + /** Communication interface class. This class implements ** the whole communication interface between this profiler *************** *** 52,66 **** typedef void (IProf::*Func)( Buffer&); - public: - /// constants enum e { - /// default TCP port - COMMUN_PORT = 25595, - - /// default shared memory size (in bytes) - COMMUN_SHMEM_SIZE = 256*1024, - /// number of methods of the interface FUNC_COUNT = 9 --- 63,69 ---- *************** *** 85,100 **** typedef jint objectID; - public: - - /// type of communication - enum eCommunType { - - /// sockets (TCP/IP) - COMMUN_SOCKET, - - /// shared memory - COMMUN_SHMEM - }; - protected: --- 88,91 ---- *************** *** 160,188 **** /// info about Java class ! CLASS_INFO = 0, /// info about Java class field ! CLASS_FIELD_INFO = 1, /// info about Java class method ! METHOD_INFO = 2, /// info about Java method trace ! TRACE_INFO = 3, /// info about Java object ! OBJECT_INFO = 4, /// info about Java arena ! ARENA_INFO = 5, /// info about Java thread ! THREAD_INFO = 6, /// info about group of Java threads ! THREAD_GROUP_INFO = 7, /// info about Java garbage collector ! GC_INFO = 8 }; --- 151,179 ---- /// info about Java class ! CLASS_INFO = 0, /// info about Java class field ! CLASS_FIELD_INFO = 1, /// info about Java class method ! METHOD_INFO = 2, /// info about Java method trace ! TRACE_INFO = 3, /// info about Java object ! OBJECT_INFO = 4, /// info about Java arena ! ARENA_INFO = 5, /// info about Java thread ! THREAD_INFO = 6, /// info about group of Java threads ! THREAD_GROUP_INFO = 7, /// info about Java garbage collector ! GC_INFO = 8 }; *************** *** 236,239 **** --- 227,239 ---- objectID objId; + /// ID of parent #1 (on the left side in the structure) + objectID parentLeftObjId; + + /// ID of parent #2 (on up in the structure) + objectID parentUpObjId; + + /// ID of parent #3 (on the right side in the structure) + objectID parentRightObjId; + /// object still active or not jint active; *************** *** 257,260 **** --- 257,270 ---- MonStatData mon; + /// information about object is included or not + jint hasInfo; + + /// information about object (if turned on and possible) or NULL + InfoBinaryFormat* info; + + /// type of information (depends on type of object) + jint infoType; + + #ifdef USE_ALLOCATOR private: *************** *** 266,274 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} }; --- 276,285 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif }; *************** *** 396,400 **** /// method traces (monitor profiling) ! MON_TRACES = 38 }; --- 407,418 ---- /// method traces (monitor profiling) ! MON_TRACES = 38, ! ! /// threads where concrete method was called (memory profiling) ! ALLOC_METHOD_THREADS = 40, ! ! /** threads where concrete method in concrete trace ! ** was called (memory profiling) */ ! ALLOC_METHOD_TRACE_THREADS = 41 }; *************** *** 410,416 **** ** supported. ** ! ** @param setup commun setup */ ! IProf( const Setup& setup); /** Destructor. It stops communication and closes --- 428,435 ---- ** supported. ** ! ** @param setup commun setup ! ** @param jvmpi pointer to JVMPI interface */ ! IProf( const Setup& setup, JVMPI_Interface* jvmpi); /** Destructor. It stops communication and closes *************** *** 518,522 **** ** @see getAll() */ ! void _getAll( Buffer& b); /** Get all objects with changed statistic data. This method --- 537,541 ---- ** @see getAll() */ ! void _getAll( Buffer& b) { _getAllOrChanged( 1, b);} /** Get all objects with changed statistic data. This method *************** *** 528,533 **** ** ** @see getChanged() */ ! void _getChanged( Buffer& b); public: --- 547,559 ---- ** ** @see getChanged() */ + + void _getChanged( Buffer& b) { _getAllOrChanged( 0, b);} + + private: + + // internally used by IProf::_getAll() and IProf::_getChanged() + // not documented ! void _getAllOrChanged( int all, Buffer& b); public: *************** *** 573,578 **** ** @see Prof::getInfo(), Prof */ ! virtual jint getInfo( objectID infoId, // in (jint) ! eInfoType type, // in (jint) InfoBinaryFormat*& info) = 0; // out --- 599,604 ---- ** @see Prof::getInfo(), Prof */ ! virtual jint getInfo( objectID infoId, // in (jint) ! eInfoType type, // in (jint) InfoBinaryFormat*& info) = 0; // out *************** *** 582,588 **** ** @see Prof::getData(), Prof */ ! virtual jint getData( objectID objId, // in (jint) ! eDataType type, // in (jint) ! sData& data) = 0; // out /** Get all objects with all statistic data. An abstract --- 608,614 ---- ** @see Prof::getData(), Prof */ ! virtual jint getData( objectID objId, // in (jint) ! eDataType type, // in (jint) ! sData& data) = 0; // out /** Get all objects with all statistic data. An abstract *************** *** 591,597 **** ** @see Prof::getAll(), Prof */ ! virtual jint getAll( objectID objId, // in (jint) ! eSeqType what, // in (jint) ! seqID& seq) = 0; // out /** Get all objects with changed statistic data. An abstract --- 617,625 ---- ** @see Prof::getAll(), Prof */ ! virtual jint getAll( objectID objId, // in (jint) ! eSeqType what, // in (jint) ! jint includeInfo, // in (jint) ! jint optionalArg, // in (jint) ! seqID& seq) = 0; // out /** Get all objects with changed statistic data. An abstract *************** *** 600,606 **** ** @see Prof::getChanged(), Prof */ ! virtual jint getChanged( objectID objId, // in (jint) ! eSeqType what, // in (jint) ! seqID& seq) = 0; // out private: --- 628,636 ---- ** @see Prof::getChanged(), Prof */ ! virtual jint getChanged( objectID objId, // in (jint) ! eSeqType what, // in (jint) ! jint includeInfo, // in (jint) ! jint optionalArg, // in (jint) ! seqID& seq) = 0; // out private: *************** *** 629,631 **** #endif // _IPROF_H_ - --- 659,660 ---- Index: statDataModification.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun/statDataModification.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** statDataModification.h 2001/09/18 22:19:28 1.4 --- statDataModification.h 2001/11/21 22:31:42 1.5 *************** *** 36,39 **** --- 36,41 ---- #define _STAT_DATA_MODIFICATION_H_ + #include "../main/includes.h" + /** Statistic data modification. This class is used ** for indication of change of statistics. *************** *** 55,59 **** _changed( 1) ! {}; /** Data changed. This method returns TRUE, if data has changed. --- 57,61 ---- _changed( 1) ! {} /** Data changed. This method returns TRUE, if data has changed. *************** *** 75,77 **** #endif // _STAT_DATA_MODIFICATION_H_ - --- 77,78 ---- |
From: Marek P. <ma...@us...> - 2001-11-21 22:32:14
|
Update of /cvsroot/javaprofiler/library/src/allocator In directory usw-pr-cvs1:/tmp/cvs-serv12170/src/allocator Modified Files: Makefile.rules allocator.cpp allocator.h dir.info Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux Index: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/src/allocator/Makefile.rules,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Makefile.rules 2001/07/22 23:37:58 1.2 --- Makefile.rules 2001/11/21 22:31:41 1.3 *************** *** 1,3 **** allocator.o \ ! allocator.obj: allocator.cpp ../main/includes.h $(CCC) $(CPPFLAGS) allocator.cpp --- 1,3 ---- allocator.o \ ! allocator.obj: allocator.cpp $(CCC) $(CPPFLAGS) allocator.cpp Index: allocator.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/allocator/allocator.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** allocator.cpp 2001/09/18 22:19:28 1.6 --- allocator.cpp 2001/11/21 22:31:42 1.7 *************** *** 33,38 **** */ ! #include "../main/includes.h" void Allocator::allocNewBlock() { --- 33,59 ---- */ ! #ifdef USE_ALLOCATOR + #include "../allocator/allocator.h" + #include "../prof/prof.h" + + void* Allocator::get( size_t unitSize) { + + if( !_unitSize) _unitSize = unitSize; + + if( !_freeUnits) allocNewBlock(); + + void* unit = _freeUnits; + _freeUnits = *(void**)_freeUnits; + + return unit; + } + + void Allocator::put( void* unit) { + + *(void**)unit = _freeUnits; + _freeUnits = unit; + } + void Allocator::allocNewBlock() { *************** *** 55,60 **** Allocator::~Allocator() { - Prof::destroy(); - size_t len = _unitSize*NUM_UNITS_IN_BLOCK+sizeof( void*); --- 76,79 ---- *************** *** 66,67 **** --- 85,89 ---- } } + + #endif + Index: allocator.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/allocator/allocator.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** allocator.h 2001/09/02 20:14:21 1.8 --- allocator.h 2001/11/21 22:31:42 1.9 *************** *** 36,39 **** --- 36,43 ---- #define _ALLOCATOR_H_ + #ifdef USE_ALLOCATOR + + #include "../main/includes.h" + /** Allocator. ** This class serves for allocation of memory units of *************** *** 69,75 **** public: ! /** Constructor ** ! ** @param unitSize size of memory unit */ Allocator( size_t unitSize = 0) : --- 73,79 ---- public: ! /** Constructor. ** ! ** @param unitSize size of memory unit */ Allocator( size_t unitSize = 0) : *************** *** 79,83 **** _unitSize( unitSize) ! {}; /// Destructor --- 83,87 ---- _unitSize( unitSize) ! {} /// Destructor *************** *** 86,117 **** /** Gets memory unit. ** If the 'unitSize' argument is supplied and ! ** the size of memory unit hasn't been allready ** initialized, it is initialized to 'unitSize'. ** ! ** @param unitSize size of memory unit ** ** @return pointer to memory unit */ - - void* get( size_t unitSize = 0) { ! if( !_unitSize) _unitSize = unitSize; - if( !_freeUnits) allocNewBlock(); - - void* unit = _freeUnits; - _freeUnits = *(void**)_freeUnits; - - return unit; - } - /** Puts memory unit previously obtained by get() method back. ** ** @param unit pointer to memory unit */ - - void put( void* unit) { ! *(void**)unit = _freeUnits; ! _freeUnits = unit; ! } private: --- 90,107 ---- /** Gets memory unit. ** If the 'unitSize' argument is supplied and ! ** the size of memory unit hasn't been already ** initialized, it is initialized to 'unitSize'. ** ! ** @param unitSize size of memory unit ** ** @return pointer to memory unit */ ! void* get( size_t unitSize = 0); /** Puts memory unit previously obtained by get() method back. ** ** @param unit pointer to memory unit */ ! void put( void* unit); private: *************** *** 122,124 **** --- 112,115 ---- }; + #endif #endif // _ALLOCATOR_H_ Index: dir.info =================================================================== RCS file: /cvsroot/javaprofiler/library/src/allocator/dir.info,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** dir.info 2001/07/22 23:37:58 1.2 --- dir.info 2001/11/21 22:31:42 1.3 *************** *** 1,3 **** FILES = allocator - CLEAN_FILES = *.pdb *.obj *.o --- 1,2 ---- |
Update of /cvsroot/javaprofiler/library/src2 In directory usw-pr-cvs1:/tmp/cvs-serv12170/src2 Modified Files: CommunShMem.cpp Makefile.rules dir.info Added Files: README Removed Files: BAD_COMMAND_Exception.java BAD_DATA_TYPE_Exception.java BAD_INFO_ID_Exception.java BAD_INFO_TYPE_Exception.java BAD_OBJ_ID_Exception.java Buffer.java COMMUN_Exception.java Commun.java CommunSetup.java CommunSetupShMem.java CommunSetupSocket.java CommunShMem.java CommunSocket.java IProf.java IProfException.java UNKNOWN_Exception.java Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux --- NEW FILE: README --- CONTENTS 0. Introduction 1. Download the newest code from CVS 2. Copy communication interface sources 3. The end 0. Introduction Since this version, sources of communication interface to dynamic profiler library are stored in CVS module called "jpiimpl". Please download and copy Java source code of communication interface to this directory. Else you will not be able to compile sources of dynamic library properly. 1. Download the newest code from CVS $ cvs -d:pserver:ano...@cv...:\ /cvsroot/javaprofiler login $ cvs -z3 -d:pserver:ano...@cv...:\ /cvsroot/javaprofiler co jpiimpl 2. Copy communication interface sources After downloading the newest CVS version of communication interface sources, new "jpiimpl" directory was created. In "jpiimpl/net/sourceforge/javaprofiler /jpiimpl/commun/" subdirectory there are sources which you need to copy to this "src2/net/" subdirectory. $ cp <where_you_have_it>/jpiimpl/net/sourceforge/javaprofiler/jpiimpl\ /commun/*.java net/sourceforge/javaprofiler/jpiimpl/commun/. 3. The end Now it should compile with no failures. During successful compilation, IProf.jar and libCommunShMem.so (or CommunShMem.dll on Win32) will be created in this directory. Index: CommunShMem.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src2/CommunShMem.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** CommunShMem.cpp 2001/09/02 20:14:22 1.3 --- CommunShMem.cpp 2001/11/21 22:31:40 1.4 *************** *** 34,38 **** #include "CommunShMem.h" ! #include "../src/main/includes.h" /** JNI implementation of shared memory communication. This class is --- 34,39 ---- #include "CommunShMem.h" ! #include "../src/commun3/semaphore.h" ! #include "../src/commun3/sharedMemory.h" /** JNI implementation of shared memory communication. This class is *************** *** 208,212 **** jclass clazz = env->GetObjectClass( b); ! mId = env->GetMethodID( clazz, "useBuffer", "([BI)LBuffer;"); } --- 209,213 ---- jclass clazz = env->GetObjectClass( b); ! mId = env->GetMethodID( clazz, "useBuffer", "([BI)Lnet/sourceforge/javaprofiler/jpiimpl/commun/Buffer;"); } *************** *** 240,249 **** /* ! * Class: CommunShMem * Method: construct * Signature: (Ljava/lang/String;I)V */ ! JNIEXPORT void JNICALL Java_CommunShMem_construct ( JNIEnv* env, jobject obj, jstring shmemId, jint shmemSize) { --- 241,250 ---- /* ! * Class: net.sourceforge.javaprofiler.jpiimpl.commun.CommunShMem * Method: construct * Signature: (Ljava/lang/String;I)V */ ! JNIEXPORT void JNICALL Java_net_0002fsourceforge_0002fjavaprofiler_0002fjpiimpl_0002fcommun_0002fCommunShMem_construct ( JNIEnv* env, jobject obj, jstring shmemId, jint shmemSize) { *************** *** 276,290 **** /* ! * Class: CommunShMem * Method: finalize * Signature: ()V */ ! ! JNIEXPORT void JNICALL Java_CommunShMem_finalize (JNIEnv* env, jobject obj) { NativeCommunShMem* n = NativeCommunShMem::get( env, obj); - if( !n->communStopped) Java_CommunShMem_stopCommun( env, obj); if( n) delete n; } --- 277,292 ---- /* ! * Class: net.sourceforge.javaprofiler.jpiimpl.commun.CommunShMem * Method: finalize * Signature: ()V */ ! JNIEXPORT void JNICALL Java_net_0002fsourceforge_0002fjavaprofiler_0002fjpiimpl_0002fcommun_0002fCommunShMem_finalize (JNIEnv* env, jobject obj) { NativeCommunShMem* n = NativeCommunShMem::get( env, obj); + + if( !n->communStopped) + Java_net_0002fsourceforge_0002fjavaprofiler_0002fjpiimpl_0002fcommun_0002fCommunShMem_stopCommun( env, obj); if( n) delete n; } *************** *** 304,313 **** /* ! * Class: CommunShMem * Method: read ! * Signature: (LBuffer;)LCommun; */ ! JNIEXPORT jobject JNICALL Java_CommunShMem_read ( JNIEnv* env, jobject obj, jobject b) { --- 306,315 ---- /* ! * Class: net.sourceforge.javaprofiler.jpiimpl.commun.CommunShMem * Method: read ! * Signature: (Lnet/sourceforge/javaprofiler/jpiimpl/commun/Buffer;)Lnet/sourceforge/javaprofiler/jpiimpl/commun/Commun; */ ! JNIEXPORT jobject JNICALL Java_net_0002fsourceforge_0002fjavaprofiler_0002fjpiimpl_0002fcommun_0002fCommunShMem_read ( JNIEnv* env, jobject obj, jobject b) { *************** *** 321,325 **** int shmemSize = n->shmem.getSize(); ! jint size = ntohl( *(jint*)p); if( size < 0) { --- 323,327 ---- int shmemSize = n->shmem.getSize(); ! jint size = (signed)ntohl( *(jint*)p); if( size < 0) { *************** *** 383,392 **** /* ! * Class: CommunShMem * Method: write ! * Signature: (LBuffer;)LCommun; */ ! JNIEXPORT jobject JNICALL Java_CommunShMem_write ( JNIEnv* env, jobject obj, jobject b) { --- 385,394 ---- /* ! * Class: net.sourceforge.javaprofiler.jpiimpl.commun.CommunShMem * Method: write ! * Signature: (Lnet/sourceforge/javaprofiler/jpiimpl/commun/Buffer;)Lnet/sourceforge/javaprofiler/jpiimpl/commun/Commun; */ ! JNIEXPORT jobject JNICALL Java_net_0002fsourceforge_0002fjavaprofiler_0002fjpiimpl_0002fcommun_0002fCommunShMem_write ( JNIEnv* env, jobject obj, jobject b) { *************** *** 399,403 **** int shmemSize = n->shmem.getSize(); ! if( ntohl( *(jint*)p) < 0) { n->failed = JNI_TRUE; --- 401,405 ---- int shmemSize = n->shmem.getSize(); ! if( (signed)ntohl( *(jint*)p) < 0) { n->failed = JNI_TRUE; *************** *** 462,471 **** /* ! * Class: CommunShMem * Method: hasFailed * Signature: ()Z */ ! JNIEXPORT jboolean JNICALL Java_CommunShMem_hasFailed ( JNIEnv* env, jobject obj) { --- 464,473 ---- /* ! * Class: net.sourceforge.javaprofiler.jpiimpl.commun.CommunShMem * Method: hasFailed * Signature: ()Z */ ! JNIEXPORT jboolean JNICALL Java_net_0002fsourceforge_0002fjavaprofiler_0002fjpiimpl_0002fcommun_0002fCommunShMem_hasFailed ( JNIEnv* env, jobject obj) { *************** *** 486,495 **** /* ! * Class: CommunShMem * Method: stopCommun * Signature: ()V */ ! ! JNIEXPORT void JNICALL Java_CommunShMem_stopCommun ( JNIEnv* env, jobject obj) { --- 488,496 ---- /* ! * Class: net.sourceforge.javaprofiler.jpiimpl.commun.CommunShMem * Method: stopCommun * Signature: ()V */ ! JNIEXPORT void JNICALL Java_net_0002fsourceforge_0002fjavaprofiler_0002fjpiimpl_0002fcommun_0002fCommunShMem_stopCommun ( JNIEnv* env, jobject obj) { *************** *** 498,502 **** n->isem.wait(); ! *(jint*)n->shmem.getAddress() = htonl( -1); n->communStopped = 1; n->isem.release(); --- 499,503 ---- n->isem.wait(); ! *(jint*)n->shmem.getAddress() = htonl( (unsigned)-1); n->communStopped = 1; n->isem.release(); *************** *** 506,507 **** --- 507,509 ---- } #endif + Index: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/src2/Makefile.rules,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** Makefile.rules 2001/09/02 15:23:00 1.4 --- Makefile.rules 2001/11/21 22:31:40 1.5 *************** *** 1,13 **** java.o \ ! java.obj: *.java ! $(JAVAC) $(JAVACFLAGS) *.java CommunShMem.o \ CommunShMem.obj: CommunShMem.cpp ../src/main/includes.h ! $(JAVAH) CommunShMem $(CCC) $(CPPFLAGS) CommunShMem.cpp do_link.o \ do_link.obj: ! $(JAR) cf $(PROF_JAVA_INTERF_PACKAGE) *.class $(LD) $(LDFLAGS2) $(OBJ_FILES) $(LDLIBS2) --- 1,13 ---- java.o \ ! java.obj: $(JPIIMPL)/*.java ! $(JAVAC) $(JAVACFLAGS) $(JPIIMPL)/*.java CommunShMem.o \ CommunShMem.obj: CommunShMem.cpp ../src/main/includes.h ! $(JAVAH) -o CommunShMem.h $(JPIIMPL)/CommunShMem $(CCC) $(CPPFLAGS) CommunShMem.cpp do_link.o \ do_link.obj: ! $(JAR) cf $(PROF_JAVA_INTERF_PACKAGE) $(JPIIMPL)/*.class $(LD) $(LDFLAGS2) $(OBJ_FILES) $(LDLIBS2) Index: dir.info =================================================================== RCS file: /cvsroot/javaprofiler/library/src2/dir.info,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** dir.info 2001/08/25 23:27:43 1.4 --- dir.info 2001/11/21 22:31:40 1.5 *************** *** 1,5 **** FILES = java CommunShMem do_link ! CLEAN_FILES = *.class *.jar *.h *.dll *.so *.obj *.o *.pdb *.lib *.exp *.tds - OBJ_FILES = *.o* ../src/string/*.o* --- 1,10 ---- + JPIIMPL = net/sourceforge/javaprofiler/jpiimpl/commun + FILES = java CommunShMem do_link + + CLEAN_FILES = $(JPIIMPL)/*.class *.jar *.h *.dll *.so *.obj *.o \ + *.pdb *.lib *.exp *.tds ! OBJ_FILES = *.o* ../src/string/string.o* ../src/commun3/semaphore.o* \ ! ../src/commun3/sharedMemory.o* --- BAD_COMMAND_Exception.java DELETED --- --- BAD_DATA_TYPE_Exception.java DELETED --- --- BAD_INFO_ID_Exception.java DELETED --- --- BAD_INFO_TYPE_Exception.java DELETED --- --- BAD_OBJ_ID_Exception.java DELETED --- --- Buffer.java DELETED --- --- COMMUN_Exception.java DELETED --- --- Commun.java DELETED --- --- CommunSetup.java DELETED --- --- CommunSetupShMem.java DELETED --- --- CommunSetupSocket.java DELETED --- --- CommunShMem.java DELETED --- --- CommunSocket.java DELETED --- --- IProf.java DELETED --- --- IProfException.java DELETED --- --- UNKNOWN_Exception.java DELETED --- |
From: Marek P. <ma...@us...> - 2001-11-21 22:32:12
|
Update of /cvsroot/javaprofiler/library/src In directory usw-pr-cvs1:/tmp/cvs-serv12170/src Modified Files: Makefile.rules dir.info Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux Index: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/src/Makefile.rules,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** Makefile.rules 2001/08/24 17:54:04 1.8 --- Makefile.rules 2001/11/21 22:31:39 1.9 *************** *** 127,130 **** --- 127,146 ---- $(MAKE) $(MFLAGS) gc clean + list.dir: + cd list + $(MAKE) $(MFLAGS) + cd .. + + list.dir.2: + $(MAKE) $(MFLAGS) list + + list.clean: + cd list + $(MAKE) $(MFLAGS) clean + cd .. + + list.clean.2: + $(MAKE) $(MFLAGS) list clean + main.dir: cd main Index: dir.info =================================================================== RCS file: /cvsroot/javaprofiler/library/src/dir.info,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** dir.info 2001/09/02 20:14:21 1.14 --- dir.info 2001/11/21 22:31:40 1.15 *************** *** 1,9 **** ! DIRS = profiler alloc allocator commun commun2 commun3 cpu delay gc main mon \ ! prof setup shared string FILES = do_link OBJ_FILES = profiler/*.o* alloc/*.o* allocator/*.o* commun/*.o* commun2/*.o* \ ! commun3/*.o* cpu/*.o* delay/*.o* gc/*.o* main/*.o* mon/*.o* \ ! prof/*.o* setup/*.o* shared/*.o* string/*.o* --- 1,9 ---- ! DIRS = profiler alloc allocator commun commun2 commun3 cpu delay gc list main \ ! mon prof setup shared string FILES = do_link OBJ_FILES = profiler/*.o* alloc/*.o* allocator/*.o* commun/*.o* commun2/*.o* \ ! commun3/*.o* cpu/*.o* delay/*.o* gc/*.o* list/*.o* main/*.o* \ ! mon/*.o* prof/*.o* setup/*.o* shared/*.o* string/*.o* |
From: Marek P. <ma...@us...> - 2001-11-21 22:32:11
|
Update of /cvsroot/javaprofiler/library/demo In directory usw-pr-cvs1:/tmp/cvs-serv12170/demo Modified Files: Makefile.rules dir.info Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux Index: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/demo/Makefile.rules,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Makefile.rules 2001/09/02 15:23:00 1.1 --- Makefile.rules 2001/11/21 22:31:39 1.2 *************** *** 14,15 **** --- 14,31 ---- 01.clean.2: $(MAKE) $(MFLAGS) 01 clean + + 02.dir: + cd 02 + $(MAKE) $(MFLAGS) + cd .. + + 02.dir.2: + $(MAKE) $(MFLAGS) 02 + + 02.clean: + cd 02 + $(MAKE) $(MFLAGS) clean + cd .. + + 02.clean.2: + $(MAKE) $(MFLAGS) 02 clean Index: dir.info =================================================================== RCS file: /cvsroot/javaprofiler/library/demo/dir.info,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** dir.info 2001/09/02 15:23:00 1.1 --- dir.info 2001/11/21 22:31:39 1.2 *************** *** 1 **** ! DIRS = 01 --- 1 ---- ! DIRS = 01 02 |
From: Marek P. <ma...@us...> - 2001-11-21 22:32:11
|
Update of /cvsroot/javaprofiler/library/config In directory usw-pr-cvs1:/tmp/cvs-serv12170/config Modified Files: README config_x86_nt40_bcc551.mk config_x86_nt40_vc98.mk config_x86_win9x_bcc551.mk config_x86_win9x_vc98.mk Added Files: config_sparc_sunos58_gcc302.mk config_x86_linux_gcc302.mk Removed Files: config_sparc_sunos58_gcc30.mk Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux --- NEW FILE: config_sparc_sunos58_gcc302.mk --- # DO NOT USE NOW !!! ################################################################ # configuration file # SunOS 5.8, SPARC, GNU C/C++ 3.0 (using GNU make 3.7x) # # author: Marek Przeczek PROF_LIBRARY_NAME = profiler/libprofiler.so PROF_JAVA_INTERF_PACKAGE = IProf.jar NATIVE_LIBRARY_NAME = libCommunShMem.so ################################################################ # PATHS # modify for your own system # do not use "\" as a last character in path definition COMPILER_PATH = /opt/gcc-3.0 JAVA_PATH = /opt/j2sdk1_4_0 DOXYGEN_PATH = /opt/doxygen-1.2.10 CCC = "$(COMPILER_PATH)/bin/g++" LD = "$(COMPILER_PATH)/bin/g++" JAVAC = "$(JAVA_PATH)/bin/javac" JAVAH = "$(JAVA_PATH)/bin/javah" JAR = "$(JAVA_PATH)/bin/jar" DOXYGEN = "$(DOXYGEN_PATH)/bin/doxygen" ################################################################ # SPECIAL SETTINGS # don't modify DOXYGENFLAGS = JAVACFLAGS = -classpath ../../src2/$(PROF_JAVA_INTERF_PACKAGE) ################################################################ # COMPILER/OS DEPENDENT OPTIONS # modify as needed DEFINES = -DSUNOS -fpic -D_REENTRANT INCLUDES = -I$(JAVA_PATH)/include -I$(JAVA_PATH)/include/solaris # debug or not ? # choose one of following two possibilities FLAGS = -O0 -D_DEBUG #FLAGS = -O3 -DNDEBUG -fno-rtti -fno-exceptions LDFLAGS = $(DEFINES) -shared -o $(PROF_LIBRARY_NAME) LDLIBS = -lsocket -lpthread -lthread -lnsl LDFLAGS2 = $(DEFINES) -shared -o $(NATIVE_LIBRARY_NAME) LDLIBS2 = -lsocket CPPFLAGS = -c $(FLAGS) $(DEFINES) $(INCLUDES) ################################################################ # MAKEFILE MFLAGS = -f Makefile -C include dir.info all: $(addsuffix .dir.2, $(DIRS)) $(addsuffix .o, $(FILES)) clean: $(addsuffix .clean.2, $(DIRS)) rm -Rf $(CLEAN_FILES) --- NEW FILE: config_x86_linux_gcc302.mk --- ################################################################ # configuration file # Linux, x86, GNU C/C++ 3.0.2 # # author: Marek Przeczek PROF_LIBRARY_NAME = profiler/libprofiler.so PROF_JAVA_INTERF_PACKAGE = IProf.jar NATIVE_LIBRARY_NAME = libCommunShMem.so ################################################################ # PATHS # modify for your own system # do not use "\" as a last character in path definition COMPILER_PATH = /opt/gcc-3.0.2 JAVA_PATH = /opt/j2sdk1.4.0 DOXYGEN_PATH = /opt/doxygen-1.2.11.1 CCC = "$(COMPILER_PATH)/bin/g++" LD = "$(COMPILER_PATH)/bin/g++" JAVAC = "$(JAVA_PATH)/bin/javac" JAVAH = "$(JAVA_PATH)/bin/javah" JAR = "$(JAVA_PATH)/bin/jar" DOXYGEN = "$(DOXYGEN_PATH)/bin/doxygen" ################################################################ # SPECIAL SETTINGS # don't modify DOXYGENFLAGS = JAVACFLAGS = -classpath ../../src2/$(PROF_JAVA_INTERF_PACKAGE) ################################################################ # COMPILER/OS DEPENDENT OPTIONS # modify as needed DEFINES = -DLINUX -DUSE_RAW_MONITORS -DUSE_ALLOCATOR -fpic INCLUDES = -I$(JAVA_PATH)/include -I$(JAVA_PATH)/include/linux # debug or not ? # choose one of following two possibilities FLAGS = -O0 -D_DEBUG #FLAGS = -O3 -DNDEBUG -fno-rtti -fno-exceptions LDFLAGS = $(DEFINES) -shared -o $(PROF_LIBRARY_NAME) LDLIBS = LDFLAGS2 = $(DEFINES) -shared -o $(NATIVE_LIBRARY_NAME) LDLIBS2 = CPPFLAGS = -c $(FLAGS) $(DEFINES) $(INCLUDES) ################################################################ # MAKEFILE MFLAGS = -f Makefile -C include dir.info all: $(addsuffix .dir.2, $(DIRS)) $(addsuffix .o, $(FILES)) clean: $(addsuffix .clean.2, $(DIRS)) rm -Rf $(CLEAN_FILES) Index: README =================================================================== RCS file: /cvsroot/javaprofiler/library/config/README,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** README 2001/09/25 18:57:55 1.9 --- README 2001/11/21 22:31:37 1.10 *************** *** 2,31 **** of the source files and rename it to "config.mk" ! Microsoft Windows NT4.0/2000, x86 ! * config_x86_nt40_vc98.mk ! Microsoft Visual C/C++ 6.0 ! * config_x86_nt40_bcc551.mk ! Borland C/C++ 5.5.1 ! Microsoft Windows 9x, x86 ! * config_x86_win9x_vc98.mk ! Microsoft Visual C/C++ 6.0 ! * config_x86_win9x_bcc551.mk ! Borland C/C++ 5.5.1 - - SunOS 7/8, SPARC/x86 - - * config_sparc_sunos58_gcc30.mk - - GNU C/C++ 3.0, GNU make 3.7x --- 2,33 ---- of the source files and rename it to "config.mk" + * Microsoft Windows NT4.0/2000, x86 + Microsoft Visual C/C++ 6.0 ! config_x86_nt40_vc98.mk ! * Microsoft Windows NT4.0/2000, x86 ! Borland C/C++ 5.5.1 ! config_x86_nt40_bcc551.mk ! * Microsoft Windows 9x, x86 ! Microsoft Visual C/C++ 6.0 ! config_x86_win9x_vc98.mk + * Microsoft Windows 9x, x86 + Borland C/C++ 5.5.1 ! config_x86_win9x_bcc551.mk ! * SunOS 7/8, SPARC/x86 ! GNU C/C++ 3.0.2, GNU make 3.7x ! config_sparc_sunos58_gcc302.mk ! * Linux, x86 ! GNU C/C++ 3.0.2, GNU make 3.7x ! config_x86_linux_gcc302.mk Index: config_x86_nt40_bcc551.mk =================================================================== RCS file: /cvsroot/javaprofiler/library/config/config_x86_nt40_bcc551.mk,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** config_x86_nt40_bcc551.mk 2001/09/18 22:19:28 1.9 --- config_x86_nt40_bcc551.mk 2001/11/21 22:31:38 1.10 *************** *** 1,2 **** --- 1,4 ---- + # DO NOT USE NOW !!! + ################################################################ # configuration file Index: config_x86_nt40_vc98.mk =================================================================== RCS file: /cvsroot/javaprofiler/library/config/config_x86_nt40_vc98.mk,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** config_x86_nt40_vc98.mk 2001/09/18 22:19:28 1.15 --- config_x86_nt40_vc98.mk 2001/11/21 22:31:38 1.16 *************** *** 1,2 **** --- 1,4 ---- + # DO NOT USE NOW !!! + ################################################################ # configuration file Index: config_x86_win9x_bcc551.mk =================================================================== RCS file: /cvsroot/javaprofiler/library/config/config_x86_win9x_bcc551.mk,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** config_x86_win9x_bcc551.mk 2001/09/18 22:19:28 1.9 --- config_x86_win9x_bcc551.mk 2001/11/21 22:31:38 1.10 *************** *** 1,2 **** --- 1,4 ---- + # DO NOT USE NOW !!! + ################################################################ # configuration file Index: config_x86_win9x_vc98.mk =================================================================== RCS file: /cvsroot/javaprofiler/library/config/config_x86_win9x_vc98.mk,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** config_x86_win9x_vc98.mk 2001/09/18 22:19:28 1.14 --- config_x86_win9x_vc98.mk 2001/11/21 22:31:38 1.15 *************** *** 1,2 **** --- 1,4 ---- + # DO NOT USE NOW !!! + ################################################################ # configuration file --- config_sparc_sunos58_gcc30.mk DELETED --- |
From: Marek P. <ma...@us...> - 2001-11-21 22:32:10
|
Update of /cvsroot/javaprofiler/library In directory usw-pr-cvs1:/tmp/cvs-serv12170 Modified Files: README config.mk Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux Index: README =================================================================== RCS file: /cvsroot/javaprofiler/library/README,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -r1.28 -r1.29 *** README 2001/09/27 10:07:28 1.28 --- README 2001/11/21 22:31:37 1.29 *************** *** 17,20 **** --- 17,22 ---- 4. DOWNLOAD + 4.1 Linux distributions + 5. COMPILATION *************** *** 46,49 **** --- 48,52 ---- * Microsoft Windows 9x * SunOS 5.8 + * Linux 1.2 Programming language *************** *** 51,84 **** The library sources are written in plain C++. On Win32 platform, Microsoft Visual C/C++ or Borland C/C++ 5.5.1 can be used. ! On Unix platforms (in this time, Solaris only) GNU C/C++ 3.0 _MUST_ ! be used. Genuine Sun Workshop Compilers had problems with creating ! the dynamic library under SunOS. So had the elder versions ! of GNU C/C++. * Microsoft Visual C/C++ 6.0 * Borland C/C++ 5.5.1 ! * GNU C/C++ 3.0 Client part of communication interface for accessing data of profiled JVM (gained and stored inside the structures of the library) is written in Java. Because of stability and standard Sun's JVM is used. ! * JDK 1.4.0 beta2 (JDK 1.3.1 and later) 1.3 Additional tools ! These tools are not necessary for building of profiler dynamic library. Project documentation is written directly to the sources. So all classes, methods and class members are well-documented. For creating ! of project documentation in HTML (or PDF) format, DOXYGEN (for C++ ! and/or Java sources) is used. GRAPHVIZ can be used to generate ! graphs for HTML doc (optional, default is off). ! * Doxygen 1.2.10 ! * Graphviz 1.7.3 [optional] Data flows, schemes and relations between structures are described ! using Microsoft Visio 2000. These schemes are exported to JPEG format for those who do not have this software. --- 54,91 ---- The library sources are written in plain C++. On Win32 platform, Microsoft Visual C/C++ or Borland C/C++ 5.5.1 can be used. ! On Unix platforms (in this time, Solaris and Linux only) GNU C/C++ 3.0.2 ! or later _MUST_ be used. Genuine Sun Workshop Compilers had problems ! with creating the dynamic library under SunOS. So had the elder versions ! of GNU C/C++. There were some problems with generated binary code ! on Linux platform, too. Please be sure you use GCC 3.0.2 or later. * Microsoft Visual C/C++ 6.0 * Borland C/C++ 5.5.1 ! * GNU C/C++ 3.0.2 Client part of communication interface for accessing data of profiled JVM (gained and stored inside the structures of the library) is written in Java. Because of stability and standard Sun's JVM is used. + + * JDK 1.4.0 beta3 ! Nowadays, client's code is in separate CVS module called "jpiimpl". ! You do not need this code to compile the dynamic library, but you ! need it for shared memory communication support in Java client's code. ! Read a README file in src2/ subdirectory before compiling. 1.3 Additional tools ! These tools are not necessary for building profiler dynamic library. Project documentation is written directly to the sources. So all classes, methods and class members are well-documented. For creating ! project documentation in HTML (or PDF) format, DOXYGEN (for C++ ! and/or Java sources) is used. ! * Doxygen 1.2.11.1 Data flows, schemes and relations between structures are described ! using Microsoft Visio 2000. These schemes are exported to PDF format for those who do not have this software. *************** *** 94,129 **** 2. DIRECTORY STRUCTURE ! config/ configuration files for various platforms/compilers ! demo/ demos, examples of use of Java interface IProf ! doc/ documentation (most of it is generated during compilation) ! doc/interface/ project documentation of sources ! of Java interface to the library ! doc/library/ project documentation of sources ! of the profiler dynamic library ! doc/native/ project documentation of sources ! of native Java classes of the interface ! doc/visio/ data flows, schemes and relations between ! structures inside of profiler dynamic library ! doc/visio/pdf/ Visio files exported to PDF format ! src/ C++ sources of profiler dynamic library ! src2/ Java sources of the low-level interface to this library 3. UNSUPPORTED PLATFORMS Sun's JDK for Linux is under high development and JVMPI part is a bit unstable, some features are not implemented or have strange behaviour. The sources can be compiled with no problems under Linux but we do not ! guarantee the functionality. Sources should compile on Sun's SunOS 5.7, too. You can use the same --- 101,143 ---- 2. DIRECTORY STRUCTURE ! config/ configuration files for various platforms/compilers ! demo/ demos, examples of use of Java interface IProf ! doc/ documentation (most of it is generated during compilation) ! doc/interface/ project documentation of sources ! of Java interface for the library ! doc/library/ project documentation of sources ! of the profiler dynamic library ! doc/native/ project documentation of sources ! of native Java classes of the interface ! doc/visio/ data flows, schemes and relations between ! structures inside of profiler dynamic library ! doc/visio/pdf/ Visio files exported to PDF format ! src/ C++ sources of profiler dynamic library ! src2/ Java sources of the low-level interface to this library ! (please see README file in src2/ subdirectory for more info) + templates/ Copyright templates for source files + 3. UNSUPPORTED PLATFORMS + This library was only tested on platforms where JDK with JVMPI interface + exists. Other platforms are generally unsupported, the library can run + on them with no guarantee. + Sun's JDK for Linux is under high development and JVMPI part is a bit unstable, some features are not implemented or have strange behaviour. The sources can be compiled with no problems under Linux but we do not ! guarantee the functionality. Tests seemed okay. Sources should compile on Sun's SunOS 5.7, too. You can use the same *************** *** 139,155 **** * Microsoft Windows 9x/NT4/2000 (www.microsoft.com) * SunOS 5.8 (www.sun.com) [for free] * Microsoft Visual C/C++ 6.0 (www.microsoft.com) * Borland C/C++ 5.5.1 (www.borland.com) [for free] ! * GNU C/C++ 3.0 (gcc.gnu.org) [for free] ! * JDK 1.4.0 beta2 (java.sun.com) [for free] * Microsoft Visio 2000 (www.microsoft.com) ! * Doxygen 1.2.10 (www.doxygen.org) [for free] ! * Graphviz 1.7.3 (www.graphviz.org) [for free] * GNU make 3.7x (www.gnu.org) [for free] 5. COMPILATION --- 153,180 ---- * Microsoft Windows 9x/NT4/2000 (www.microsoft.com) * SunOS 5.8 (www.sun.com) [for free] + * Linux (www.linux.org) [for free] * Microsoft Visual C/C++ 6.0 (www.microsoft.com) * Borland C/C++ 5.5.1 (www.borland.com) [for free] ! * GNU C/C++ 3.0.2 (gcc.gnu.org) [for free] ! * JDK 1.4.0 beta3 (java.sun.com) [for free] * Microsoft Visio 2000 (www.microsoft.com) ! * Doxygen 1.2.11.1 (www.doxygen.org) [for free] * GNU make 3.7x (www.gnu.org) [for free] + 4.1 Linux distributions + + There are a lot of linux distributions, you can use one + of the following links or choose another distribution. + + * RedHat (www.redhat.com) + * Mandrake (www.mandrake.com) + * Debian (www.debian.org) + + These are the most known. + 5. COMPILATION *************** *** 182,186 **** doc\ project documentation in HTML format - 5.2 Unix platforms --- 207,210 ---- *************** *** 201,205 **** doc/ - 5.3 Make rules --- 225,228 ---- *************** *** 211,221 **** where $(MAKE) is appropriate "make" program for given platform/compiler - - - 5.4 Appendices - - Graphviz executables must be in your PATH to generate HTML documentation - correctly. See PATH variable for Win32/UNIX platforms. Graphviz is not - used by default. --- 234,237 ---- Index: config.mk =================================================================== RCS file: /cvsroot/javaprofiler/library/config.mk,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -r1.25 -r1.26 *** config.mk 2001/09/27 10:07:28 1.25 --- config.mk 2001/11/21 22:31:37 1.26 *************** *** 1,5 **** ################################################################ # configuration file ! # SunOS 5.8, SPARC, GNU C/C++ 3.0 (using GNU make 3.7x) # # author: Marek Przeczek --- 1,5 ---- ################################################################ # configuration file ! # Linux, x86, GNU C/C++ 3.0.2 # # author: Marek Przeczek *************** *** 15,21 **** # do not use "\" as a last character in path definition ! COMPILER_PATH = /home/mprz7483/BIG/gcc-3.0 ! JAVA_PATH = /home/mprz7483/BIG/j2sdk1_3_1 ! DOXYGEN_PATH = /opt/doxygen-1.2.10 CCC = "$(COMPILER_PATH)/bin/g++" --- 15,22 ---- # do not use "\" as a last character in path definition ! COMPILER_PATH = /home2/mm/gcc-3.0.2 ! #COMPILER_PATH = /usr ! JAVA_PATH = /home2/mm/j2sdk1.4.0 ! DOXYGEN_PATH = /home2/mm CCC = "$(COMPILER_PATH)/bin/g++" *************** *** 37,55 **** # modify as needed ! DEFINES = -DSUNOS -fpic -D_REENTRANT ! INCLUDES = -I$(JAVA_PATH)/include -I$(JAVA_PATH)/include/solaris # debug or not ? # choose one of following two possibilities ! #FLAGS = -O0 -D_DEBUG ! FLAGS = -O3 -DNDEBUG -fno-rtti -fno-exceptions LDFLAGS = $(DEFINES) -shared -o $(PROF_LIBRARY_NAME) ! LDLIBS = -lsocket -lpthread -lthread -lnsl LDFLAGS2 = $(DEFINES) -shared -o $(NATIVE_LIBRARY_NAME) ! LDLIBS2 = -lsocket CPPFLAGS = -c $(FLAGS) $(DEFINES) $(INCLUDES) --- 38,58 ---- # modify as needed ! DEFINES = -DLINUX -DUSE_RAW_MONITORS -DUSE_ALLOCATOR -fpic ! #DEFINES = -DLINUX -fpic ! INCLUDES = -I$(JAVA_PATH)/include -I$(JAVA_PATH)/include/linux # debug or not ? # choose one of following two possibilities ! FLAGS = -O0 -D_DEBUG ! #FLAGS = -O0 -D_DEBUG -DPROF_ERROR_ON ! #FLAGS = -O3 -DNDEBUG -fno-rtti -fno-exceptions LDFLAGS = $(DEFINES) -shared -o $(PROF_LIBRARY_NAME) ! LDLIBS = LDFLAGS2 = $(DEFINES) -shared -o $(NATIVE_LIBRARY_NAME) ! LDLIBS2 = CPPFLAGS = -c $(FLAGS) $(DEFINES) $(INCLUDES) |
From: Marek P. <ma...@us...> - 2001-11-21 22:31:55
|
Update of /cvsroot/javaprofiler/library/demo/02 In directory usw-pr-cvs1:/tmp/cvs-serv12170/demo/02 Added Files: Makefile Makefile.mak Makefile.rules README Test.java dir.info Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux --- NEW FILE: Makefile --- include ../../config.mk include Makefile.rules --- NEW FILE: Makefile.mak --- !include ../../config.mk !include Makefile.rules --- NEW FILE: Makefile.rules --- Test.o \ Test.obj: $(JAVAC) $(JAVACFLAGS) Test.java --- NEW FILE: README --- Same demo program as in 01/ subdirectory. The difference is in how information about classes and methods are sent. In previous example (01), information about specific object (eg. class name, method name etc. not statistic data) was requested by special IProf::getInfo() method, which is a bit slow if you do a lot of requests. This example uses advantage of IProf::getAll() method (IProf::getChanged() does the same) to send information about specific object together with its statistic data which points to faster communication. --- NEW FILE: Test.java --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ import java.lang.*; import java.util.*; import net.sourceforge.javaprofiler.jpiimpl.commun.*; public class Test { // communication interface private IProf iprof = null; // number of all methods together private int numMethods = 0; private void askForMethods( int objId) throws Exception { // ask for all methods of given class LinkedList listMethods = iprof.getAll( objId, IProf.CLASS_METHODS, true, 0); ListIterator iterator = listMethods.listIterator(); while( iterator.hasNext()) { // take the first one from the list IProf.sID sid = (IProf.sID)iterator.next(); // write method name IProf.sMethodInfo mi = (IProf.sMethodInfo)sid.info; System.out.println( " METHOD: " + mi.methodName); } numMethods += listMethods.size(); System.out.println(); } private void askForClasses() throws Exception { // ask for all classes LinkedList listClasses = iprof.getAll( 0, IProf.CLASSES, true, 0); ListIterator iterator = listClasses.listIterator(); while( iterator.hasNext()) { // take the first one from the list IProf.sID sid = (IProf.sID)iterator.next(); // write class name IProf.sClassInfo ci = (IProf.sClassInfo)sid.info; System.out.println( "CLASS: " + ci.className); // ask for all methods of choosen class askForMethods( sid.objId); } System.out.println( "NUMBER OF CLASSES: " + listClasses.size()); // following two numbers should be the same // if not, something is bad LinkedList list = iprof.getAll( 0, IProf.METHODS); System.out.println( "NUMBER OF METHODS (1): " + numMethods); System.out.println( "NUMBER OF METHODS (2): " + list.size()); } public void runTest() { // initialize and start communication // sockets are used by default iprof = new IProf(); iprof.run(); try { // til profiled program is going, do nothing while( !iprof.isShutdowned()) Thread.sleep( 1000); // profiled program has finished, so ask for all classes askForClasses(); // now, i don't want anything else, // so I shutdown profiled JVM definitely iprof.shutdown(); } catch( Exception e) { System.err.println( "an error occurred, exception:"); System.err.println( e.getClass().getName()); } // communication must be stopped even if an error occurred ! iprof.stop(); iprof = null; } public static void main( String[] arg) { // let's run the test (new Test()).runTest(); } }; --- NEW FILE: dir.info --- FILES = Test CLEAN_FILES = *.class |
From: Marek P. <ma...@us...> - 2001-11-21 22:31:55
|
Update of /cvsroot/javaprofiler/library/doc/native In directory usw-pr-cvs1:/tmp/cvs-serv12170/doc/native Modified Files: doc_html.conf doc_latex.conf Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux Index: doc_html.conf =================================================================== RCS file: /cvsroot/javaprofiler/library/doc/native/doc_html.conf,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** doc_html.conf 2001/09/27 10:07:29 1.2 --- doc_html.conf 2001/11/21 22:31:52 1.3 *************** *** 666,670 **** # omitted =1 is assumed. ! PREDEFINED = # If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then --- 666,670 ---- # omitted =1 is assumed. ! PREDEFINED = USE_RAW_MONITORS USE_ALLOCATOR # If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then Index: doc_latex.conf =================================================================== RCS file: /cvsroot/javaprofiler/library/doc/native/doc_latex.conf,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** doc_latex.conf 2001/09/25 18:57:56 1.1 --- doc_latex.conf 2001/11/21 22:31:52 1.2 *************** *** 666,670 **** # omitted =1 is assumed. ! PREDEFINED = # If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then --- 666,670 ---- # omitted =1 is assumed. ! PREDEFINED = USE_RAW_MONITORS USE_ALLOCATOR # If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then |
From: Marek P. <ma...@us...> - 2001-11-21 22:31:55
|
Update of /cvsroot/javaprofiler/library/demo/01 In directory usw-pr-cvs1:/tmp/cvs-serv12170/demo/01 Modified Files: README Test.java dir.info Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux Index: README =================================================================== RCS file: /cvsroot/javaprofiler/library/demo/01/README,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** README 2001/09/02 15:23:00 1.1 --- README 2001/11/21 22:31:52 1.2 *************** *** 1,3 **** ! Program in this example waits until profiled program ! finishes, then it requests for all Java classes and ! methods loaded into profiled JVM. --- 1,2 ---- ! Program in this example waits until profiled program finishes, then it requests ! for all Java classes and methods loaded into profiled JVM. Index: Test.java =================================================================== RCS file: /cvsroot/javaprofiler/library/demo/01/Test.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** Test.java 2001/09/19 18:57:27 1.3 --- Test.java 2001/11/21 22:31:52 1.4 *************** *** 36,39 **** --- 36,41 ---- import java.util.*; + import net.sourceforge.javaprofiler.jpiimpl.commun.*; + public class Test { Index: dir.info =================================================================== RCS file: /cvsroot/javaprofiler/library/demo/01/dir.info,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** dir.info 2001/09/02 15:23:00 1.1 --- dir.info 2001/11/21 22:31:52 1.2 *************** *** 1,3 **** FILES = Test - CLEAN_FILES = *.class --- 1,2 ---- |
From: Marek P. <ma...@us...> - 2001-11-21 22:31:54
|
Update of /cvsroot/javaprofiler/library/doc/library In directory usw-pr-cvs1:/tmp/cvs-serv12170/doc/library Modified Files: Makefile.rules doc_html.conf doc_latex.conf Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux Index: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/doc/library/Makefile.rules,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Makefile.rules 2001/09/25 18:57:55 1.2 --- Makefile.rules 2001/11/21 22:31:52 1.3 *************** *** 23,25 **** latex.clean.2: ! rm -Rf html --- 23,25 ---- latex.clean.2: ! rm -Rf latex Index: doc_html.conf =================================================================== RCS file: /cvsroot/javaprofiler/library/doc/library/doc_html.conf,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** doc_html.conf 2001/09/27 10:07:29 1.2 --- doc_html.conf 2001/11/21 22:31:52 1.3 *************** *** 666,670 **** # omitted =1 is assumed. ! PREDEFINED = # If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then --- 666,670 ---- # omitted =1 is assumed. ! PREDEFINED = USE_RAW_MONITORS USE_ALLOCATOR # If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then Index: doc_latex.conf =================================================================== RCS file: /cvsroot/javaprofiler/library/doc/library/doc_latex.conf,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** doc_latex.conf 2001/09/25 18:57:56 1.1 --- doc_latex.conf 2001/11/21 22:31:52 1.2 *************** *** 666,670 **** # omitted =1 is assumed. ! PREDEFINED = # If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then --- 666,670 ---- # omitted =1 is assumed. ! PREDEFINED = USE_RAW_MONITORS USE_ALLOCATOR # If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then |