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-08-27 23:08:44
|
Update of /cvsroot/javaprofiler/library/src/commun In directory usw-pr-cvs1:/tmp/cvs-serv27021/src/commun Modified Files: iprof.cpp iprof.h Log Message: extension of communication interface for possibility to transfer information about Java monitors Index: iprof.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun/iprof.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** iprof.cpp 2001/08/23 23:57:31 1.6 --- iprof.cpp 2001/08/27 23:08:41 1.7 *************** *** 38,42 **** conEstabl = 1; - Delay d; Buffer buf; while( 1) { --- 38,41 ---- *************** *** 52,56 **** if( _commun->hasFailed()) return (conEstabl = 0); ! d.delay( 10); } --- 51,55 ---- if( _commun->hasFailed()) return (conEstabl = 0); ! Delay::delay( 10); } *************** *** 142,147 **** b += data.active; ! if( type == ALLOC_DATA) data.alloc.dataToBin( b); ! else data.cpu.dataToBin( b); // CPU_DATA } --- 141,147 ---- b += data.active; ! if( type == ALLOC_DATA) data.alloc.dataToBin( b); ! else if( type == CPU_DATA) data.cpu .dataToBin( b); ! else data.mon .dataToBin( b); // MON_DATA } *************** *** 154,157 **** --- 154,158 ---- b += s->objId; b += s->active; + b += s->hasAllocData; *************** *** 161,164 **** --- 162,169 ---- if( s->hasCpuData) s->cpu.dataToBin( b); + + b += s->hasMonData; + + if( s->hasMonData) s->mon.dataToBin( b); return 0; Index: iprof.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun/iprof.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** iprof.h 2001/08/23 23:57:31 1.9 --- iprof.h 2001/08/27 23:08:41 1.10 *************** *** 160,164 **** /// cpu profiling statistics ! CPU_DATA = 1 }; --- 160,167 ---- /// cpu profiling statistics ! CPU_DATA = 1, ! ! /// monitor profiling statistics ! MON_DATA = 2 }; *************** *** 174,177 **** --- 177,183 ---- /// cpu profiling data (if exist) CpuStatData cpu; + + /// monitor profiling data (if exist) + MonStatData mon; }; *************** *** 211,214 **** --- 217,226 ---- CpuStatData cpu; + /// monitor profiling data are included or not + jint hasMonData; + + /// monitor profiling data (if exist) + MonStatData mon; + private: *************** *** 332,336 **** /// method traces of concrete method called in given thread ! CPU_THREAD_METHOD_TRACES = 32 }; --- 344,366 ---- /// method traces of concrete method called in given thread ! CPU_THREAD_METHOD_TRACES = 32, ! ! /// method traces of given method (monitor profiling) ! MON_METHOD_TRACES = 33, ! ! /// threads where given method was called ! MON_METHOD_THREADS = 34, ! ! /// threads for concrete method trace ! MON_METHOD_TRACE_THREADS = 35, ! ! /// methods called in given thread ! MON_THREAD_METHODS = 36, ! ! /// method traces of concrete method called in given thread ! MON_THREAD_METHOD_TRACES = 37, ! ! /// method traces (monitor profiling) ! MON_TRACES = 38 }; |
From: Marek P. <ma...@us...> - 2001-08-27 23:08:44
|
Update of /cvsroot/javaprofiler/library/src/cpu In directory usw-pr-cvs1:/tmp/cvs-serv27021/src/cpu Modified Files: cpuStatData.cpp sampling.cpp sampling.h Log Message: extension of communication interface for possibility to transfer information about Java monitors Index: cpuStatData.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/cpuStatData.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** cpuStatData.cpp 2001/08/24 17:54:04 1.4 --- cpuStatData.cpp 2001/08/27 23:08:41 1.5 *************** *** 14,19 **** b += pureTime; - setDataChanged(); - return b; } --- 14,17 ---- Index: sampling.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/sampling.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** sampling.cpp 2001/08/24 17:54:04 1.6 --- sampling.cpp 2001/08/27 23:08:41 1.7 *************** *** 41,45 **** #ifdef _DEBUG ! start = _prof->getMilliticks(); #endif --- 41,45 ---- #ifdef _DEBUG ! start = Delay::getMilliticks(); #endif *************** *** 72,78 **** } ! startTime = _prof->getMilliticks(); doOneSample(); ! endTime = _prof->getMilliticks(); #ifdef _DEBUG --- 72,78 ---- } ! startTime = Delay::getMilliticks(); doOneSample(); ! endTime = Delay::getMilliticks(); #ifdef _DEBUG *************** *** 96,100 **** if (_cmd != CMD_TURN_ON) continue; ! waitDelay.delay(waitTime); } } --- 96,100 ---- if (_cmd != CMD_TURN_ON) continue; ! Delay::delay(waitTime); } } Index: sampling.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/sampling.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** sampling.h 2001/08/24 17:54:04 1.6 --- sampling.h 2001/08/27 23:08:41 1.7 *************** *** 36,42 **** #endif - /// wait object - Delay waitDelay; - private: --- 36,39 ---- |
From: Marek P. <ma...@us...> - 2001-08-27 23:08:44
|
Update of /cvsroot/javaprofiler/library/src/mon In directory usw-pr-cvs1:/tmp/cvs-serv27021/src/mon Modified Files: monStatData.cpp Log Message: extension of communication interface for possibility to transfer information about Java monitors Index: monStatData.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/mon/monStatData.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** monStatData.cpp 2001/08/24 17:54:04 1.1 --- monStatData.cpp 2001/08/27 23:08:41 1.2 *************** *** 14,19 **** b += time; - setDataChanged(); - return b; } --- 14,17 ---- |
From: Marek P. <ma...@us...> - 2001-08-27 23:08:44
|
Update of /cvsroot/javaprofiler/library/src/commun2 In directory usw-pr-cvs1:/tmp/cvs-serv27021/src/commun2 Modified Files: prof_interface.cpp Log Message: extension of communication interface for possibility to transfer information about Java monitors Index: prof_interface.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun2/prof_interface.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** prof_interface.cpp 2001/08/23 23:57:31 1.9 --- prof_interface.cpp 2001/08/27 23:08:41 1.10 *************** *** 136,139 **** --- 136,140 ---- if( type == ALLOC_DATA && (cI & IdObject::ALLOC)); else if( type == CPU_DATA && (cI & IdObject::CPU)); + else if( type == MON_DATA && (cI & IdObject::MON)); else return RC_BAD_DATA_TYPE; *************** *** 194,201 **** AllocStatData::copy( data.alloc, *static_cast<Method*>( p)); } ! else { CpuStatData::copy( data.cpu, *static_cast<Method*>( p)); } } else if( p->isOfType( IdObject::THREAD)) { --- 195,206 ---- AllocStatData::copy( data.alloc, *static_cast<Method*>( p)); } ! else if( type == CPU_DATA) { CpuStatData::copy( data.cpu, *static_cast<Method*>( p)); } + else { + + MonStatData::copy( data.mon, *static_cast<Method*>( p)); + } } else if( p->isOfType( IdObject::THREAD)) { *************** *** 203,206 **** --- 208,223 ---- AllocStatData::copy( data.alloc, *static_cast<Thread*>( p)); } + else if( p->isOfType( IdObject::MON_THREAD_METHOD)) { + + MonStatData::copy( data.mon, *static_cast<MonThreadMethod*>( p)); + } + else if( p->isOfType( IdObject::MON_THREAD_TRACE)) { + + MonStatData::copy( data.mon, *static_cast<MonThreadTrace*>( p)); + } + else if( p->isOfType( IdObject::MON_TRACE)) { + + MonStatData::copy( data.mon, *static_cast<MonTrace*>( p)); + } else if( p->isOfType( IdObject::ALLOC_ARENA)) {} else if( p->isOfType( IdObject::GARBAGE_C)) {} *************** *** 277,280 **** --- 294,315 ---- } + case MON_TRACES: { + + Class* c = classes.first(); + while( c) { + + Method* m = c->methods.first(); + while( m) { + + getDataFromList( m->monTraces, seq, all); + m = c->methods.next( m); + } + + c = classes.next( c); + } + + break; + } + case OBJECT_TYPES: { *************** *** 333,337 **** case ALLOC_METHOD_TRACES: case CPU_METHOD_THREADS: ! case CPU_METHOD_TRACES: { if( !p->isOfType( IdObject::METHOD)) return RC_BAD_COMMAND; --- 368,374 ---- case ALLOC_METHOD_TRACES: case CPU_METHOD_THREADS: ! case CPU_METHOD_TRACES: ! case MON_METHOD_THREADS: ! case MON_METHOD_TRACES: { if( !p->isOfType( IdObject::METHOD)) return RC_BAD_COMMAND; *************** *** 342,346 **** else if( what == ALLOC_METHOD_TRACES) getDataFromList( m->allocTraces, seq, all); else if( what == CPU_METHOD_THREADS) getDataFromList( m->cpuThreadMethods, seq, all); ! else getDataFromList( m->cpuTraces, seq, all); break; --- 379,385 ---- else if( what == ALLOC_METHOD_TRACES) getDataFromList( m->allocTraces, seq, all); else if( what == CPU_METHOD_THREADS) getDataFromList( m->cpuThreadMethods, seq, all); ! else if( what == CPU_METHOD_TRACES) getDataFromList( m->cpuTraces, seq, all); ! else if( what == MON_METHOD_THREADS) getDataFromList( m->monThreadMethods, seq, all); ! else getDataFromList( m->monTraces, seq, all); break; *************** *** 395,399 **** case ALLOC_THREAD_OBJECTS: case ALLOC_THREAD_METHODS: ! case CPU_THREAD_METHODS: { if( !p->isOfType( IdObject::THREAD)) return RC_BAD_COMMAND; --- 434,439 ---- case ALLOC_THREAD_OBJECTS: case ALLOC_THREAD_METHODS: ! case CPU_THREAD_METHODS: ! case MON_THREAD_METHODS: { if( !p->isOfType( IdObject::THREAD)) return RC_BAD_COMMAND; *************** *** 403,407 **** if( what == ALLOC_THREAD_OBJECTS) getDataFromList( th->allocThreadObjects, seq, all); else if( what == ALLOC_THREAD_METHODS) getDataFromList( th->allocThreadMethods, seq, all); ! else getDataFromList( th->cpuThreadMethods, seq, all); break; --- 443,448 ---- if( what == ALLOC_THREAD_OBJECTS) getDataFromList( th->allocThreadObjects, seq, all); else if( what == ALLOC_THREAD_METHODS) getDataFromList( th->allocThreadMethods, seq, all); ! else if( what == CPU_THREAD_METHODS) getDataFromList( th->cpuThreadMethods, seq, all); ! else getDataFromList( th->monThreadMethods, seq, all); break; *************** *** 471,474 **** --- 512,535 ---- } + case MON_METHOD_TRACE_THREADS: { + + if( !p->isOfType( IdObject::MON_TRACE)) return RC_BAD_COMMAND; + + MonTrace* tr = static_cast<MonTrace*>( p); + getDataFromList( tr->threadTraces, seq, all); + + break; + } + + case MON_THREAD_METHOD_TRACES: { + + if( !p->isOfType( IdObject::MON_THREAD_METHOD)) return RC_BAD_COMMAND; + + MonThreadMethod* tm = static_cast<MonThreadMethod*>( p); + getDataFromList( tm->threadTraces, seq, all); + + break; + } + case GROUP_THREADS: { *************** *** 516,522 **** --- 577,585 ---- dest->hasAllocData = src->getClassIdent() & IdObject::ALLOC; dest->hasCpuData = src->getClassIdent() & IdObject::CPU; + dest->hasMonData = src->getClassIdent() & IdObject::MON; AllocStatData* alloc = NULL; CpuStatData* cpu = NULL; + MonStatData* mon = NULL; if( src->isOfType( IdObject::ALLOC_OBJECT)) { *************** *** 572,575 **** --- 635,639 ---- alloc = static_cast<Method*>( src); cpu = static_cast<Method*>( src); + mon = static_cast<Method*>( src); } else if( src->isOfType( IdObject::THREAD)) { *************** *** 577,580 **** --- 641,656 ---- alloc = static_cast<Thread*>( src); } + else if( src->isOfType( IdObject::MON_THREAD_METHOD)) { + + mon = static_cast<MonThreadMethod*>( src); + } + else if( src->isOfType( IdObject::MON_THREAD_TRACE)) { + + mon = static_cast<MonThreadTrace*>( src); + } + else if( src->isOfType( IdObject::MON_TRACE)) { + + mon = static_cast<MonTrace*>( src); + } else if( src->isOfType( IdObject::ALLOC_ARENA)) {} else if( src->isOfType( IdObject::GARBAGE_C)) {} *************** *** 585,588 **** --- 661,665 ---- if( dest->hasAllocData && alloc) AllocStatData::copy( dest->alloc, *alloc); if( dest->hasCpuData && cpu) CpuStatData::copy( dest->cpu, *cpu); + if( dest->hasMonData && mon) MonStatData::copy( dest->mon, *mon); return dest; |
From: Marek P. <ma...@us...> - 2001-08-27 20:41:52
|
Update of /cvsroot/javaprofiler/library In directory usw-pr-cvs1:/tmp/cvs-serv12581 Modified Files: README Log Message: documentation changed Index: README =================================================================== RCS file: /cvsroot/javaprofiler/library/README,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** README 2001/08/25 10:14:19 1.19 --- README 2001/08/27 20:41:47 1.20 *************** *** 265,269 **** Argument Value Description ! -------------------------------------------------------------------- alloc {on|off} turns memory profiling on/off --- 265,269 ---- Argument Value Description ! ----------------------------------------------------------------------- alloc {on|off} turns memory profiling on/off *************** *** 309,312 **** --- 309,331 ---- cpu_thread {on|off} cpu profiling data + distinguished to Java threads + default: on + + mon {on|off} turn monitor profiling on/off + default: on + + mon_level {method|trace} monitor profiling + granularity level + default: trace + + method ... low (fast) + trace ... high (slow) + + mon_trace_depth [positive number] maximum nuber of frames + in a trace; + used when mon_level=trace + default: 2 + + mon_thread {on|off} monitor profiling data distinguished to Java threads default: on |
From: Marek P. <ma...@us...> - 2001-08-26 00:11:36
|
Update of /cvsroot/javaprofiler/library/src/delay In directory usw-pr-cvs1:/tmp/cvs-serv21710/src/delay Modified Files: delay.cpp delay.h Log Message: no message Index: delay.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/delay/delay.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** delay.cpp 2001/08/23 23:57:31 1.1 --- delay.cpp 2001/08/26 00:11:32 1.2 *************** *** 1,53 **** #include "../main/includes.h" - Delay::Delay() { - - #ifdef WIN32 - _wait = CreateEvent( NULL, TRUE, FALSE, NULL); - #else - pthread_cond_init( &_waitCond, NULL); - pthread_mutex_init( &_waitMutex, NULL); - - pthread_mutex_lock( &_waitMutex); - #endif - } - - Delay::~Delay() { - - #ifdef WIN32 - CloseHandle( _wait); - #else - pthread_mutex_unlock( &_waitMutex); - - pthread_cond_destroy( &_waitCond); - pthread_mutex_destroy( &_waitMutex); - #endif - } - void Delay::delay( long ms) { #ifdef WIN32 ! WaitForSingleObject( _wait, ms); #else ! struct timespec ts; ! struct timeval tv; ! ! long sec; ! long microSec; ! ! gettimeofday( &tv, NULL); ! ! sec = tv.tv_sec; ! ! sec += ms/1000; ! microSec = (ms%1000)*1000+tv.tv_usec; ! ! sec += microSec/1000000; ! microSec = microSec%1000000; ! ts.tv_sec = sec; ! ts.tv_nsec = microSec*1000; ! pthread_cond_timedwait( &_waitCond, &_waitMutex, &ts); #endif } --- 1,15 ---- #include "../main/includes.h" void Delay::delay( long ms) { #ifdef WIN32 ! Sleep( ms); #else ! timeval tv; ! tv.tv_sec = ms/1000; ! tv.tv_usec = (ms%1000)*1000; ! select( 0, NULL, NULL, NULL, &tv); #endif } Index: delay.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/delay/delay.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** delay.h 2001/08/23 23:57:31 1.1 --- delay.h 2001/08/26 00:11:32 1.2 *************** *** 10,32 **** class Delay { - #ifdef WIN32 - /// handle to event used to wait on in delay() method - HANDLE _wait; - #else - /// condition variable used to wait on in delay() method - pthread_cond_t _waitCond; - - /// associated mutex - pthread_mutex_t _waitMutex; - #endif - public: - /// Default constructor. - Delay(); - - /// Destructor. - ~Delay(); - /** Sleep. This method delays calling thread ** for 'ms' milliseconds. --- 10,15 ---- *************** *** 34,38 **** ** @param ms number of milliseconds */ ! void delay( long ms); }; --- 17,21 ---- ** @param ms number of milliseconds */ ! static void delay( long ms); }; |
From: Marek P. <ma...@us...> - 2001-08-26 00:11:36
|
Update of /cvsroot/javaprofiler/library In directory usw-pr-cvs1:/tmp/cvs-serv21710 Modified Files: config.mk Log Message: no message Index: config.mk =================================================================== RCS file: /cvsroot/javaprofiler/library/config.mk,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** config.mk 2001/08/25 23:27:43 1.19 --- config.mk 2001/08/26 00:11:32 1.20 *************** *** 1,12 **** ################################################################ # 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 ################################################################ --- 1,12 ---- ################################################################ # configuration file ! # Microsoft Windows NT 4.0/2000, x86, Borland C/C++ 5.5.1 # # author: Marek Przeczek ! PROF_LIBRARY_NAME = profiler.dll PROF_JAVA_INTERF_PACKAGE = IProf.jar ! NATIVE_LIBRARY_NAME = CommunShMem.dll ################################################################ *************** *** 15,29 **** # 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 ! DOCPP_PATH = /home/mprz7483/BIG/doc++-3.4.7 ! ! 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" ! JDOC = "$(JAVA_PATH)/bin/javadoc" ! DOCPP = "$(DOCPP_PATH)/docxx" ################################################################ --- 15,29 ---- # do not use "\" as a last character in path definition ! COMPILER_PATH = C:\Borland\BCC55 ! JAVA_PATH = C:\jdk1.3.1 ! DOCPP_PATH = C:\doc++-3.4.7 ! ! CCC = "$(COMPILER_PATH)\Bin\bcc32" ! LD = "$(COMPILER_PATH)\Bin\bcc32" ! JAVAC = "$(JAVA_PATH)\bin\javac" ! JAVAH = "$(JAVA_PATH)\bin\javah" ! JAR = "$(JAVA_PATH)\bin\jar" ! JDOC = "$(JAVA_PATH)\bin\javadoc" ! DOCPP = "$(DOCPP_PATH)\docxx" ################################################################ *************** *** 38,56 **** # 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 = -DWIN32 -tWD -tWM -VM -Vd \ ! -w-inl -w-pia -w-rch -w-par -w-aus -w-csu ! INCLUDES = -I$(JAVA_PATH)\include -I$(JAVA_PATH)\include\win32 \ ! -I$(COMPILER_PATH)\Include # debug or not ? # choose one of following two possibilities ! FLAGS = -Od -D_DEBUG ! #FLAGS = -O -O2 -DNDEBUG -6 -f- -k- -Oc -Oi -OS -Ov -v- -x- -RT- ! LDFLAGS = $(DEFINES) -L$(COMPILER_PATH)\Lib -L$(COMPILER_PATH)\Lib\PSDK ! LDLIBS = wsock32.lib winmm.lib ! LDFLAGS2 = $(LDFLAGS) ! LDLIBS2 = wsock32.lib CPPFLAGS = -c $(FLAGS) $(DEFINES) $(INCLUDES) *************** *** 59,68 **** # 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) --- 61,73 ---- # MAKEFILE ! MFLAGS = -f Makefile.mak ! !include dir.info ! all: ! for %i in (xxx $(DIRS)) do if not %i == xxx $(MAKE) $(MFLAGS) %i.dir ! for %i in (xxx $(FILES)) do if not %i == xxx $(MAKE) $(MFLAGS) %i.obj ! clean: ! for %i in (xxx $(CLEAN_FILES)) do if exist %i del %i ! for %i in (xxx $(DIRS)) do if not %i == xxx $(MAKE) $(MFLAGS) %i.clean |
From: Marek P. <ma...@us...> - 2001-08-25 23:27:47
|
Update of /cvsroot/javaprofiler/library In directory usw-pr-cvs1:/tmp/cvs-serv12893 Modified Files: config.mk Log Message: unix implementation of shared memory communication (semaphore, shared memory) Index: config.mk =================================================================== RCS file: /cvsroot/javaprofiler/library/config.mk,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** config.mk 2001/08/25 10:14:19 1.18 --- config.mk 2001/08/25 23:27:43 1.19 *************** *** 45,50 **** # choose one of following two possibilities ! FLAGS = -O0 -D_DEBUG ! #FLAGS = -O3 -DNDEBUG -fno-rtti -fno-exceptions LDFLAGS = $(DEFINES) -shared -o $(PROF_LIBRARY_NAME) --- 45,50 ---- # choose one of following two possibilities ! #FLAGS = -O0 -D_DEBUG ! FLAGS = -O3 -DNDEBUG -fno-rtti -fno-exceptions LDFLAGS = $(DEFINES) -shared -o $(PROF_LIBRARY_NAME) |
From: Marek P. <ma...@us...> - 2001-08-25 23:27:47
|
Update of /cvsroot/javaprofiler/library/src/main In directory usw-pr-cvs1:/tmp/cvs-serv12893/src/main Modified Files: includes.h Log Message: unix implementation of shared memory communication (semaphore, shared memory) Index: includes.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/main/includes.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -r1.22 -r1.23 *** includes.h 2001/08/24 17:54:04 1.22 --- includes.h 2001/08/25 23:27:43 1.23 *************** *** 12,15 **** --- 12,19 ---- #include <unistd.h> #include <sys/time.h> + #include <sys/ipc.h> + #include <sys/sem.h> + #include <sys/shm.h> + #include <netdb.h> #endif *************** *** 75,80 **** #include "../prof/lock.h" #include "../prof/synchronized.h" - #include "../commun3/semaphore.h" - #include "../commun3/sharedMemory.h" #include "../delay/delay.h" --- 79,82 ---- *************** *** 88,92 **** #include "../commun/commun.h" #include "../commun/communSocket.h" - #include "../commun3/communShMem.h" #include "../commun/statDataModification.h" #include "../commun2/objectTable.h" --- 90,93 ---- *************** *** 98,101 **** --- 99,107 ---- #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" |
From: Marek P. <ma...@us...> - 2001-08-25 23:27:47
|
Update of /cvsroot/javaprofiler/library/src2 In directory usw-pr-cvs1:/tmp/cvs-serv12893/src2 Modified Files: dir.info Log Message: unix implementation of shared memory communication (semaphore, shared memory) Index: dir.info =================================================================== RCS file: /cvsroot/javaprofiler/library/src2/dir.info,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** dir.info 2001/08/23 23:57:31 1.3 --- dir.info 2001/08/25 23:27:43 1.4 *************** *** 1,5 **** FILES = java CommunShMem do_link ! CLEAN_FILES = *.class *.jar *.h *.dll *.so *.obj *.o *.pdb *.lib *.exp OBJ_FILES = *.o* ../src/string/*.o* --- 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* |
From: Marek P. <ma...@us...> - 2001-08-25 23:27:46
|
Update of /cvsroot/javaprofiler/library/src/commun3 In directory usw-pr-cvs1:/tmp/cvs-serv12893/src/commun3 Modified Files: semaphore.h sharedMemory.h Log Message: unix implementation of shared memory communication (semaphore, shared memory) Index: semaphore.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun3/semaphore.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** semaphore.h 2001/08/23 23:57:31 1.2 --- semaphore.h 2001/08/25 23:27:43 1.3 *************** *** 13,17 **** HANDLE _semid; #else ! #error FIXME - not implemented yet !!! #endif --- 13,21 ---- HANDLE _semid; #else ! /// unix semaphore identifier ! int _semid; ! ! /// initially locked ! int _initLocked; #endif *************** *** 29,33 **** _semid = CreateSemaphore( NULL, (( locked) ? 0 : 1), 1, name); #else ! #error FIXME - not implemented yet !!! #endif } --- 33,38 ---- _semid = CreateSemaphore( NULL, (( locked) ? 0 : 1), 1, name); #else ! _semid = semget( *(key_t*)(const char*)name, 1, 0666 | IPC_CREAT); ! _initLocked = locked; #endif } *************** *** 39,43 **** CloseHandle( _semid); #else - #error FIXME - not implemented yet !!! #endif } --- 44,47 ---- *************** *** 54,58 **** WaitForSingleObject( _semid, INFINITE); #else ! #error FIXME - not implemented yet !!! #endif } --- 58,71 ---- WaitForSingleObject( _semid, INFINITE); #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 } *************** *** 68,72 **** ReleaseSemaphore( _semid, 1, NULL); #else ! #error FIXME - not implemented yet !!! #endif } --- 81,94 ---- ReleaseSemaphore( _semid, 1, NULL); #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 } *************** *** 87,93 **** if( rc == WAIT_TIMEOUT) return 0; #else ! #error FIXME - not implemented yet !!! ! #endif return 1; } --- 109,123 ---- 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; } *************** *** 95,96 **** --- 125,127 ---- #endif // _SEMAPHORE_H_ + Index: sharedMemory.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun3/sharedMemory.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** sharedMemory.h 2001/08/12 07:35:31 1.2 --- sharedMemory.h 2001/08/25 23:27:43 1.3 *************** *** 16,20 **** LPVOID _address; #else ! #error FIXME - not implemented yet !!! #endif --- 16,24 ---- LPVOID _address; #else ! /// unix shared memory identifier ! int _shmid; ! ! /// unix shared memory address ! void* _address; #endif *************** *** 39,43 **** _address = MapViewOfFile( _shmid, FILE_MAP_ALL_ACCESS, 0, 0, 0); #else ! #error FIXME - not implemented yet !!! #endif } --- 43,49 ---- _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 } *************** *** 53,57 **** CloseHandle( _shmid); #else ! #error FIXME - not implemented yet !!! #endif } --- 59,63 ---- CloseHandle( _shmid); #else ! shmdt( _address); #endif } *************** *** 73,74 **** --- 79,81 ---- #endif // _SHARED_MEMORY_H_ + |
From: Marek P. <ma...@us...> - 2001-08-25 10:14:23
|
Update of /cvsroot/javaprofiler/library In directory usw-pr-cvs1:/tmp/cvs-serv525 Modified Files: README config.mk Log Message: Index: README =================================================================== RCS file: /cvsroot/javaprofiler/library/README,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** README 2001/08/23 23:57:30 1.18 --- README 2001/08/25 10:14:19 1.19 *************** *** 36,43 **** 1.1 Operating system ! The library is tested for use on the following operating systems; the main reason ! is that for these OSes good Java Virtual Machines exist (meaning with functional ! Java Virtual Machine Profiler Interface - JVMPI or at least JVMPI functions used ! in library's sources are supported). * Microsoft Windows NT4/2000 --- 36,44 ---- 1.1 Operating system ! The library is tested for use on the following operating systems; ! the main reason is that for these OSes good Java Virtual Machines ! exist (meaning with functional Java Virtual Machine Profiler ! Interface - JVMPI or at least JVMPI functions used in library's ! sources are supported). * Microsoft Windows NT4/2000 *************** *** 47,55 **** 1.2 Programming language ! The library sources are written in 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++. * Visual C/C++ 6.0 --- 48,57 ---- 1.2 Programming language ! 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++. * Visual C/C++ 6.0 *************** *** 57,63 **** * 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.3.1 --- 59,65 ---- * 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.3.1 *************** *** 67,84 **** 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, DOC++ (for C++ sources) and JavaDoc ! (for Java sources) are used. * DOC++ 3.4.7 ! Data flows, schemes and relations between structures are described using ! Microsoft Visio 2000. These schemes are exported to JPEG format, too. * Microsoft Visio 2000 GNU C/C++ must be used together with GNU make 3.7x. Another versions ! of "make" utility can be incompatible with GNU make 3.7x. * GNU make 3.7x --- 69,88 ---- 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, DOC++ (for C++ ! sources) and JavaDoc (for Java sources) are used. * DOC++ 3.4.7 ! 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. * Microsoft Visio 2000 GNU C/C++ must be used together with GNU make 3.7x. Another versions ! (of other vendors) of "make" utility can be incompatible ! with GNU make 3.7x. * GNU make 3.7x *************** *** 87,124 **** 2. DIRECTORY STRUCTURE ! config/ configuration files for various platforms/compilers ! doc/ documentation (most of it is generated during compilation) ! doc/html/interface/ project documentation to the sources ! of Java interface to the library ! doc/html/library/ project documentation to the sources ! of the profiler dynamic library ! doc/html/native/ project documentation to the sources ! of native Java classes of the interface ! doc/visio/ data flows, schemes and relations between ! structures inside of profiler dynamic library ! doc/visio/jpegs/ Visio files exported to JPEG 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 behavior. 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 configuration - file as for SunOS 5.8. It doesn't matter if SPARC or x86 platform. - 4. DOWNLOAD --- 91,130 ---- 2. DIRECTORY STRUCTURE ! config/ configuration files for various platforms/compilers ! doc/ documentation (most of it is generated during compilation) ! doc/html/interface/ project documentation to the sources ! of Java interface to the library ! doc/html/library/ project documentation to the sources ! of the profiler dynamic library ! doc/html/native/ project documentation to the sources ! of native Java classes of the interface ! doc/visio/ data flows, schemes and relations between ! structures inside of profiler dynamic library ! doc/visio/jpegs/ Visio files exported to JPEG 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 ! configuration file as for SunOS 5.8. It doesn't matter if SPARC or x86 ! platform. 4. DOWNLOAD *************** *** 144,168 **** 5.1 Win32 platform ! 5.1.1 replace "config.mk" file by appropriate one from config/ subdirectory copy appropriate configuration file from config/ subdirectory (depending on your own system configuration and used compiler) ! to the top directory of these sources and rename it to "config.mk" ! (so, you replace original file) 5.1.2 modify new "config.mk" - paths etc. ! 5.1.3 run "nmake" (for Visual C/C++ 6.0) or other equivalent (eg. "make") compile sources by "nmake /f Makefile.mak" (for Visual C/C++) ! or "make -f Makefile.mak" (for Borland C/C++) from top directory 5.1.4 if successful, following files were created: ! src/profiler/profiler.dll profiler dynamic library ! src2/IProf.jar Java interface to dynamic library ! src2/CommunShMem.dll Java native class ! doc/html/ project documentation in HTML format --- 150,178 ---- 5.1 Win32 platform ! 5.1.1 replace "config.mk" file by appropriate one ! from config/ subdirectory copy appropriate configuration file from config/ subdirectory (depending on your own system configuration and used compiler) ! to the top directory of these sources and rename it ! to "config.mk" (so, you replace original file) 5.1.2 modify new "config.mk" - paths etc. ! 5.1.3 run "nmake" (for Visual C/C++ 6.0) or other equivalent ! (eg. "make") compile sources by "nmake /f Makefile.mak" (for Visual C/C++) ! or "make -f Makefile.mak" (for Borland C/C++) ! from top directory 5.1.4 if successful, following files were created: + + src\profiler\profiler.dll profiler dynamic library ! src2\IProf.jar Java interface to dynamic library ! src2\CommunShMem.dll Java native class ! doc\html\ project documentation in HTML format *************** *** 174,181 **** 5.2.3 run "make" from top directory (as usual) ! 5.2.4 same as 5.1.4 5.3 Make rules --- 184,199 ---- 5.2.3 run "make" from top directory (as usual) + + 5.2.4 if successful, following files were created: + (same as 5.1.4) ! src/profiler/libprofiler.so + src2/IProf.jar + src2/libCommunShMem.so + doc/html/ + + 5.3 Make rules *************** *** 240,324 **** 6.2 Profiler dynamic library command-line arguments ! Profiler dynamic library can be set-up thru following command-line arguments: $ java -Xrunprofiler:arg1=val1,arg2=val2,... <Java program> ! Argument Value Description ! ---------------------------------------------------------------------------------- ! alloc {on|off} turns memory profiling on/off ! default: on ! ! alloc_level {object|method|trace} memory profiling granularity level ! default: trace ! ! object ... low ! method ... medium ! trace ... high ! ! alloc_trace_depth [positive number] maximum number of frames in a trace; ! used when alloc_level=trace ! default: 2 ! ! alloc_thread {on|off} memory profiling data distinguished ! to Java threads ! default: on ! ! cpu {on|off} turn cpu profiling on/off ! default: on ! ! cpu_method {exact|sampling} cpu profiling method ! default: sampling ! ! exact ... slower ! sampling ... faster ! ! cpu_level {method|trace} cpu profiling granularity level ! default: trace ! ! method ... low ! trace ... high ! ! cpu_trace_depth [positive number] maximum number of frames in a trace; ! used when cpu_level=trace ! default: 2 ! ! cpu_thread {on|off} cpu profiling data distinguished ! to Java threads ! default: on ! ! commun_type {socket|shmem} type of communication (media) ! default: shmem ! ! socket ... TCP sockets ! shmem ... shared memory ! ! commun_host [host] hostname of opposite side; ! used when commun_type=socket ! and connect_mode=client ! default: 127.0.0.1 (localhost) ! ! commun_port [positive number] port where the library is listening ! for incoming requests; ! used when commun_type=socket ! and connect_mode=server ! default: 25595 ! ! commun_shmem_id [string 3 chars long] unique identifier of shared memory ! block; it can be only 3 characters ! long, not more ! ! default: com ! ! commun_shmem_size [positive number] shared memory block size (in bytes) ! default: 262144 ! connect_mode {server|client} library's role in communication; ! used when commun_type=socket ! default: server 7. AUTHORS ! * Marek Przeczek * Petr Luner ma...@us... lu...@us... --- 258,350 ---- 6.2 Profiler dynamic library command-line arguments ! Profiler dynamic library can be set-up thru following ! command-line arguments: $ java -Xrunprofiler:arg1=val1,arg2=val2,... <Java program> ! Argument Value Description ! -------------------------------------------------------------------- ! alloc {on|off} turns memory profiling on/off ! default: on ! alloc_level {object|method|trace} memory profiling ! granularity level ! default: trace ! ! object ... low (fast) ! method ... medium (slow) ! trace ... high (slowest) ! ! alloc_trace_depth [positive number] maximum number of frames ! in a trace; ! used when alloc_level=trace ! default: 2 ! ! alloc_thread {on|off} memory profiling data ! distinguished to Java threads ! default: on ! ! cpu {on|off} turn cpu profiling on/off ! default: on ! ! cpu_method {exact|sampling} cpu profiling method ! default: sampling ! ! exact ... slow (better) ! sampling ... fast (worse) ! ! cpu_level {method|trace} cpu profiling ! granularity level ! default: trace ! ! method ... low (fast) ! trace ... high (slow) ! ! cpu_trace_depth [positive number] maximum number of frames ! in a trace; ! used when cpu_level=trace ! default: 2 ! ! cpu_thread {on|off} cpu profiling data ! distinguished to Java threads ! default: on ! ! commun_type {socket|shmem} type of communication (media) ! default: shmem ! ! socket ... TCP sockets ! shmem ... shared memory ! ! commun_host [host] hostname of opposite side; ! used when commun_type=socket ! and connect_mode=client ! default: 127.0.0.1 ! ! commun_port [positive number] port where the library ! is listening for incoming ! requests; ! used when commun_type=socket ! and connect_mode=server ! default: 25595 ! ! commun_shmem_id [string 3 chars long] unique identifier of shared ! memory block; it can be only ! 3 characters long, not more ! ! default: com ! ! commun_shmem_size [positive number] shared memory block size ! (in bytes) ! default: 262144 ! ! connect_mode {server|client} library's role ! in communication; ! used when commun_type=socket ! default: server 7. AUTHORS ! * Marek Przeczek, 2001 * Petr Luner, 2001 ma...@us... lu...@us... Index: config.mk =================================================================== RCS file: /cvsroot/javaprofiler/library/config.mk,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** config.mk 2001/08/23 23:57:30 1.17 --- config.mk 2001/08/25 10:14:19 1.18 *************** *** 1,12 **** ################################################################ # configuration file ! # Microsoft Windows NT 4.0/2000, x86, Visual C/C++ 6.0 # # author: Marek Przeczek ! PROF_LIBRARY_NAME = profiler\profiler.dll PROF_JAVA_INTERF_PACKAGE = IProf.jar ! NATIVE_LIBRARY_NAME = CommunShMem.dll ################################################################ --- 1,12 ---- ################################################################ # 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 ################################################################ *************** *** 15,29 **** # do not use "\" as a last character in path definition ! COMPILER_PATH = C:\Program Files\Microsoft Visual Studio\VC98 ! JAVA_PATH = C:\jdk1.3.1 ! DOCPP_PATH = C:\Local\doc++ ! ! CCC = "$(COMPILER_PATH)\Bin\cl" ! LD = "$(COMPILER_PATH)\Bin\link" ! JAVAC = "$(JAVA_PATH)\bin\javac" ! JAVAH = "$(JAVA_PATH)\bin\javah" ! JAR = "$(JAVA_PATH)\bin\jar" ! JDOC = "$(JAVA_PATH)\bin\javadoc" ! DOCPP = "$(DOCPP_PATH)\docxx" ################################################################ --- 15,29 ---- # 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 ! DOCPP_PATH = /home/mprz7483/BIG/doc++-3.4.7 ! ! 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" ! JDOC = "$(JAVA_PATH)/bin/javadoc" ! DOCPP = "$(DOCPP_PATH)/docxx" ################################################################ *************** *** 38,71 **** # modify as needed ! DEFINES = /DWIN32 ! INCLUDES = /I "$(JAVA_PATH)\include" /I "$(JAVA_PATH)\include\win32" # debug or not ? # choose one of following two possibilities ! FLAGS = /Od /Zi /D_DEBUG /MDd /LDd ! #FLAGS = /O2 /Og /Oi /Ot /Ox /DNDEBUG /MD /LD /G6 /GD ! LDFLAGS = /NOLOGO /DLL /OUT:$(PROF_LIBRARY_NAME) ! LDLIBS = wsock32.lib winmm.lib ! LDFLAGS2 = /NOLOGO /DLL /OUT:$(NATIVE_LIBRARY_NAME) ! LDLIBS2 = wsock32.lib ! CPPFLAGS = /nologo /c $(FLAGS) $(DEFINES) $(INCLUDES) ################################################################ # MAKEFILE ! MFLAGS = /NOLOGO /f Makefile.mak include dir.info ! all: ! for %i in (xxx $(DIRS)) do if not %%i == xxx $(MAKE) $(MFLAGS) %%i.dir ! for %i in (xxx $(FILES)) do if not %%i == xxx $(MAKE) $(MFLAGS) %%i.obj ! ! clean: ! for %i in (xxx $(CLEAN_FILES)) do if exist %%i del %%i ! for %i in (xxx $(DIRS)) do if not %%i == xxx $(MAKE) $(MFLAGS) %%i.clean --- 38,68 ---- # 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) |
From: Petr L. <lu...@us...> - 2001-08-24 20:18:08
|
Update of /cvsroot/javaprofiler/library/doc/visio/jpegs In directory usw-pr-cvs1:/tmp/cvs-serv5887/jpegs Added Files: data_structure_scheme_monitors.jpg Log Message: Monitor profiling --- NEW FILE: data_structure_scheme_monitors.jpg --- ÿØÿà ÿÀ %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚáâãäåæçèéêñòóôõö÷øùú $4á%ñ&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz ¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚâãäåæçèéêòóôõö÷øùúÿÚ (àÿ E©~˶Ä/ÇúouÏý¿QÓlF¸¿ÒÀG4w6Çû$¾YhWwÊ!8¤ý§?à¢e/oÃè<Aâ-CG[#Ã:u ÌòË,Q¬¯sy¶Õ *I>ñ¢ ðßø^ÚM¯í3ñáî½à^оxyüK¨üG×t%²ð%Õ¤pÛO2Zêí.Ù%.È¥/Ùn²qHcð³â¾3|Ò~#ü;ÕN¹àír}B ?P0IÝ;ɬetI ½ÿ á¼>/~Ð Çõ¿ünð{øÄÚ¡qi..öö6²$pq0gM [|ΧÌåÁP ÿ køÔ>xUÔí®nn´Ëíð[É$ÖÈUÅ+Fe8ʪ1?¾ÿ ( ( ( ( ( ( ( ( ( ( ( ( ( ( øÓã¯í±ðGáf ñ_Â:GÄÿ û<üPøsñOÄþ2Ô/>Û|<ºmA4ûÝ7QÔ¯Úf£pÖvòÂ$RÔÖßìñ<k i+Þâý»e þø·Å6¿ìï4èÚ.¿¯ÝÛhzÄë¦ØjÒÁ:¥©c$Ý@ ,Eÿ éÿ oþe©VÓë×Ð\^YµÉÙorÐO4aVC¬ÊãW9àíº¯üïþ -¦x?ân¿ñÛLñ/ìÉâÁ§ø®-¯dñ òiúU¹h~Ã[ÜyWêÒ!@Xî,ßxã¼ ?àÒ Þ%ð_þüGñ<]=ݶ±giCàkéµíJîÖþêÑßt nÄ u9©ü«Ù]ÁÓ?³V¡¢þÑ7ß´t:§µK=gÅëq¦ý ïÎúl§GºCk9ü½ÒIÁc¡@?F?à¢~øGãßø&¦³añÇúÇÂï i:ΨÛxÇF¿ÕãÓ5?Þ[Û«K4gÝÍÃFCm]Ï®×È¿²×ÆoÝÁbô¾6×g¯ÚºþOÝj:wÆßi:sk¾ÒãóöÙßÞ[¨XÌÄ-n»vfo1ððÇÂ]GN°ÿ üeÿ LnÎ?(ô~8ðNÿ ÐEð«á|?cøkà ¨ Ð ±@ ¿ ÑB0PÌ 2Ê9 ê×ÿ èÞ'þÍûOÚ³þßg×çlO7Ëóvoضçjç ²¬ôì´PE cÌ®oJ&í¦$±!Lkvób"ÊÚoÁ× ìüS¥ø[Ç:Çö~x¢ÇK¶NööêéE²®ãnâçù¤H¬¥d´~!|TñÅçìùáOü&Õ<)áøï<a¥ø/[Ó<aá{VæÏQ»ñ§®b gª[DX]Éx$Ø×1\WÉc"g ëÆÚGö oáËwâÝÂ;[+kº©¤FÓ_It÷wvPÛ%¼wFSs2Ä« â¯ÛáO´µOA®ø^ÂãÄÞ(ðý´ºÆmöÛ_Þ ?WÕ-ÕïAÞ+¢#KXjW-Ê _]øcÏÒ¿áñ$FÔo|Û+] µ 7ÍâòkXfîFkÌ˾Yðÿ ?L¶½Òo¼K¡k~øYÔ<A%ΫÍo>£ku&¡4ÍwÏgl1pd*Фd¡½à?øm¤ëv~]ÿ ÷z 0õ/µ=ÓOþÍ×t°êzÖ¯ö âmcDÔâ¸ÕïQÔÑoìnaºû=Íä|Þo^(û|°þïøhøZÙºïü&?ÚÛ{¿á&Ö?³?´ÿ ( ( ( ( ( ( ( ø£ö_ÿ ( ( ( ðÏÚþQ§ûCÿ ( ( (ãO?òHü]ÿ ÃöÐðÃiïí¢x«Á^/ñ%Üï¤øÝGu¥_x~ÖÝ#aáà&Mfè¸df,ídzü3ß¿èé~?ÿ £ØQ@ ( ( ( ( ( ( ( ( ( ( (çÿ ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (çÿ ( ( ( ( ( ( ( ( ( ( ( èñÏÿ èñÏÿ èñÏÿ èñÏÿ [Çcì÷ú£áìâòÎæ7|ÛJ¯*]{ü5?Âú|sÿ øçÿ øçÿ øçÿ øçÿ üGÿ ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ãüwã¿ü5øguâï]j%¥Þ`M{ªÝMu}w ¤0ÚYÅ-ÄòËusJFÌZAÆ2@ÿ ?¸ý©àÝ·aªxî ÿ >ý¼aãïÚ¦j¿´-KÂGÛÎàíoÃZ¡¦[×ï4V·»¶]^>öݧÔn®äg±[ÉVµûZ@!áÙ÷Ç~øàÝ~÷âÿ ( ª Ëöÿ Ëöÿ Ëöÿ Ëöÿ Ëöÿ Ëöÿ Ëöÿ Ëöÿ ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (çÿ ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (çÿ éî ©iúÖZC§ê sii2 !P'FVWRU 4( ( ( ( ( (Ôüsáâß < «kÖw|qk©ÝèuÃVO5àØòF1HcÎòGU) üsáj,¶ð¦½a¯IàmvoëÑÇa«Ã3ÍjdÆÇ4¹H°G/7E êZÅäZÖzM¤×ÇaaqtñÄ Ùaµ·GyHR(äv¢³øcöøUâïê"Ò¯üai¢i Ó|+5æµàoè¾³}ªÿ ( >ó3Gü)¿¿ôv?ÿ oâ/ýÇÿ >ó3_\Á;~6ßÁZ|aûC[~Ö0ð}õßͶ§¥ÙÚ?<O§Z[Ùõ¦¶ÖÖ:\1y$Qýö QckP·ÿ Ùx¢þ_0:Êï?ÿ²ÿ q©|T×u ?Å¿ ¼Mi5¡¦_êVPµ¾.t¹t¬_D¸¸Ôônj-jÚÅ¥ÚnÆÅç·ó®ü¿áìoâøKá¥õÆðÃ=ømá_ÞÓµ]iäÃûÄÚ¡â¹í/Ðÿ ø7¶g¦ijDvñYf%äÝI%IdwÙ˲ÿ ( ( ( ( ( ( ¼~Ë.ux?CðýüÖZïÖ[+(m¥hYüBÑE$SÀ ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ùÿ ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ùÿ ( ( (ñü+ã =;žðÿ øãÀ)ðO|?ãjoØõ}QP°»ò¤hdò®!föKÆÛXáà+ ( ( ( ( ( ( ó> ~ÓòüvÕ>+øÿ ø«áÆã '²6z~«¿F,ÖÄb6×ý¿umdqiyoÌpºÇc iÿ ªïÿ Esg#j:lBåµøç¾[Ë?5äÑ}ªÚÒI¬lþß ( ( ( ( ( ( ùÿ ( ( ( ?ÇÓýþÓN·â/2-!£}Æë¹ã @¿ÿ |
From: Petr L. <lu...@us...> - 2001-08-24 20:18:08
|
Update of /cvsroot/javaprofiler/library/doc/visio In directory usw-pr-cvs1:/tmp/cvs-serv5887 Modified Files: data_structure_scheme.vsd Log Message: Monitor profiling Index: data_structure_scheme.vsd =================================================================== RCS file: /cvsroot/javaprofiler/library/doc/visio/data_structure_scheme.vsd,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 Binary files /tmp/cvsyhI0Yb and /tmp/cvsIVkTid differ |
From: Petr L. <lu...@us...> - 2001-08-24 17:54:09
|
Update of /cvsroot/javaprofiler/library/src/shared In directory usw-pr-cvs1:/tmp/cvs-serv4667/shared Modified Files: method.cpp method.h thread.cpp thread.h Log Message: Monitor profiling Index: method.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/shared/method.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** method.cpp 2001/07/28 04:38:45 1.10 --- method.cpp 2001/08/24 17:54:04 1.11 *************** *** 29,32 **** --- 29,38 ---- ctm = cpuThreadMethods.next(ctm); } + + MonThreadMethod* mtm = monThreadMethods.first(); + while (mtm) { + mtm->deactivate(); + mtm = monThreadMethods.next(mtm); + } AllocTrace* at = allocTraces.first(); *************** *** 40,43 **** --- 46,55 ---- ct->deactivate(); ct = cpuTraces.next(ct); + } + + MonTrace* mt = monTraces.first(); + while (mt) { + mt->deactivate(); + mt = monTraces.next(mt); } } Index: method.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/shared/method.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** method.h 2001/08/05 01:37:10 1.18 --- method.h 2001/08/24 17:54:04 1.19 *************** *** 6,10 **** ** a JVMPI_EVENT_CLASS_LOAD event). ** ! ** @see Class, AllocObjectMethod, AllocTrace ** ** @author Marek Przeczek, Petr Luner */ --- 6,10 ---- ** a JVMPI_EVENT_CLASS_LOAD event). ** ! ** @see Class ** ** @author Marek Przeczek, Petr Luner */ *************** *** 12,16 **** class Method: public IdObject, public LI1, public LI2, ! public AllocStatData, public CpuStatData, public InfoBinaryFormat { public: --- 12,18 ---- class Method: public IdObject, public LI1, public LI2, ! public AllocStatData, ! public CpuStatData, ! public MonStatData, public InfoBinaryFormat { public: *************** *** 49,52 **** --- 51,60 ---- List<CpuThreadMethod,LI3> cpuThreadMethods; + /// associated MonTraces + List<MonTrace,LI2> monTraces; + + /// associated MonThreadMethods + List<MonThreadMethod,LI3> monThreadMethods; + public: *************** *** 148,152 **** virtual int isChanged() { return (activeChanged() || AllocStatData::dataChanged() || ! CpuStatData::dataChanged());} // order dependent ! /** Set the structure is unchanged although it may not be. */ --- 156,161 ---- virtual int isChanged() { return (activeChanged() || AllocStatData::dataChanged() || ! CpuStatData::dataChanged() || ! MonStatData::dataChanged());} // order dependent ! /** Set the structure is unchanged although it may not be. */ *************** *** 157,160 **** --- 166,170 ---- AllocStatData::clearDataChanged(); CpuStatData::clearDataChanged(); + MonStatData::clearDataChanged(); } }; Index: thread.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/shared/thread.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** thread.cpp 2001/07/30 15:41:26 1.6 --- thread.cpp 2001/08/24 17:54:04 1.7 *************** *** 37,39 **** --- 37,45 ---- ctm = cpuThreadMethods.next(ctm); } + + MonThreadMethod* mtm = monThreadMethods.first(); + while (mtm) { + mtm->deactivate(); + mtm = monThreadMethods.next(mtm); + } } Index: thread.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/shared/thread.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** thread.h 2001/08/05 01:37:10 1.20 --- thread.h 2001/08/24 17:54:04 1.21 *************** *** 8,12 **** ** so 'active' field will equal zero. ** ! ** @see GroupThread, AllocThreadObject, AllocThreadMethod ** ** @author Marek Przeczek, Petr Luner */ --- 8,12 ---- ** so 'active' field will equal zero. ** ! ** @see GroupThread ** ** @author Marek Przeczek, Petr Luner */ *************** *** 47,50 **** --- 47,53 ---- List<CpuThreadMethod,LI2> cpuThreadMethods; + /// associated MonThreadMethods + List<MonThreadMethod,LI2> monThreadMethods; + /// CPU stack CpuStack stack; *************** *** 60,63 **** --- 63,82 ---- int hasRun; + /** For monitor profiling purposes. + ** Indicates whether JVMPI_EVENT_MONITOR_CONTENDED_ENTER + ** event occured for this thread. The flag is cleared + ** in JVMPI_EVENT_MONITOR_CONTENDED_ENTERED event. */ + int monitorEnter; + + /** For monitor profiling purposes. + ** Holds the object id of the last + ** JVMPI_EVENT_MONITOR_CONTENDED_ENTER event. */ + jobjectID monitorEnterObject; + + /** For monitor profiling purposes. + ** Holds the time of the last + ** JVMPI_EVENT_MONITOR_CONTENDED_ENTER event. */ + unsigned long monitorEnterTime; + private: *************** *** 74,78 **** threadId( 0), threadEnvId( NULL), ! active( 1) { --- 93,100 ---- threadId( 0), threadEnvId( NULL), ! active( 1), ! monitorEnter(0), ! monitorEnterObject(0), ! monitorEnterTime(0) { |
From: Petr L. <lu...@us...> - 2001-08-24 17:54:08
|
Update of /cvsroot/javaprofiler/library/src/setup In directory usw-pr-cvs1:/tmp/cvs-serv4667/setup Modified Files: setup.cpp setup.h Log Message: Monitor profiling Index: setup.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/setup/setup.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** setup.cpp 2001/08/12 07:35:31 1.4 --- setup.cpp 2001/08/24 17:54:04 1.5 *************** *** 14,17 **** --- 14,22 ---- cpu.threadsEnabled = 1; + mon.turnedOn = 1; + mon.level = LEVEL_TRACE; + mon.traceDepth = 2; + mon.threadsEnabled = 1; + if( options) processOptions( options); } *************** *** 144,147 **** --- 149,193 ---- else if (strcmp(value, "off") == 0) cpu.threadsEnabled = 0; + + return; + } + + if (strcmp(name, "mon") == 0) { + + if (strcmp(value, "on") == 0) + mon.turnedOn = 1; + else if (strcmp(value, "off") == 0) + mon.turnedOn = 0; + + return; + } + + if (strcmp(name, "mon_level") == 0) { + + if (strcmp(value, "method") == 0) + mon.level = LEVEL_METHOD; + else if (strcmp(value, "trace") == 0) + mon.level = LEVEL_TRACE; + + return; + } + + if (strcmp(name, "mon_trace_depth") == 0) { + + int depth = atoi(value); + + if (depth > 0) { + if (depth > MAX_TRACE) depth = MAX_TRACE; + mon.traceDepth = depth; + } + return; + } + + if (strcmp(name, "mon_thread") == 0) { + + if (strcmp(value, "on") == 0) + mon.threadsEnabled = 1; + else if (strcmp(value, "off") == 0) + mon.threadsEnabled = 0; return; Index: setup.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/setup/setup.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** setup.h 2001/08/12 07:35:31 1.5 --- setup.h 2001/08/24 17:54:04 1.6 *************** *** 48,52 **** /** Granularity level. ! ** Possible values are LEVEL_OBJECT and LEVEL_TRACE. */ LEVEL level; --- 48,52 ---- /** Granularity level. ! ** Possible values are LEVEL_METHOD and LEVEL_TRACE. */ LEVEL level; *************** *** 59,62 **** --- 59,80 ---- }; + /// Monitor profiling setup parameters + struct Mon { + + /// Whether monitor profiling is turned ON or OFF + int turnedOn; + + /** Granularity level. + ** Possible values are LEVEL_METHOD and LEVEL_TRACE. */ + + LEVEL level; + + /// Trace depth + int traceDepth; + + /// Whether resolution to threads is enabled + int threadsEnabled; + }; + /// setup for communication struct Com { *************** *** 100,103 **** --- 118,124 ---- /// CPU profiling Cpu cpu; + + /// Monitor profiling + Mon mon; /// Communication |
From: Petr L. <lu...@us...> - 2001-08-24 17:54:08
|
Update of /cvsroot/javaprofiler/library/src/mon In directory usw-pr-cvs1:/tmp/cvs-serv4667/mon Added Files: Makefile Makefile.mak Makefile.rules dir.info monStatData.cpp monStatData.h monThreadMethod.cpp monThreadMethod.h monThreadTrace.cpp monThreadTrace.h monTrace.cpp monTrace.h Log Message: Monitor profiling --- NEW FILE: Makefile --- include ../../config.mk include Makefile.rules --- NEW FILE: Makefile.mak --- !include ../../config.mk !include Makefile.rules --- NEW FILE: Makefile.rules --- 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 --- NEW FILE: dir.info --- FILES = monStatData monThreadMethod monThreadTrace monTrace CLEAN_FILES = *.pdb *.obj *.o --- NEW FILE: monStatData.cpp --- #include "../main/includes.h" void MonStatData::addMonStat(jlong addHits, jlong addTime) { hits += addHits; time += addTime; setDataChanged(); } Buffer& MonStatData::dataToBin(Buffer& b) { b += hits; b += time; setDataChanged(); return b; } MonStatData& MonStatData::copy(MonStatData& dest, const MonStatData& src) { dest.hits = src.hits; dest.time = src.time; return dest; } --- NEW FILE: monStatData.h --- #ifndef _MON_STAT_DATA_H_ #define _MON_STAT_DATA_H_ /** Statistics data for monitor profiling. ** This class is used as a base class for other classes ** to hold statistics information about time spent ** by waiting on a monitor. ** ** @see Method, MonTrace, Thread, MonThreadMethod, MonThreadTrace ** ** @author Petr Luner */ class MonStatData: public DataBinaryFormat, public StatDataModification { public: /// Total wait time. jlong time; /// Number of waits. jlong hits; /** Helper flag. ** 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: /** Copies statistic data. */ static MonStatData& copy( MonStatData& dest, const MonStatData& src); }; #endif // _MON_STAT_DATA_H_ --- NEW FILE: monThreadMethod.cpp --- #include "../main/includes.h" Allocator MonThreadMethod::_allocator( sizeof( MonThreadMethod)); void MonThreadMethod::addMonStat(jlong addHits, jlong addTime) { MonStatData::addMonStat(addHits, addTime); method->addMonStat(addHits, addTime); } void MonThreadMethod::deactivate() { prof().activeMonThreadMethods.removeNoRehash(this); MonThreadTrace* tt = threadTraces.first(); while (tt) { tt->deactivate(); tt = threadTraces.next(tt); } } --- NEW FILE: monThreadMethod.h --- #ifndef _MON_THREAD_METHOD_H_ #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 ** method while running in the thread. ** Same method can run in different threads. So it would be useful ** to have an information about each method in each thread. ** ** @author Petr Luner */ class MonThreadMethod: public IdObject, public LI1, public LI2, public LI3, public MonStatData { public: /// parent thread Thread* thread; /// parent method Method* method; /// associated MonThreadTraces List<MonThreadTrace,LI2> threadTraces; public: /// Default constructor. MonThreadMethod() : 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) ** ** @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. */ void deactivate(); private: /// allocator static Allocator _allocator; public: /** Overloaded new() operator. */ void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} public: /** Class identification. ** ** @return unique class type identified */ virtual eClassIdent getClassIdent() { return MON_THREAD_METHOD;} /** State of object. Once an object is unactive, it remains ** unactive forever. ** ** @return 0 (not active); ** 1 (active) */ virtual int isActive() { return (method->isActive() && thread->isActive());} /** Indication that object has changed its data. ** ** @return 0 (no change); ** 1 (data changed) */ virtual int isChanged() { return (activeChanged() || dataChanged());} // order dependent ! /** Set the structure is unchanged although it may not be. */ virtual void setUnchanged() { IdObject::setUnchanged(); clearDataChanged(); } }; #endif // _MON_THREAD_METHOD_H_ --- NEW FILE: monThreadTrace.cpp --- #include "../main/includes.h" Allocator MonThreadTrace::_allocator( sizeof( MonThreadTrace)); void MonThreadTrace::addMonStat(jlong addHits, jlong addTime) { MonStatData::addMonStat(addHits, addTime); threadMethod->addMonStat(addHits, addTime); trace->addMonStat(addHits, addTime); } void MonThreadTrace::deactivate() { prof().activeMonThreadTraces.removeNoRehash(this); } --- NEW FILE: monThreadTrace.h --- #ifndef _MON_THREAD_TRACE_H_ #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 ** a trace while running in the thread. ** Same trace can run in different threads. So it would be useful ** to have an information about each trace in each thread. ** ** @author Petr Luner */ class MonThreadTrace: public IdObject, public LI1, public LI2, public LI3, public MonStatData { public: /// parent MonThreadMethod MonThreadMethod* threadMethod; /// parent MonTrace MonTrace* trace; public: /// Default constructor. MonThreadTrace() : threadMethod( NULL), trace( NULL) {}; /** Updates monitor statistics. ** Also updates monitor statistics of corresponding MonTrace ** 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) ** ** @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. */ void deactivate(); private: /// allocator static Allocator _allocator; public: /** Overloaded new() operator. */ void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} public: /** Class identification. ** ** @return unique class type identified */ virtual eClassIdent getClassIdent() { return MON_THREAD_TRACE;} /** State of object. Once an object is unactive, it remains ** unactive forever. ** ** @return 0 (not active); ** 1 (active) */ virtual int isActive() { return (trace->isActive() && threadMethod->isActive());} /** Indication that object has changed its data. ** ** @return 0 (no change); ** 1 (data changed) */ virtual int isChanged() { return (activeChanged() || dataChanged());} // order dependent ! /** Set the structure is unchanged although it may not be. */ virtual void setUnchanged() { IdObject::setUnchanged(); clearDataChanged(); } }; #endif // _MON_THREAD_TRACE_H_ --- NEW FILE: monTrace.cpp --- #include "../main/includes.h" Allocator MonTrace::_allocator( sizeof( MonTrace)); void MonTrace::addMonStat(jlong addHits, jlong addTime) { MonStatData::addMonStat(addHits, addTime); method->addMonStat(addHits, addTime); } void MonTrace::deactivate() { prof().activeMonTraces.removeNoRehash(this); } --- NEW FILE: monTrace.h --- #ifndef _MON_TRACE_H_ #define _MON_TRACE_H_ /** Trace for monitor profiling. ** We decided to use different traces ** for memory, cpu and monitor profiling, because it should ** be an option to have different granularity of traces ** (their trace frame stack depth) for each type of profiling. ** ** @author Petr Luner */ class MonTrace: public IdObject, public LI1, public LI2, public Trace, public MonStatData { public: /// parent method Method* method; /// associated MonThreadTraces List<MonThreadTrace,LI3> threadTraces; public: /// Default constructor. MonTrace() : 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. */ void deactivate(); private: /// allocator static Allocator _allocator; public: /** Overloaded new() operator. */ void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} public: /** Class identification. ** ** @return unique class type identified */ virtual eClassIdent getClassIdent() { return MON_TRACE;} /** State of object. Once an object is unactive, it remains ** unactive forever. ** ** @return 0 (not active); ** 1 (active) */ virtual int isActive() { return method->isActive();} /** Indication that object has changed its data. ** ** @return 0 (no change); ** 1 (data changed) */ virtual int isChanged() { return (activeChanged() || dataChanged());} // order dependent ! /** Set the structure is unchanged although it may not be. */ virtual void setUnchanged() { IdObject::setUnchanged(); clearDataChanged(); } }; #endif // _MON_TRACE_H_ |
From: Petr L. <lu...@us...> - 2001-08-24 17:54:08
|
Update of /cvsroot/javaprofiler/library/src/commun2 In directory usw-pr-cvs1:/tmp/cvs-serv4667/commun2 Modified Files: idObject.h Log Message: Monitor profiling Index: idObject.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun2/idObject.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** idObject.h 2001/08/05 01:37:10 1.6 --- idObject.h 2001/08/24 17:54:04 1.7 *************** *** 25,28 **** --- 25,29 ---- ALLOC = 1, // 001b CPU = 2, // 010b + MON = 4, // 100b ALLOC_ARENA = ( 1 << 8), *************** *** 43,48 **** CLASS_FIELD = (16 << 8), GROUP_THREAD = (17 << 8), ! METHOD = (18 << 8) | ALLOC | CPU, ! THREAD = (19 << 8) | ALLOC }; --- 44,52 ---- CLASS_FIELD = (16 << 8), GROUP_THREAD = (17 << 8), ! METHOD = (18 << 8) | ALLOC | CPU | MON, ! THREAD = (19 << 8) | ALLOC, ! MON_THREAD_METHOD = (20 << 8) | MON, ! MON_THREAD_TRACE = (21 << 8) | MON, ! MON_TRACE = (22 << 8) | MON }; |
From: Petr L. <lu...@us...> - 2001-08-24 17:54:08
|
Update of /cvsroot/javaprofiler/library/src/prof In directory usw-pr-cvs1:/tmp/cvs-serv4667/prof Modified Files: Makefile.rules dir.info prof.cpp prof.h prof_get.cpp prof_jvm.cpp Added Files: prof_monitor.cpp Log Message: Monitor profiling --- NEW FILE: prof_monitor.cpp --- #include "../main/includes.h" void Prof::event_monitorContendedEnter( JVMPI_Event* event) { Synchronized sync(dataLock); // cerr << "MONITOR CONTENDED ENTER: " << (long)(event->env_id) << endl; Thread* t; if (!(t = getThread(event->env_id))) { PROF_ERROR("MONITOR CONTENDED ENTER", "Thread not found"); return; } t->monitorEnter = 1; t->monitorEnterObject = event->u.monitor.object; t->monitorEnterTime = getMilliticks(); } void Prof::event_monitorContendedEntered( JVMPI_Event* event) { Synchronized sync(dataLock); // cerr << "MONITOR CONTENDED ENTERED: " << (long)(event->env_id) << endl; Thread* t; if (!(t = getThread(event->env_id))) { PROF_ERROR("MONITOR CONTENDED ENTERED", "Thread not found"); return; } if ((!(t->monitorEnter)) || (t->monitorEnterObject != event->u.monitor.object)) { PROF_ERROR("MONITOR CONTENDED ENTERED", "No corresponding MONITOR CONTENDED ENTER"); t->monitorEnter = 0; return; } t->monitorEnter = 0; unsigned long curTime = getMilliticks(); if (curTime < t->monitorEnterTime) return; int numFrames = 1; if (setup.mon.level == Setup::LEVEL_TRACE) numFrames = setup.mon.traceDepth; JVMPI_CallTrace callTrace; JVMPI_CallFrame callFrames[MAX_TRACE]; callTrace.env_id = event->env_id; callTrace.num_frames = (jint)numFrames; callTrace.frames = callFrames; jvmpiInterface->GetCallTrace(&callTrace, (jint)numFrames); numFrames = callTrace.num_frames; if (numFrames == 0) { PROF_ERROR("MONITOR CONTENDED ENTERED", "GetCallTrace failed"); return; } MonStatData* stat; if (setup.mon.threadsEnabled) { if (setup.mon.level == Setup::LEVEL_METHOD) { if (!(stat = getMonThreadMethod(event->env_id, callFrames[0].method_id))) { PROF_ERROR("MONITOR CONTENDED ENTERED", "Cannot get MonThreadMethod"); return; } } else { if (!(stat = getMonThreadTrace(event->env_id, numFrames, callFrames))) { PROF_ERROR("MONITOR CONTENDED ENTERED", "Cannot get MonThreadTrace"); return; } } } else { if (setup.mon.level == Setup::LEVEL_METHOD) { if (!(stat = getMethod(callFrames[0].method_id))) { PROF_ERROR("MONITOR CONTENDED ENTERED", "Method not found"); return; } } else { if (!(stat = getMonTrace(numFrames, callFrames))) { PROF_ERROR("MONITOR CONTENDED ENTERED", "Cannot get MonTrace"); return; } } } int hits = (stat->wait) ? 0 : 1; stat->addMonStat(hits, curTime - t->monitorEnterTime); } void Prof::event_monitorWaited( JVMPI_Event* event) { Synchronized sync(dataLock); // cerr << "MONITOR WAITED: " << (long)(event->env_id) << endl; Thread* t; if (!(t = getThread(event->env_id))) { PROF_ERROR("MONITOR WAITED", "Thread not found"); return; } int numFrames = 1; if (setup.mon.level == Setup::LEVEL_TRACE) numFrames = setup.mon.traceDepth; JVMPI_CallTrace callTrace; JVMPI_CallFrame callFrames[MAX_TRACE]; callTrace.env_id = event->env_id; callTrace.num_frames = (jint)numFrames; callTrace.frames = callFrames; jvmpiInterface->GetCallTrace(&callTrace, (jint)numFrames); numFrames = callTrace.num_frames; if (numFrames == 0) { PROF_ERROR("MONITOR WAITED", "GetCallTrace failed"); return; } MonStatData* stat; if (setup.mon.threadsEnabled) { if (setup.mon.level == Setup::LEVEL_METHOD) { if (!(stat = getMonThreadMethod(event->env_id, callFrames[0].method_id))) { PROF_ERROR("MONITOR WAITED", "Cannot get MonThreadMethod"); return; } } else { if (!(stat = getMonThreadTrace(event->env_id, numFrames, callFrames))) { PROF_ERROR("MONITOR WAITED", "Cannot get MonThreadTrace"); return; } } } else { if (setup.mon.level == Setup::LEVEL_METHOD) { if (!(stat = getMethod(callFrames[0].method_id))) { PROF_ERROR("MONITOR WAITED", "Method not found"); return; } } else { if (!(stat = getMonTrace(numFrames, callFrames))) { PROF_ERROR("MONITOR WAITED", "Cannot get MonTrace"); return; } } } stat->wait = 1; stat->addMonStat(1, event->u.monitor_wait.timeout); } Index: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/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/08/24 17:54:04 1.3 *************** *** 38,39 **** --- 38,43 ---- 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 Index: dir.info =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/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/08/24 17:54:04 1.5 *************** *** 1,4 **** FILES = prof prof_arena prof_class prof_gc prof_get prof_jniref prof_jvm \ ! prof_method 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 CLEAN_FILES = *.pdb *.obj *.o Index: prof.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -r1.21 -r1.22 *** prof.cpp 2001/08/23 23:57:31 1.21 --- prof.cpp 2001/08/24 17:54:04 1.22 *************** *** 36,45 **** tF( 19, JVMPI_EVENT_METHOD_ENTRY2, NULL); tF( 20, JVMPI_EVENT_METHOD_EXIT, &Prof::event_methodExit); ! tF( 21, JVMPI_EVENT_MONITOR_CONTENDED_ENTER, NULL); ! tF( 22, JVMPI_EVENT_MONITOR_CONTENDED_ENTERED, NULL); tF( 23, JVMPI_EVENT_MONITOR_CONTENDED_EXIT, NULL); tF( 24, JVMPI_EVENT_MONITOR_DUMP, NULL); tF( 25, JVMPI_EVENT_MONITOR_WAIT, NULL); ! tF( 26, JVMPI_EVENT_MONITOR_WAITED, NULL); tF( 27, JVMPI_EVENT_OBJECT_ALLOC, &Prof::event_objectAlloc); tF( 28, JVMPI_EVENT_OBJECT_DUMP, NULL); --- 36,45 ---- tF( 19, JVMPI_EVENT_METHOD_ENTRY2, NULL); tF( 20, JVMPI_EVENT_METHOD_EXIT, &Prof::event_methodExit); ! tF( 21, JVMPI_EVENT_MONITOR_CONTENDED_ENTER, &Prof::event_monitorContendedEnter); ! tF( 22, JVMPI_EVENT_MONITOR_CONTENDED_ENTERED, &Prof::event_monitorContendedEntered); tF( 23, JVMPI_EVENT_MONITOR_CONTENDED_EXIT, NULL); tF( 24, JVMPI_EVENT_MONITOR_DUMP, NULL); tF( 25, JVMPI_EVENT_MONITOR_WAIT, NULL); ! tF( 26, JVMPI_EVENT_MONITOR_WAITED, &Prof::event_monitorWaited); tF( 27, JVMPI_EVENT_OBJECT_ALLOC, &Prof::event_objectAlloc); tF( 28, JVMPI_EVENT_OBJECT_DUMP, NULL); *************** *** 78,81 **** --- 78,97 ---- prof().shutdownLock.wait(); while( !communThreadEnd) prof().run(); + } + + unsigned long Prof::getMilliticks() { + + #ifdef WIN32 + + return timeGetTime(); + + #else + + struct timeval tv; + + gettimeofday(&tv, NULL); + return (((unsigned long)tv.tv_sec * (unsigned long)1000) + ((unsigned long)tv.tv_usec / (unsigned long)1000)); + + #endif } Index: prof.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof.h,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -r1.31 -r1.32 *** prof.h 2001/08/23 23:57:31 1.31 --- prof.h 2001/08/24 17:54:04 1.32 *************** *** 138,141 **** --- 138,150 ---- Hash<CpuThreadTrace,CpuThreadTraceKey,LI1> activeCpuThreadTraces; + /// hash table of active MonTraces + Hash<MonTrace,TraceKey,LI1> activeMonTraces; + + /// hash table of active MonThreadMethods + Hash<MonThreadMethod,MonThreadMethodKey,LI1> activeMonThreadMethods; + + /// hash table of active MonThreadTraces + Hash<MonThreadTrace,MonThreadTraceKey,LI1> activeMonThreadTraces; + public: *************** *** 366,369 **** --- 375,418 ---- CpuThreadTrace* getCpuThreadTrace(JNIEnv* envId, int numFrames, JVMPI_CallFrame* frames, int create = 1); + /** Returns corresponding MonTrace object. + ** If none exists and the 'create' flag is set to 1 + ** the function attempts to construct one. + ** If unsuccessful in either case the NULL is returned. + ** + ** @param numFrames number of call frames + ** @param frames array of call frames + ** @param create creation flag + ** + ** @return pointer to MonTrace object or NULL */ + + MonTrace* getMonTrace(int numFrames, JVMPI_CallFrame* frames, int create = 1); + + /** Returns corresponding MonThreadMethod object. + ** If none exists and the 'create' flag is set to 1 + ** the function attempts to construct one. + ** If unsuccessful in either case the NULL is returned. + ** + ** @param envId thread ID + ** @param methodId method ID + ** @param create creation flag + ** + ** @return pointer to MonThreadMethod object or NULL */ + + MonThreadMethod* getMonThreadMethod(JNIEnv* envId, jmethodID methodId, int create = 1); + + /** Returns corresponding MonThreadTrace object. + ** If none exists and the 'create' flag is set to 1 + ** the function attempts to construct one. + ** If unsuccessful in either case the NULL is returned. + ** + ** @param envId thread ID + ** @param numFrames number of call frames + ** @param frames array of call frames + ** @param create creation flag + ** + ** @return pointer to MonThreadTrace object or NULL */ + + MonThreadTrace* getMonThreadTrace(JNIEnv* envId, int numFrames, JVMPI_CallFrame* frames, int create = 1); + private: *************** *** 532,535 **** --- 581,632 ---- void event_methodExit ( JVMPI_Event* event); + /** Monitor contended enter. + ** This method is a JVMPI_EVENT_MONITOR_CONTENDED_ENTER + ** event handler. This event is sent when a thread is + ** attemping to enter a Java monitor already acquired + ** by another thread. + ** It is issued with GC disabled. GC is re-enabled after + ** this method returns. + ** Here only the current time before the thread starts + ** waiting on the monitor is recorded. + ** + ** @param event JVMPI_Event structure describing the event + ** + ** @see runEvent(), JVMPI specification */ + + void event_monitorContendedEnter( JVMPI_Event* event); + + /** Monitor contended entered. + ** This method is a JVMPI_EVENT_MONITOR_CONTENDED_ENTERED + ** event handler. This event is sent when a thread enters + ** a Java monitor after waiting for it to be released by + ** another thread. + ** It is issued with GC disabled. GC is re-enabled after + ** this method returns. + ** Here the total time the thread spent by waiting + ** on the monitor is determined and recorded to + ** appriate structures. + ** + ** @param event JVMPI_Event structure describing the event + ** + ** @see runEvent(), JVMPI specification */ + + void event_monitorContendedEntered( JVMPI_Event* event); + + /** Monitor waited. + ** This method is a JVMPI_EVENT_MONITOR_WAITED + ** event handler. This event is sent when a thread + ** finishes waiting on an object. + ** It is issued with GC disabled. GC is re-enabled after + ** this method returns. + ** Here the total time the thread has waited is recored + ** to appropriate structures. + ** + ** @param event JVMPI_Event structure describing the event + ** + ** @see runEvent(), JVMPI specification */ + + void event_monitorWaited( JVMPI_Event* event); + /** Object alloc. This method is a JVMPI_EVENT_OBJECT_ALLOC ** event handler. This event is sent when an object is allocated. *************** *** 819,822 **** --- 916,925 ---- public: + + /** Gets current milliticks. + ** + ** @return ticks in milliseconds */ + + unsigned long getMilliticks(); /** Dumps error. Index: prof_get.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_get.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** prof_get.cpp 2001/08/04 13:53:37 1.5 --- prof_get.cpp 2001/08/24 17:54:04 1.6 *************** *** 397,399 **** --- 397,492 ---- } + MonTrace* Prof::getMonTrace(int numFrames, JVMPI_CallFrame* frames, int create) { + + TraceKey key; + MonTrace* trace; + + key.numFrames = numFrames; + key.frames = frames; + + if (trace = activeMonTraces.get(key)) return trace; + if (!create) return NULL; + + TraceFrame* traceFrames = TraceFrame::newArray(numFrames); + Method *method; + + for (int i = 0; i < numFrames; i++) { + if (!(method = getMethod(frames[i].method_id))) { + TraceFrame::deleteArray(traceFrames, numFrames); + return NULL; + } + traceFrames[i].method = method; + traceFrames[i].lineno = frames[i].lineno; + } + + trace = new MonTrace; + + trace->method = traceFrames[0].method; + trace->numFrames = numFrames; + trace->frames = traceFrames; + + activeMonTraces.add(trace); + trace->method->monTraces.add(trace); + + return trace; + } + + MonThreadMethod* Prof::getMonThreadMethod(JNIEnv* envId, jmethodID methodId, int create) { + + MonThreadMethodKey key; + MonThreadMethod* threadMethod; + + key.envId = envId; + key.methodId = methodId; + + if (threadMethod = activeMonThreadMethods.get(key)) return threadMethod; + if (!create) return NULL; + + Method* method; + Thread* thread; + + if (!(method = getMethod(methodId))) return NULL; + if (!(thread = getThread(envId))) return NULL; + + threadMethod = new MonThreadMethod; + + threadMethod->method = method; + threadMethod->thread = thread; + + activeMonThreadMethods.add(threadMethod); + method->monThreadMethods.add(threadMethod); + thread->monThreadMethods.add(threadMethod); + + return threadMethod; + } + + MonThreadTrace* Prof::getMonThreadTrace(JNIEnv* envId, int numFrames, JVMPI_CallFrame* frames, int create) { + + MonThreadTraceKey key; + MonThreadTrace* threadTrace; + + key.envId = envId; + key.traceKey.numFrames = numFrames; + key.traceKey.frames = frames; + + if (threadTrace = activeMonThreadTraces.get(key)) return threadTrace; + if (!create) return NULL; + + MonThreadMethod* threadMethod; + MonTrace* trace; + + if (!(threadMethod = getMonThreadMethod(envId, frames[0].method_id))) return NULL; + if (!(trace = getMonTrace(numFrames, frames))) return NULL; + + threadTrace = new MonThreadTrace; + + threadTrace->threadMethod = threadMethod; + threadTrace->trace = trace; + + activeMonThreadTraces.add(threadTrace); + threadMethod->threadTraces.add(threadTrace); + trace->threadTraces.add(threadTrace); + + return threadTrace; + } Index: prof_jvm.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_jvm.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** prof_jvm.cpp 2001/08/23 23:57:31 1.18 --- prof_jvm.cpp 2001/08/24 17:54:04 1.19 *************** *** 198,201 **** --- 198,204 ---- long totalCpuThreadMethods = 0; long totalCpuThreadTraces = 0; + long totalMonTraces = 0; + long totalMonThreadMethods = 0; + long totalMonThreadTraces = 0; Class* c = _prof->classes.first(); *************** *** 219,222 **** --- 222,232 ---- } + MonTrace* mt = m->monTraces.first(); + while (mt) { + + totalMonTraces++; + mt = m->monTraces.next(mt); + } + totalMethods++; m = c->methods.next(m); *************** *** 300,303 **** --- 310,327 ---- } + MonThreadMethod* mtm = t->monThreadMethods.first(); + while (mtm) { + + MonThreadTrace* mtt = mtm->threadTraces.first(); + while (mtt) { + + totalMonThreadTraces++; + mtt = mtm->threadTraces.next(mtt); + } + + totalMonThreadMethods++; + mtm = t->monThreadMethods.next(mtm); + } + totalThreads++; t = _prof->threads.next(t); *************** *** 332,335 **** --- 356,366 ---- cout << "CpuTrace: " << totalCpuTraces << endl; cout << "CpuThreadTrace: " << totalCpuThreadTraces << endl; + cout << endl; + + cout << "MonThreadMethod: " << totalMonThreadMethods << endl; + cout << endl; + + cout << "MonTrace: " << totalMonTraces << endl; + cout << "MonThreadTrace: " << totalMonThreadTraces << endl; cout << endl; } |
From: Petr L. <lu...@us...> - 2001-08-24 17:54:08
|
Update of /cvsroot/javaprofiler/library/src/cpu In directory usw-pr-cvs1:/tmp/cvs-serv4667/cpu Modified Files: cpuStatData.cpp cpuStatData.h cpuThreadMethod.cpp cpuThreadMethod.h cpuThreadTrace.cpp cpuThreadTrace.h cpuTrace.cpp cpuTrace.h sampling.cpp sampling.h Log Message: Monitor profiling Index: cpuStatData.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/cpuStatData.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** cpuStatData.cpp 2001/07/30 23:18:01 1.3 --- cpuStatData.cpp 2001/08/24 17:54:04 1.4 *************** *** 1,8 **** #include "../main/includes.h" ! void CpuStatData::addCpuStat(jlong hits_, jlong pure_Time) { ! this->hits += hits_; ! this->pureTime += pure_Time; setDataChanged(); --- 1,8 ---- #include "../main/includes.h" ! void CpuStatData::addCpuStat(jlong addHits, jlong addPureTime) { ! hits += addHits; ! pureTime += addPureTime; setDataChanged(); Index: cpuStatData.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/cpuStatData.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** cpuStatData.h 2001/07/30 23:18:01 1.4 --- cpuStatData.h 2001/08/24 17:54:04 1.5 *************** *** 34,41 **** /** Updates statistics. ** ! ** @param hits number of hits to be added ! ** @param pureTime pure time to be added */ ! virtual void addCpuStat(jlong hits, jlong pureTime); /** Converts statistics data to a binary format used --- 34,41 ---- /** 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 Index: cpuThreadMethod.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/cpuThreadMethod.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** cpuThreadMethod.cpp 2001/07/28 04:11:17 1.4 --- cpuThreadMethod.cpp 2001/08/24 17:54:04 1.5 *************** *** 3,10 **** Allocator CpuThreadMethod::_allocator( sizeof( CpuThreadMethod)); ! void CpuThreadMethod::addCpuStat(jlong hits_, jlong pure_Time) { ! CpuStatData::addCpuStat(hits_, pure_Time); ! method->addCpuStat(hits_, pure_Time); } --- 3,10 ---- Allocator CpuThreadMethod::_allocator( sizeof( CpuThreadMethod)); ! void CpuThreadMethod::addCpuStat(jlong addHits, jlong addPureTime) { ! CpuStatData::addCpuStat(addHits, addPureTime); ! method->addCpuStat(addHits, addPureTime); } Index: cpuThreadMethod.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/cpuThreadMethod.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** cpuThreadMethod.h 2001/08/05 01:37:10 1.7 --- cpuThreadMethod.h 2001/08/24 17:54:04 1.8 *************** *** 53,60 **** ** Also updates CPU statistics of corresponding method. ** ! ** @param hits number of hits to be added ! ** @param pureTime pure time to be added */ ! virtual void addCpuStat(jlong hits, jlong pureTime); /** Retrieves object's key. --- 53,60 ---- ** 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. Index: cpuThreadTrace.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/cpuThreadTrace.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** cpuThreadTrace.cpp 2001/07/28 04:11:17 1.4 --- cpuThreadTrace.cpp 2001/08/24 17:54:04 1.5 *************** *** 3,11 **** Allocator CpuThreadTrace::_allocator( sizeof( CpuThreadTrace)); ! void CpuThreadTrace::addCpuStat(jlong hits_, jlong pure_Time) { ! CpuStatData::addCpuStat(hits_, pure_Time); ! threadMethod->addCpuStat(hits_, pure_Time); ! trace->addCpuStat(hits_, pure_Time); } --- 3,11 ---- Allocator CpuThreadTrace::_allocator( sizeof( CpuThreadTrace)); ! void CpuThreadTrace::addCpuStat(jlong addHits, jlong addPureTime) { ! CpuStatData::addCpuStat(addHits, addPureTime); ! threadMethod->addCpuStat(addHits, addPureTime); ! trace->addCpuStat(addHits, addPureTime); } Index: cpuThreadTrace.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/cpuThreadTrace.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** cpuThreadTrace.h 2001/08/05 01:37:10 1.7 --- cpuThreadTrace.h 2001/08/24 17:54:04 1.8 *************** *** 51,58 **** ** and CpuThreadMethod. ** ! ** @param hits number of hits to be added ! ** @param pureTime pure time to be added */ ! virtual void addCpuStat(jlong hits, jlong pureTime); /** Retrieves object's key. --- 51,58 ---- ** 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. Index: cpuTrace.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/cpuTrace.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** cpuTrace.cpp 2001/07/28 04:11:17 1.4 --- cpuTrace.cpp 2001/08/24 17:54:04 1.5 *************** *** 3,10 **** Allocator CpuTrace::_allocator( sizeof( CpuTrace)); ! void CpuTrace::addCpuStat(jlong hits_, jlong pure_Time) { ! CpuStatData::addCpuStat(hits_, pure_Time); ! method->addCpuStat(hits_, pure_Time); } --- 3,10 ---- Allocator CpuTrace::_allocator( sizeof( CpuTrace)); ! void CpuTrace::addCpuStat(jlong addHits, jlong addPureTime) { ! CpuStatData::addCpuStat(addHits, addPureTime); ! method->addCpuStat(addHits, addPureTime); } Index: cpuTrace.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/cpuTrace.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** cpuTrace.h 2001/08/05 01:37:10 1.7 --- cpuTrace.h 2001/08/24 17:54:04 1.8 *************** *** 35,42 **** ** Also updates CPU statistics of corresponding method. ** ! ** @param hits number of hits to be added ! ** @param pureTime pure time to be added */ ! virtual void addCpuStat(jlong hits, jlong pureTime); /** Performs deactivation. */ --- 35,42 ---- ** 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); /** Performs deactivation. */ Index: sampling.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/sampling.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** sampling.cpp 2001/08/23 23:57:31 1.5 --- sampling.cpp 2001/08/24 17:54:04 1.6 *************** *** 41,45 **** #ifdef _DEBUG ! start = getMilliticks(); #endif --- 41,45 ---- #ifdef _DEBUG ! start = _prof->getMilliticks(); #endif *************** *** 72,78 **** } ! startTime = getMilliticks(); doOneSample(); ! endTime = getMilliticks(); #ifdef _DEBUG --- 72,78 ---- } ! startTime = _prof->getMilliticks(); doOneSample(); ! endTime = _prof->getMilliticks(); #ifdef _DEBUG *************** *** 203,222 **** pthread_mutex_unlock(&_mutex); - - #endif - } - - unsigned long Sampling::getMilliticks() { - - #ifdef WIN32 - - return timeGetTime(); - - #else - - struct timeval tv; - - gettimeofday(&tv, NULL); - return (((unsigned long)tv.tv_sec * (unsigned long)1000) + ((unsigned long)tv.tv_usec / (unsigned long)1000)); #endif --- 203,206 ---- Index: sampling.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/sampling.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** sampling.h 2001/08/23 23:57:31 1.5 --- sampling.h 2001/08/24 17:54:04 1.6 *************** *** 47,56 **** void doOneSample(); - /** Gets current milliticks. - ** - ** @return ticks in milliseconds */ - - unsigned long getMilliticks(); - public: --- 47,50 ---- |
From: Petr L. <lu...@us...> - 2001-08-24 17:54:08
|
Update of /cvsroot/javaprofiler/library/src/main In directory usw-pr-cvs1:/tmp/cvs-serv4667/main Modified Files: includes.h main.cpp Log Message: Monitor profiling Index: includes.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/main/includes.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -r1.21 -r1.22 *** includes.h 2001/08/23 23:57:31 1.21 --- includes.h 2001/08/24 17:54:04 1.22 *************** *** 55,58 **** --- 55,65 ---- class CpuThreadTrace; + struct MonThreadMethodKey; + struct MonThreadTraceKey; + + class MonTrace; + class MonThreadMethod; + class MonThreadTrace; + class AllocInstance; *************** *** 90,93 **** --- 97,101 ---- #include "../alloc/allocAbstractStatThreadObject.h" #include "../cpu/cpuStatData.h" + #include "../mon/monStatData.h" #include "../cpu/cpuStack.h" *************** *** 115,118 **** --- 123,130 ---- #include "../cpu/cpuThreadMethod.h" #include "../cpu/cpuThreadTrace.h" + + #include "../mon/monTrace.h" + #include "../mon/monThreadMethod.h" + #include "../mon/monThreadTrace.h" #include "../alloc/allocArena.h" Index: main.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/main/main.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** main.cpp 2001/08/09 23:22:55 1.20 --- main.cpp 2001/08/24 17:54:04 1.21 *************** *** 97,106 **** } ! // 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); --- 97,109 ---- } ! if( _prof->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); |
From: Petr L. <lu...@us...> - 2001-08-24 17:54:08
|
Update of /cvsroot/javaprofiler/library/src/alloc In directory usw-pr-cvs1:/tmp/cvs-serv4667/alloc Modified Files: allocTrace.h Log Message: Monitor profiling Index: allocTrace.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocTrace.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** allocTrace.h 2001/08/05 01:37:10 1.16 --- allocTrace.h 2001/08/24 17:54:04 1.17 *************** *** 5,9 **** ** a descendant of Trace class. It is used in memory ** profiling. We decided to use different traces ! ** for memory and for cpu profiling, because it should ** be an option to have different granularity of traces ** (their trace frame stack depth) for each type of profiling. --- 5,9 ---- ** a descendant of Trace class. It is used in memory ** profiling. We decided to use different traces ! ** for memory, cpu and monitor profiling, because it should ** be an option to have different granularity of traces ** (their trace frame stack depth) for each type of profiling. |
From: Petr L. <lu...@us...> - 2001-08-24 17:54:07
|
Update of /cvsroot/javaprofiler/library/src In directory usw-pr-cvs1:/tmp/cvs-serv4667 Modified Files: Makefile.rules dir.info Log Message: Monitor profiling Index: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/src/Makefile.rules,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** Makefile.rules 2001/08/23 23:57:31 1.7 --- Makefile.rules 2001/08/24 17:54:04 1.8 *************** *** 143,146 **** --- 143,162 ---- $(MAKE) $(MFLAGS) main clean + mon.dir: + cd mon + $(MAKE) $(MFLAGS) + cd .. + + mon.dir.2: + $(MAKE) $(MFLAGS) mon + + mon.clean: + cd mon + $(MAKE) $(MFLAGS) clean + cd .. + + mon.clean.2: + $(MAKE) $(MFLAGS) mon clean + prof.dir: cd prof Index: dir.info =================================================================== RCS file: /cvsroot/javaprofiler/library/src/dir.info,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** dir.info 2001/08/23 23:57:31 1.12 --- dir.info 2001/08/24 17:54:04 1.13 *************** *** 1,3 **** ! DIRS = profiler alloc allocator commun commun2 commun3 cpu delay gc main \ prof setup shared string --- 1,3 ---- ! DIRS = profiler alloc allocator commun commun2 commun3 cpu delay gc main mon \ prof setup shared string *************** *** 5,8 **** OBJ_FILES = profiler/*.o* alloc/*.o* allocator/*.o* commun/*.o* commun2/*.o* \ ! commun3/*.o* cpu/*.o* delay/*.o* gc/*.o* main/*.o* prof/*.o* \ setup/*.o* shared/*.o* string/*.o* --- 5,8 ---- 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* |
From: Petr L. <lu...@us...> - 2001-08-24 17:46:33
|
Update of /cvsroot/javaprofiler/library/src/mon In directory usw-pr-cvs1:/tmp/cvs-serv3020/mon Log Message: Directory /cvsroot/javaprofiler/library/src/mon added to the repository |
From: Marek P. <ma...@us...> - 2001-08-23 23:57:35
|
Update of /cvsroot/javaprofiler/library/src/commun3 In directory usw-pr-cvs1:/tmp/cvs-serv1062/src/commun3 Modified Files: communShMem.cpp communShMem.h semaphore.h Log Message: shared memory implementation; java client and dynamic library can now communicate thru sockets or shmem; main README completely rewritten; new classes - for shared memory, semaphores etc.; java native class CommunShMem implementation Index: communShMem.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun3/communShMem.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** communShMem.cpp 2001/08/12 07:35:31 1.2 --- communShMem.cpp 2001/08/23 23:57:31 1.3 *************** *** 3,12 **** Commun& CommunShMem::operator>>( Buffer& b) { - _sem1.wait(); - void* p = _shmem.getAddress(); int shmemSize = _shmem.getSize(); jint size = ntohl( *(jint*)p); if( size) { --- 3,21 ---- Commun& CommunShMem::operator>>( Buffer& b) { void* p = _shmem.getAddress(); int shmemSize = _shmem.getSize(); + _isem.wait(); + jint size = ntohl( *(jint*)p); + if( size < 0) { + + _failed = 1; + _isem.release(); + + return *this; + } + + _isem.release(); if( size) { *************** *** 34,37 **** --- 43,48 ---- } + _sem2.release(); + b = Buffer( buf, size); *************** *** 48,51 **** --- 59,74 ---- int shmemSize = _shmem.getSize(); + _isem.wait(); + + if( ntohl( *(jint*)p) < 0) { + + _failed = 1; + _isem.release(); + + return *this; + } + + _isem.release(); + jint size = b.getSize(); *(jint*)p = htonl( size); *************** *** 80,82 **** --- 103,132 ---- return *this; + } + + int CommunShMem::isReady() { + + _isem.wait(); + _failed = ( *(jint*)_shmem.getAddress() < 0); + _isem.release(); + + if( _failed) return 0; + + int rc = _sem1.waitNoBlock(); + if( _failed = (rc < 0)) return 0; + + return rc; + } + + int CommunShMem::initialize() { + + _isem.wait(); + *(jint*)_shmem.getAddress() = htonl( 0); + _failed = 0; + _isem.release(); + + _sem1.wait(); + _sem1.release(); + + return 1; } Index: communShMem.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun3/communShMem.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** communShMem.h 2001/08/12 07:35:31 1.2 --- communShMem.h 2001/08/23 23:57:31 1.3 *************** *** 14,17 **** --- 14,19 ---- class CommunShMem: public Commun { + private: + /// read-write semaphore Semaphore _sem1; *************** *** 20,23 **** --- 22,28 ---- Semaphore _sem2; + /// init semaphore + Semaphore _isem; + /// shared memory SharedMemory _shmem; *************** *** 36,43 **** _sem1( String( "1") + shmemId + "XXXXXXXXXX"), _sem2( String( "2") + shmemId + "XXXXXXXXXX"), ! _shmem( String( "3") + shmemId + "XXXXXXXXXX", size) ! {}; /** Read data. This operator is used to read data ** from communication channel (shmem) to buffer. --- 41,80 ---- _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 + ** for first unlocking of the semaphore used during communication. + ** In this way it recognizes that communication has started. + ** + ** @return 0 (failed); + ** 1 (ok, initialized) */ + + virtual int initialize(); + /** Read data. This operator is used to read data ** from communication channel (shmem) to buffer. *************** *** 61,64 **** --- 98,110 ---- virtual Commun& operator<<( const Buffer& b); + + /** Communication channel ready for reading. This method + ** returns TRUE, if there are data in communication channel + ** and should be read from it. + ** + ** @return 0 (nothing); + ** 1 (data in channel) */ + + virtual int isReady(); }; Index: semaphore.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun3/semaphore.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** semaphore.h 2001/08/09 23:22:55 1.1 --- semaphore.h 2001/08/23 23:57:31 1.2 *************** *** 16,22 **** #endif - /// is semaphore locked or not ? - int _locked; - public: --- 16,19 ---- *************** *** 24,33 **** ** If semaphore doesn't exist, new one is created. ** ! ** @param name unique name (at least 8 bytes) */ ! Semaphore( const String& name) : _locked( 0) { #ifdef WIN32 ! _semid = CreateSemaphore( NULL, 0, 1, name); #else #error FIXME - not implemented yet !!! --- 21,31 ---- ** 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 #error FIXME - not implemented yet !!! *************** *** 38,43 **** ~Semaphore() { - if( _locked) release(); - #ifdef WIN32 CloseHandle( _semid); --- 36,39 ---- *************** *** 60,64 **** #error FIXME - not implemented yet !!! #endif - _locked = 1; } --- 56,59 ---- *************** *** 70,75 **** void release() { - _locked = 0; - #ifdef WIN32 ReleaseSemaphore( _semid, 1, NULL); --- 65,68 ---- *************** *** 77,80 **** --- 70,94 ---- #error FIXME - not implemented yet !!! #endif + } + + /** Lock semaphore but don't block. This method locks semaphore + ** if it is possible, if not, it returns immediatelly without locking. + ** + ** @return 0 (failed, already locked); + ** 1 (okay, successfully locked); + ** -1 (failure) */ + + int waitNoBlock() { + + #ifdef WIN32 + unsigned long rc = WaitForSingleObject( _semid, 0); + + if( rc == WAIT_FAILED) return -1; + if( rc == WAIT_TIMEOUT) return 0; + #else + #error FIXME - not implemented yet !!! + #endif + + return 1; } }; |