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...> - 2002-04-16 12:41:38
|
Update of /cvsroot/javaprofiler/library/src/prof In directory usw-pr-cvs1:/tmp/cvs-serv22574/src/prof Modified Files: prof_get.cpp prof_jvm.cpp Log Message: win32 fixes Index: prof_get.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_get.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** prof_get.cpp 15 Apr 2002 21:04:18 -0000 1.11 --- prof_get.cpp 16 Apr 2002 12:41:35 -0000 1.12 *************** *** 545,549 **** --- 545,553 ---- char buf[50]; + #ifndef WIN32 snprintf( buf, sizeof( buf), "unknown_%d", num++); + #else + _snprintf( buf, sizeof( buf), "unknown_%d", num++); + #endif #ifdef EXPERIMENTAL *************** *** 596,600 **** --- 600,608 ---- char buf[50]; + #ifndef WIN32 snprintf( buf, sizeof( buf), "Unknown_%d", num++); + #else + _snprintf( buf, sizeof( buf), "Unknown_%d", num++); + #endif JVMPI_Event event; Index: prof_jvm.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_jvm.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -r1.28 -r1.29 *** prof_jvm.cpp 8 Apr 2002 23:30:01 -0000 1.28 --- prof_jvm.cpp 16 Apr 2002 12:41:35 -0000 1.29 *************** *** 217,222 **** cout << "AllocObject - ID = " << o->getProfID() << " (" << o << ")" << endl; ! cout << "numInstancesTotal = " << o->allocNumInstancesTotal << endl; ! cout << "numInstancesLive = " << o->allocNumInstancesLive << endl; o->objectMethods.forEach( printAllObjectMethods, NULL); cout << endl; --- 217,222 ---- cout << "AllocObject - ID = " << o->getProfID() << " (" << o << ")" << endl; ! cout << "numInstancesTotal = " << (int)o->allocNumInstancesTotal << endl; ! cout << "numInstancesLive = " << (int)o->allocNumInstancesLive << endl; o->objectMethods.forEach( printAllObjectMethods, NULL); cout << endl; |
From: Marek P. <ma...@us...> - 2002-04-16 12:41:38
|
Update of /cvsroot/javaprofiler/library In directory usw-pr-cvs1:/tmp/cvs-serv22574 Modified Files: config.mk Log Message: win32 fixes Index: config.mk =================================================================== RCS file: /cvsroot/javaprofiler/library/config.mk,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -r1.37 -r1.38 *** config.mk 15 Apr 2002 21:04:14 -0000 1.37 --- config.mk 16 Apr 2002 12:41:35 -0000 1.38 *************** *** 1,12 **** ################################################################ # configuration file ! # Linux, x86, GNU C/C++ 3.0.2 # # author: Marek Przeczek ! PROF_LIBRARY_NAME = profiler/libprofiler.so PROF_JAVA_INTERF_PACKAGE = IProf.jar ! NATIVE_LIBRARY_NAME = libCommunShMem.so ################################################################ --- 1,12 ---- ################################################################ # configuration file ! # Microsoft Windows 9x/NT4.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 ################################################################ *************** *** 15,28 **** # do not use "\" as a last character in path definition ! COMPILER_PATH = /home2/mm/gcc-3.0.2 ! JAVA_PATH = /home2/mm/j2sdk1.4.0 ! DOXYGEN_PATH = /home2/mm ! ! CCC = "$(COMPILER_PATH)/bin/g++" ! LD = "$(COMPILER_PATH)/bin/g++" ! JAVAC = "$(JAVA_PATH)/bin/javac" ! JAVAH = "$(JAVA_PATH)/bin/javah" ! JAR = "$(JAVA_PATH)/bin/jar" ! DOXYGEN = "$(DOXYGEN_PATH)/bin/doxygen" ################################################################ --- 15,28 ---- # do not use "\" as a last character in path definition ! COMPILER_PATH = C:\Program Files\Microsoft Visual Studio\VC98 ! JAVA_PATH = C:\j2sdk1.4.0 ! DOXYGEN_PATH = C:\Program Files\doxygen-1.2.12 ! ! 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" ! DOXYGEN = "$(DOXYGEN_PATH)\bin\doxygen" ################################################################ *************** *** 31,35 **** DOXYGENFLAGS = ! JAVACFLAGS = -classpath ../../src2/$(PROF_JAVA_INTERF_PACKAGE) ################################################################ --- 31,35 ---- DOXYGENFLAGS = ! JAVACFLAGS = -classpath ..\..\src2\$(PROF_JAVA_INTERF_PACKAGE) ################################################################ *************** *** 37,68 **** # modify as needed ! DEFINES = -DLINUX -DUSE_RAW_MONITORS -DUSE_ALLOCATOR -DEXPERIMENTAL -fpic ! INCLUDES = -I$(JAVA_PATH)/include -I$(JAVA_PATH)/include/linux # debug or not ? # choose one of following two possibilities ! FLAGS = -O0 -D_DEBUG ! #FLAGS = -O3 -DNDEBUG -fno-rtti -fno-exceptions ! LDFLAGS = $(DEFINES) -shared -o $(PROF_LIBRARY_NAME) ! LDLIBS = ! LDFLAGS2 = $(DEFINES) -shared -o $(NATIVE_LIBRARY_NAME) LDLIBS2 = ! CPPFLAGS = -c $(FLAGS) $(DEFINES) $(INCLUDES) ################################################################ # MAKEFILE ! MFLAGS = -f Makefile -C include dir.info ! all: $(addsuffix .dir.2, $(DIRS)) $(addsuffix .o, $(FILES)) ! ! clean: $(addsuffix .clean.2, $(DIRS)) ! rm -Rf $(CLEAN_FILES) ! --- 37,70 ---- # modify as needed ! DEFINES = /DWIN32 /DUSE_RAW_MONITORS /DUSE_ALLOCATOR /DEXPERIMENTAL ! 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 = ! 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 |
From: Marek P. <ma...@us...> - 2002-04-15 21:08:10
|
Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/commun In directory usw-pr-cvs1:/tmp/cvs-serv19732/net/sourceforge/javaprofiler/jpiimpl/commun Modified Files: IProf.java Added Files: INTERFACE_VERSION_MISMATCH_Exception.java Log Message: fixes --- NEW FILE: INTERFACE_VERSION_MISMATCH_Exception.java --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ package net.sourceforge.javaprofiler.jpiimpl.commun; /** Interface version mismatch exception. This exception is raised when ** versions of communication interface on server and client sides differ. ** ** @author Marek Przeczek */ public class INTERFACE_VERSION_MISMATCH_Exception extends IProfException {}; Index: IProf.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/commun/IProf.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** IProf.java 4 Apr 2002 00:48:01 -0000 1.17 --- IProf.java 15 Apr 2002 21:01:05 -0000 1.18 *************** *** 38,41 **** --- 38,44 ---- import java.lang.*; + /* PLEASE DO NOT FORGET TO INCREASE 'INTERFACE_VERSION_NUMBER' + * CONSTANT OF THIS CLASS WHEN YOU DO SOME ANY CHANGES IN THE INTERFACE. */ + /** Communication interface class. This class implements ** the whole communication interface between Java client *************** *** 51,54 **** --- 54,60 ---- public class IProf { + /// version number of communication interface + private static final int INTERFACE_VERSION_NUMBER = 1; + /** Default constructor. Sockets are used ** for communication between his Java client and *************** *** 85,98 **** /** Start client/server communication. This method starts the ** client (or server, if specified). To stop the communication, ! ** stop() method must be called. ** ! ** @see stop() ! ** ! ** @return false (failure occurred); ! ** true (ok, communication started) */ ! public boolean run() { ! return !( _commun.hasFailed() || !_commun.initialize()); } --- 91,123 ---- /** Start client/server communication. This method starts the ** client (or server, if specified). To stop the communication, ! ** stop() method must be called. If failed, stop() method must ! ** be called, too !!! It can fail either because of communication ! ** problem or because of interface version mismatch. ** ! ** @see stop() */ ! public void run() ! ! throws COMMUN_Exception, ! INTERFACE_VERSION_MISMATCH_Exception { ! if( _commun.hasFailed() || !_commun.initialize()) ! ! throw new COMMUN_Exception(); ! ! _buf.clear(); ! _buf.putInt( INTERFACE_VERSION_NUMBER); ! ! _commun.write( _buf); ! if( _commun.hasFailed()) throw new COMMUN_Exception(); ! ! _commun.read( _buf); ! if( _commun.hasFailed()) throw new COMMUN_Exception(); ! ! int version = _buf.getInt( 0); ! ! if( version != INTERFACE_VERSION_NUMBER) ! ! throw new INTERFACE_VERSION_MISMATCH_Exception(); } |
From: Marek P. <ma...@us...> - 2002-04-15 21:04:52
|
Update of /cvsroot/javaprofiler/library/demo/02 In directory usw-pr-cvs1:/tmp/cvs-serv21227/demo/02 Modified Files: Test.java Log Message: serious bug fixes - monitors, deactivating... interface version checking added new test program for testing of memory profiling added Index: Test.java =================================================================== RCS file: /cvsroot/javaprofiler/library/demo/02/Test.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Test.java 3 Dec 2001 16:26:25 -0000 1.2 --- Test.java 15 Apr 2002 21:04:15 -0000 1.3 *************** *** 104,110 **** // sockets are used by default iprof = new IProf(); - iprof.run(); try { // til profiled program is going, do nothing --- 104,111 ---- // sockets are used by default iprof = new IProf(); try { + + iprof.run(); // til profiled program is going, do nothing |
From: Marek P. <ma...@us...> - 2002-04-15 21:04:49
|
Update of /cvsroot/javaprofiler/library/demo/01 In directory usw-pr-cvs1:/tmp/cvs-serv21227/demo/01 Modified Files: Test.java Log Message: serious bug fixes - monitors, deactivating... interface version checking added new test program for testing of memory profiling added Index: Test.java =================================================================== RCS file: /cvsroot/javaprofiler/library/demo/01/Test.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** Test.java 21 Nov 2001 22:31:52 -0000 1.4 --- Test.java 15 Apr 2002 21:04:15 -0000 1.5 *************** *** 102,108 **** // sockets are used by default iprof = new IProf(); - iprof.run(); try { // til profiled program is going, do nothing --- 102,109 ---- // sockets are used by default iprof = new IProf(); try { + + iprof.run(); // til profiled program is going, do nothing |
From: Marek P. <ma...@us...> - 2002-04-15 21:04:48
|
Update of /cvsroot/javaprofiler/library/config In directory usw-pr-cvs1:/tmp/cvs-serv21227/config Modified Files: config_sparc_sunos58_gcc302.mk config_x86_linux_gcc302.mk config_x86_win32_vc98.mk Log Message: serious bug fixes - monitors, deactivating... interface version checking added new test program for testing of memory profiling added Index: config_sparc_sunos58_gcc302.mk =================================================================== RCS file: /cvsroot/javaprofiler/library/config/config_sparc_sunos58_gcc302.mk,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** config_sparc_sunos58_gcc302.mk 31 Jan 2002 12:30:59 -0000 1.4 --- config_sparc_sunos58_gcc302.mk 15 Apr 2002 21:04:14 -0000 1.5 *************** *** 16,20 **** COMPILER_PATH = /opt/gcc-3.0.2 ! JAVA_PATH = /opt/j2sdk1.4.0-rc DOXYGEN_PATH = /opt/doxygen-1.2.12 --- 16,20 ---- COMPILER_PATH = /opt/gcc-3.0.2 ! JAVA_PATH = /opt/j2sdk1.4.0 DOXYGEN_PATH = /opt/doxygen-1.2.12 *************** *** 37,41 **** # modify as needed ! DEFINES = -DSUNOS -DUSE_RAW_MONITORS -DUSE_ALLOCATOR -fpic INCLUDES = -I$(JAVA_PATH)/include -I$(JAVA_PATH)/include/solaris --- 37,41 ---- # modify as needed ! DEFINES = -DSUNOS -DUSE_RAW_MONITORS -DUSE_ALLOCATOR -DEXPERIMENTAL -fpic INCLUDES = -I$(JAVA_PATH)/include -I$(JAVA_PATH)/include/solaris Index: config_x86_linux_gcc302.mk =================================================================== RCS file: /cvsroot/javaprofiler/library/config/config_x86_linux_gcc302.mk,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** config_x86_linux_gcc302.mk 31 Jan 2002 12:30:59 -0000 1.7 --- config_x86_linux_gcc302.mk 15 Apr 2002 21:04:14 -0000 1.8 *************** *** 16,20 **** COMPILER_PATH = /opt/gcc-3.0.2 ! JAVA_PATH = /opt/j2sdk1.4.0-rc DOXYGEN_PATH = /opt/doxygen-1.2.12 --- 16,20 ---- COMPILER_PATH = /opt/gcc-3.0.2 ! JAVA_PATH = /opt/j2sdk1.4.0 DOXYGEN_PATH = /opt/doxygen-1.2.12 *************** *** 37,41 **** # modify as needed ! DEFINES = -DLINUX -DUSE_RAW_MONITORS -DUSE_ALLOCATOR -fpic INCLUDES = -I$(JAVA_PATH)/include -I$(JAVA_PATH)/include/linux --- 37,41 ---- # modify as needed ! DEFINES = -DLINUX -DUSE_RAW_MONITORS -DUSE_ALLOCATOR -DEXPERIMENTAL -fpic INCLUDES = -I$(JAVA_PATH)/include -I$(JAVA_PATH)/include/linux Index: config_x86_win32_vc98.mk =================================================================== RCS file: /cvsroot/javaprofiler/library/config/config_x86_win32_vc98.mk,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** config_x86_win32_vc98.mk 26 Jan 2002 22:50:27 -0000 1.2 --- config_x86_win32_vc98.mk 15 Apr 2002 21:04:14 -0000 1.3 *************** *** 16,20 **** COMPILER_PATH = C:\Program Files\Microsoft Visual Studio\VC98 ! JAVA_PATH = C:\Program Files\j2sdk1.4.0-rc DOXYGEN_PATH = C:\Program Files\doxygen-1.2.12 --- 16,20 ---- COMPILER_PATH = C:\Program Files\Microsoft Visual Studio\VC98 ! JAVA_PATH = C:\Program Files\j2sdk1.4.0 DOXYGEN_PATH = C:\Program Files\doxygen-1.2.12 *************** *** 37,41 **** # modify as needed ! DEFINES = /DWIN32 /DUSE_RAW_MONITORS /DUSE_ALLOCATOR INCLUDES = /I "$(JAVA_PATH)\include" /I "$(JAVA_PATH)\include\win32" --- 37,41 ---- # modify as needed ! DEFINES = /DWIN32 /DUSE_RAW_MONITORS /DUSE_ALLOCATOR /DEXPERIMENTAL INCLUDES = /I "$(JAVA_PATH)\include" /I "$(JAVA_PATH)\include\win32" |
From: Marek P. <ma...@us...> - 2002-04-15 21:04:47
|
Update of /cvsroot/javaprofiler/library In directory usw-pr-cvs1:/tmp/cvs-serv21227 Modified Files: config.mk Log Message: serious bug fixes - monitors, deactivating... interface version checking added new test program for testing of memory profiling added Index: config.mk =================================================================== RCS file: /cvsroot/javaprofiler/library/config.mk,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -r1.36 -r1.37 *** config.mk 31 Jan 2002 12:30:59 -0000 1.36 --- config.mk 15 Apr 2002 21:04:14 -0000 1.37 *************** *** 37,41 **** # modify as needed ! DEFINES = -DLINUX -DUSE_RAW_MONITORS -DUSE_ALLOCATOR -fpic INCLUDES = -I$(JAVA_PATH)/include -I$(JAVA_PATH)/include/linux --- 37,41 ---- # modify as needed ! DEFINES = -DLINUX -DUSE_RAW_MONITORS -DUSE_ALLOCATOR -DEXPERIMENTAL -fpic INCLUDES = -I$(JAVA_PATH)/include -I$(JAVA_PATH)/include/linux |
From: Marek P. <ma...@us...> - 2002-04-15 21:04:28
|
Update of /cvsroot/javaprofiler/library/src/mon In directory usw-pr-cvs1:/tmp/cvs-serv21227/src/mon Modified Files: monThreadMethod.cpp monThreadTrace.cpp monTrace.cpp Log Message: serious bug fixes - monitors, deactivating... interface version checking added new test program for testing of memory profiling added Index: monThreadMethod.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/mon/monThreadMethod.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** monThreadMethod.cpp 8 Apr 2002 23:30:01 -0000 1.5 --- monThreadMethod.cpp 15 Apr 2002 21:04:18 -0000 1.6 *************** *** 61,70 **** void MonThreadMethod::deactivate() { ! Prof::prof().activeMonThreadMethods.removeNoRehash(this); MonThreadTrace* tt = threadTraces.first(); ! while (tt) { tt->deactivate(); ! tt = threadTraces.next(tt); } } --- 61,71 ---- void MonThreadMethod::deactivate() { ! Prof::prof().activeMonThreadMethods.removeNoRehash( this); MonThreadTrace* tt = threadTraces.first(); ! while( tt) { ! tt->deactivate(); ! tt = threadTraces.next( tt); } } Index: monThreadTrace.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/mon/monThreadTrace.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** monThreadTrace.cpp 21 Nov 2001 22:31:44 -0000 1.4 --- monThreadTrace.cpp 15 Apr 2002 21:04:18 -0000 1.5 *************** *** 52,56 **** void MonThreadTrace::deactivate() { ! Prof::prof().activeMonThreadTraces.removeNoRehash(this); } --- 52,56 ---- void MonThreadTrace::deactivate() { ! Prof::prof().activeMonThreadTraces.removeNoRehash( this); } Index: monTrace.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/mon/monTrace.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** monTrace.cpp 8 Apr 2002 23:30:01 -0000 1.5 --- monTrace.cpp 15 Apr 2002 21:04:18 -0000 1.6 *************** *** 60,64 **** void MonTrace::deactivate() { ! Prof::prof().activeMonTraces.removeNoRehash(this); } --- 60,71 ---- void MonTrace::deactivate() { ! Prof::prof().activeMonTraces.removeNoRehash( this); ! ! MonThreadTrace* tt = threadTraces.first(); ! while( tt) { ! ! tt->deactivate(); ! tt = threadTraces.next( tt); ! } } |
Update of /cvsroot/javaprofiler/library/src/prof In directory usw-pr-cvs1:/tmp/cvs-serv21227/src/prof Modified Files: prof.cpp prof.h prof_class.cpp prof_get.cpp prof_method.cpp prof_monitor.cpp prof_object.cpp prof_thread.cpp Log Message: serious bug fixes - monitors, deactivating... interface version checking added new test program for testing of memory profiling added Index: prof.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof.cpp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -r1.28 -r1.29 *** prof.cpp 25 Nov 2001 23:32:29 -0000 1.28 --- prof.cpp 15 Apr 2002 21:04:18 -0000 1.29 *************** *** 51,55 **** shuttingDown( 0), ! threadsSuspended( 0) { tF( 0, JVMPI_EVENT_ARENA_DELETE, &Prof::event_arenaDelete); --- 51,57 ---- shuttingDown( 0), ! threadsSuspended( 0), ! ! requestEvent( 0) { tF( 0, JVMPI_EVENT_ARENA_DELETE, &Prof::event_arenaDelete); *************** *** 81,85 **** 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); tF( 29, JVMPI_EVENT_OBJECT_FREE, &Prof::event_objectFree); tF( 30, JVMPI_EVENT_OBJECT_MOVE, &Prof::event_objectMove); --- 83,87 ---- 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); tF( 29, JVMPI_EVENT_OBJECT_FREE, &Prof::event_objectFree); tF( 30, JVMPI_EVENT_OBJECT_MOVE, &Prof::event_objectMove); *************** *** 90,102 **** tF( 35, JVMPI_EVENT_THREAD_START, &Prof::event_threadStart); tF( 36, JVMPI_EVENT_INSTRUCTION_START, NULL); - - tF( 37, JVMPI_EVENT_CLASS_LOAD | JVMPI_REQUESTED_EVENT, &Prof::event_classLoad); - tF( 38, JVMPI_EVENT_THREAD_START | JVMPI_REQUESTED_EVENT, &Prof::event_threadStart); - tF( 39, JVMPI_EVENT_OBJECT_ALLOC | JVMPI_REQUESTED_EVENT, &Prof::event_objectAlloc); - } - - Prof::~Prof() { - - delete &setup; } --- 92,95 ---- *************** *** 132,136 **** Prof* Prof::create( char* options, JVMPI_Interface* jvmpi) { ! return (_prof = new Prof( *(new Setup( options)), jvmpi)); } --- 125,134 ---- Prof* Prof::create( char* options, JVMPI_Interface* jvmpi) { ! _prof = new Prof( *(new Setup( options)), jvmpi); ! ! jvmpi->NotifyEvent = Prof::notifyEvent; ! jvmpi->EnableEvent( JVMPI_EVENT_JVM_INIT_DONE, NULL); ! ! return _prof; } *************** *** 142,146 **** destroying = 1; ! if( _prof) delete _prof; _prof = NULL; } --- 140,154 ---- destroying = 1; ! if( _prof) { ! ! delete &_prof->setup; ! delete _prof; ! } ! _prof = NULL; + } + + void Prof::notifyEvent( JVMPI_Event* event) { + + if( _prof) _prof->runEvent( event); } Index: prof.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof.h,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -r1.43 -r1.44 *** prof.h 4 Apr 2002 00:49:15 -0000 1.43 --- prof.h 15 Apr 2002 21:04:18 -0000 1.44 *************** *** 76,80 **** /// number of rows in the event handler table ! TAB_FUNC_SIZE = 40 }; --- 76,80 ---- /// number of rows in the event handler table ! TAB_FUNC_SIZE = 37 }; *************** *** 210,214 **** /// Destructor. ! virtual ~Prof(); /** Main fork for all received JVMPI events. For each event received by profiler --- 210,214 ---- /// Destructor. ! virtual ~Prof() {} /** Main fork for all received JVMPI events. For each event received by profiler *************** *** 235,242 **** ** @return pointer to Class object or NULL */ ! Class* getClass( jobjectID classId, int create = 1) { ! ! return activeClasses.get( classId); ! } /** Returns corresponding Method object. --- 235,239 ---- ** @return pointer to Class object or NULL */ ! Class* getClass( jobjectID classId, int create = 1); /** Returns corresponding Method object. *************** *** 250,257 **** ** @return pointer to Method object or NULL */ ! Method* getMethod( jmethodID methodId, int create = 1) { ! ! return activeMethods.get( methodId); ! } /** Returns corresponding Thread object. --- 247,251 ---- ** @return pointer to Method object or NULL */ ! Method* getMethod( jmethodID methodId, int create = 1); /** Returns corresponding Thread object. *************** *** 1123,1126 **** --- 1117,1122 ---- static void destroy(); + private: + /** Universal handler for all JVMPI events. JVM calls this ** function for each event it propagates. *************** *** 1132,1139 **** ** @see JVM_OnLoad(), JVMPI specification */ ! static void notifyEvent( JVMPI_Event* event) { ! if( _prof) _prof->runEvent( event); ! } private: --- 1128,1137 ---- ** @see JVM_OnLoad(), JVMPI specification */ ! static void notifyEvent( JVMPI_Event* event); ! private: ! ! /// request event notification ! int requestEvent; private: Index: prof_class.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_class.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** prof_class.cpp 21 Nov 2001 22:31:44 -0000 1.11 --- prof_class.cpp 15 Apr 2002 21:04:18 -0000 1.12 *************** *** 40,46 **** Synchronized sync( dataLock, 0); ! if( !(event->event_type & JVMPI_REQUESTED_EVENT)) sync.enter(); ! if( !event->u.class_load.class_id) return; static int firstTime = 1; --- 40,48 ---- Synchronized sync( dataLock, 0); ! if( !requestEvent) sync.enter(); ! jobjectID classId = event->u.class_load.class_id; ! ! if( !classId) return; static int firstTime = 1; *************** *** 54,63 **** jvmpiInterface->EnableEvent( JVMPI_EVENT_METHOD_ENTRY, NULL); ! if( setup.mon.turnedOn) jvmpiInterface->EnableEvent( JVMPI_EVENT_MONITOR_CONTENDED_ENTER, NULL); firstTime = 0; } Class* c = new Class; --- 56,76 ---- jvmpiInterface->EnableEvent( JVMPI_EVENT_METHOD_ENTRY, NULL); ! if( setup.mon.turnedOn) { ! jvmpiInterface->EnableEvent( JVMPI_EVENT_MONITOR_CONTENDED_ENTER, NULL); + jvmpiInterface->EnableEvent( JVMPI_EVENT_MONITOR_WAITED, NULL); + } firstTime = 0; } + if( getClass( classId, 0)) return; + + jint numMethods = event->u.class_load.num_methods; + JVMPI_Method* pm = event->u.class_load.methods; + + for( jint l = 0; l < numMethods; l++, pm++) + if( getMethod( pm->method_id, 0)) return; + Class* c = new Class; *************** *** 66,75 **** c->numInterfaces = event->u.class_load.num_interfaces; ! c->numMethods = event->u.class_load.num_methods; c->numStaticFields = event->u.class_load.num_static_fields; c->numInstanceFields = event->u.class_load.num_instance_fields; ! JVMPI_Method* pm = event->u.class_load.methods; ! for( jint i = 0; i < c->numMethods; i++, pm++) { Method* m = new Method; --- 79,88 ---- c->numInterfaces = event->u.class_load.num_interfaces; ! c->numMethods = numMethods; c->numStaticFields = event->u.class_load.num_static_fields; c->numInstanceFields = event->u.class_load.num_instance_fields; ! pm = event->u.class_load.methods; ! for( jint i = 0; i < numMethods; i++, pm++) { Method* m = new Method; *************** *** 109,116 **** } ! c->classId = event->u.class_load.class_id; classes.add( c); ! activeClasses.add(c); Method* m = c->methods.first(); --- 122,129 ---- } ! c->classId = classId; classes.add( c); ! activeClasses.add( c); Method* m = c->methods.first(); *************** *** 126,130 **** Synchronized sync( dataLock); ! Class* c = getClass(event->u.class_unload.class_id, 0); if( c) c->deactivate(); } --- 139,143 ---- Synchronized sync( dataLock); ! Class* c = getClass( event->u.class_unload.class_id, 0); if( c) c->deactivate(); } Index: prof_get.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_get.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** prof_get.cpp 12 Mar 2002 22:17:56 -0000 1.10 --- prof_get.cpp 15 Apr 2002 21:04:18 -0000 1.11 *************** *** 51,73 **** #include "../mon/monThreadTrace.h" ! CpuTrace* Prof::getCpuTrace(int numFrames, JVMPI_CallFrame* frames, int create) { TraceKey key; - CpuTrace* trace; key.numFrames = numFrames; ! key.frames = frames; [...1040 lines suppressed...] + event.event_type = JVMPI_EVENT_CLASS_LOAD; + event.env_id = NULL; + + event.u.class_load.class_name = buf; + event.u.class_load.source_name = NULL; + event.u.class_load.num_interfaces = 0; + event.u.class_load.num_methods = 0; + event.u.class_load.methods = NULL; + event.u.class_load.num_static_fields = 0; + event.u.class_load.statics = NULL; + event.u.class_load.num_instance_fields = 0; + event.u.class_load.instances = NULL; + event.u.class_load.class_id = classId; + + requestEvent++; + event_classLoad( &event); + requestEvent--; + + return activeClasses.get( classId); + } Index: prof_method.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_method.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** prof_method.cpp 8 Apr 2002 23:30:01 -0000 1.11 --- prof_method.cpp 15 Apr 2002 21:04:18 -0000 1.12 *************** *** 46,51 **** jint lineno = 0; ! if (setup.cpu.linenoEnabled || setup.cpu.callTreeLinenoEnabled) ! { JVMPI_CallFrame callFrame; JVMPI_CallTrace callTrace; --- 46,51 ---- jint lineno = 0; ! if (setup.cpu.linenoEnabled || setup.cpu.callTreeLinenoEnabled) { ! JVMPI_CallFrame callFrame; JVMPI_CallTrace callTrace; *************** *** 74,83 **** Thread* thread = getThread( event->env_id); - if( !thread) { - - PROF_ERROR( "METHOD ENTRY", "Thread not found"); - return; - } - JVMPI_CallFrame tempFrame; --- 74,77 ---- *************** *** 119,133 **** Method* m = getMethod( methodID); - if( m) { ! p = new CallTreeItem; ! p->method = m; ! p->lineno = ctLineno; ! p->parent = current; ! if( current) current->children.add( p); ! else thread->callTree.root = p; ! } } --- 113,125 ---- Method* m = getMethod( methodID); ! p = new CallTreeItem; ! p->method = m; ! p->lineno = ctLineno; ! p->parent = current; ! if( current) current->children.add( p); ! else thread->callTree.root = p; } *************** *** 166,176 **** jmethodID methodID = event->u.method.method_id; - Thread* thread = getThread( event->env_id); ! if( !thread) { ! ! PROF_ERROR("METHOD EXIT", "Thread not found"); ! return; ! } int numFrames = setup.cpu.traceDepth; --- 158,164 ---- jmethodID methodID = event->u.method.method_id; ! Thread* thread = getThread( event->env_id, 0); ! if( !thread) return; int numFrames = setup.cpu.traceDepth; *************** *** 204,245 **** if( setup.cpu.threadsEnabled) { ! if( setup.cpu.level == Setup::LEVEL_METHOD) { ! if( !(stat = getCpuThreadMethod( event->env_id, methodID))) { ! PROF_ERROR("METHOD EXIT", "Cannot get CpuThreadMethod"); ! return; ! } ! } ! else { ! ! if( !(stat = getCpuThreadTrace( event->env_id, numFrames, callFrames))) { ! PROF_ERROR("METHOD EXIT", "Cannot get CpuThreadTrace"); ! return; ! } ! } } else { ! if( setup.cpu.level == Setup::LEVEL_METHOD) { ! if( !(stat = getMethod( methodID))) { ! PROF_ERROR("METHOD EXIT", "Method not found"); ! return; ! } ! } ! else { ! ! if( !(stat = getCpuTrace( numFrames, callFrames))) { ! PROF_ERROR("METHOD EXIT", "Cannot get CPU trace"); ! return; ! } ! } } ! stat->addCpuStat( 1, pureTime); stat->addCpuStat( -1, 0); --- 192,215 ---- if( setup.cpu.threadsEnabled) { ! if( setup.cpu.level == Setup::LEVEL_METHOD) ! stat = getCpuThreadMethod( event->env_id, methodID); ! else ! stat = getCpuThreadTrace( event->env_id, numFrames, callFrames); } else { ! if( setup.cpu.level == Setup::LEVEL_METHOD) ! stat = getMethod( methodID); ! else ! stat = getCpuTrace( numFrames, callFrames); } ! stat->addCpuStat( 1, pureTime); stat->addCpuStat( -1, 0); Index: prof_monitor.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_monitor.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** prof_monitor.cpp 8 Apr 2002 23:30:01 -0000 1.6 --- prof_monitor.cpp 15 Apr 2002 21:04:18 -0000 1.7 *************** *** 42,52 **** void Prof::event_monitorContendedEnter( JVMPI_Event* event) { ! Synchronized sync(dataLock); ! Thread* t; ! if (!(t = getThread(event->env_id))) { ! PROF_ERROR("MONITOR CONTENDED ENTER", "Thread not found"); ! return; ! } static int firstTime = 1; --- 42,48 ---- void Prof::event_monitorContendedEnter( JVMPI_Event* event) { ! Synchronized sync( dataLock); ! Thread* t = getThread( event->env_id); static int firstTime = 1; *************** *** 54,59 **** jvmpiInterface->EnableEvent( JVMPI_EVENT_MONITOR_CONTENDED_ENTERED, NULL); - jvmpiInterface->EnableEvent( JVMPI_EVENT_MONITOR_WAITED, NULL); - firstTime = 0; } --- 50,53 ---- *************** *** 66,82 **** void Prof::event_monitorContendedEntered( JVMPI_Event* event) { ! Synchronized sync(dataLock); - 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; --- 60,80 ---- void Prof::event_monitorContendedEntered( JVMPI_Event* event) { ! Synchronized sync( dataLock); ! ! Thread* t = getThread( event->env_id, 0); ! if( !t) { 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; *************** *** 91,100 **** 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; --- 89,100 ---- callTrace.env_id = event->env_id; ! callTrace.num_frames = numFrames; callTrace.frames = callFrames; ! jvmpiInterface->GetCallTrace(&callTrace, numFrames); numFrames = callTrace.num_frames; ! ! if( numFrames < 1) { ! PROF_ERROR("MONITOR CONTENDED ENTERED", "GetCallTrace failed"); return; *************** *** 109,158 **** 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); stat->addMonStat( -1, 0); } void Prof::event_monitorWaited( JVMPI_Event* event) { ! Synchronized sync(dataLock); ! Thread* t; ! if (!(t = getThread(event->env_id))) { ! PROF_ERROR("MONITOR WAITED", "Thread not found"); ! return; ! } int numFrames = 1; --- 109,143 ---- if (setup.mon.threadsEnabled) { ! if (setup.mon.level == Setup::LEVEL_METHOD) ! stat = getMonThreadMethod(event->env_id, callFrames[0].method_id); ! ! else ! ! stat = getMonThreadTrace(event->env_id, numFrames, callFrames); } else { ! if (setup.mon.level == Setup::LEVEL_METHOD) ! ! stat = getMethod(callFrames[0].method_id); ! ! else ! ! stat = getMonTrace(numFrames, callFrames); } int hits = (stat->wait) ? 0 : 1; ! stat->addMonStat( hits, curTime-t->monitorEnterTime); stat->addMonStat( -1, 0); + + stat->wait = 0; } void Prof::event_monitorWaited( JVMPI_Event* event) { ! Synchronized sync( dataLock); ! Thread* t = getThread( event->env_id); int numFrames = 1; *************** *** 163,172 **** 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; --- 148,159 ---- callTrace.env_id = event->env_id; ! callTrace.num_frames = numFrames; callTrace.frames = callFrames; ! jvmpiInterface->GetCallTrace(&callTrace, numFrames); numFrames = callTrace.num_frames; ! ! if( numFrames < 1) { ! PROF_ERROR("MONITOR WAITED", "GetCallTrace failed"); return; *************** *** 177,214 **** 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); stat->addMonStat( -1, 0); } --- 164,188 ---- if (setup.mon.threadsEnabled) { ! if (setup.mon.level == Setup::LEVEL_METHOD) ! ! stat = getMonThreadMethod(event->env_id, callFrames[0].method_id); ! ! else ! stat = getMonThreadTrace(event->env_id, numFrames, callFrames); } else { ! if (setup.mon.level == Setup::LEVEL_METHOD) ! ! stat = getMethod(callFrames[0].method_id); ! ! else ! ! stat = getMonTrace(numFrames, callFrames); } stat->wait = 1; ! stat->addMonStat( 1, event->u.monitor_wait.timeout); stat->addMonStat( -1, 0); } Index: prof_object.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_object.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** prof_object.cpp 8 Apr 2002 23:30:01 -0000 1.19 --- prof_object.cpp 15 Apr 2002 21:04:18 -0000 1.20 *************** *** 46,61 **** void Prof::event_objectAlloc( JVMPI_Event* event) { ! Synchronized sync(dataLock, 0); ! if (!(event->event_type & JVMPI_REQUESTED_EVENT)) sync.enter(); ! JNIEnv* envId = event->env_id; ! jint arenaId = event->u.obj_alloc.arena_id; jobjectID classId = event->u.obj_alloc.class_id; ! jint isArray = event->u.obj_alloc.is_array; ! jint size = event->u.obj_alloc.size; ! jobjectID objId = event->u.obj_alloc.obj_id; ! if (!envId) return; ! if (!objId) return; AllocAbstractStatThreadObject* stat; --- 46,60 ---- void Prof::event_objectAlloc( JVMPI_Event* event) { ! Synchronized sync( dataLock); ! JNIEnv* envId = event->env_id; ! jint arenaId = event->u.obj_alloc.arena_id; jobjectID classId = event->u.obj_alloc.class_id; ! jint isArray = event->u.obj_alloc.is_array; ! jint size = event->u.obj_alloc.size; ! jobjectID objId = event->u.obj_alloc.obj_id; ! if( !envId) return; ! if( !objId) return; AllocAbstractStatThreadObject* stat; *************** *** 63,80 **** if (setup.alloc.level == Setup::LEVEL_OBJECT) { ! if (setup.alloc.threadsEnabled) { ! if (!(stat = getAllocThreadObject(envId, classId, isArray))) { ! PROF_ERROR("OBJECT ALLOC", "Cannot get AllocThreadObject"); ! return; ! } ! } ! else { ! if (!(stat = getAllocObject(classId, isArray))) { ! PROF_ERROR("OBJECT ALLOC", "Cannot get AllocObject"); ! return; ! } ! } } else if (setup.alloc.level == Setup::LEVEL_METHOD) { --- 62,72 ---- if (setup.alloc.level == Setup::LEVEL_OBJECT) { ! if (setup.alloc.threadsEnabled) ! stat = getAllocThreadObject(envId, classId, isArray); ! else ! ! stat = getAllocObject(classId, isArray); } else if (setup.alloc.level == Setup::LEVEL_METHOD) { *************** *** 84,92 **** trace.env_id = envId; ! trace.num_frames = (jint)1; trace.frames = &frame; ! jvmpiInterface->GetCallTrace(&trace, (jint)1); ! if (trace.num_frames == (jint)0) { PROF_ERROR("OBJECT ALLOC", "GetCallTrace failed"); return; --- 76,86 ---- trace.env_id = envId; ! trace.num_frames = 1; trace.frames = &frame; ! jvmpiInterface->GetCallTrace(&trace, 1); ! ! if (trace.num_frames != 1) { ! PROF_ERROR("OBJECT ALLOC", "GetCallTrace failed"); return; *************** *** 95,114 **** jmethodID methodId = frame.method_id; ! if (setup.alloc.threadsEnabled) { ! if (!(stat = getAllocThreadObjectMethod(envId, classId, isArray, methodId))) { ! PROF_ERROR("OBJECT ALLOC", "Cannot get AllocThreadObjectMethod"); ! return; ! } ! } ! else { ! if (!(stat = getAllocObjectMethod(classId, isArray, methodId))) { ! PROF_ERROR("OBJECT ALLOC", "Cannot get AllocObjectMethod"); ! return; ! } ! } } else { JVMPI_CallTrace trace; JVMPI_CallFrame frames[MAX_TRACE]; --- 89,102 ---- jmethodID methodId = frame.method_id; ! if (setup.alloc.threadsEnabled) ! stat = getAllocThreadObjectMethod(envId, classId, isArray, methodId); ! else ! ! stat = getAllocObjectMethod(classId, isArray, methodId); } else { + JVMPI_CallTrace trace; JVMPI_CallFrame frames[MAX_TRACE]; *************** *** 119,123 **** --- 107,113 ---- jvmpiInterface->GetCallTrace(&trace, setup.alloc.traceDepth); + if (trace.num_frames < 1 || trace.num_frames > setup.alloc.traceDepth) { + PROF_ERROR("OBJECT ALLOC", "GetCallTrace failed"); return; *************** *** 130,147 **** frames[i].lineno = 0; ! if (setup.alloc.threadsEnabled) { ! if (!(stat = getAllocThreadObjectTrace(envId, classId, isArray, numFrames, frames))) { ! PROF_ERROR("OBJECT ALLOC", "Cannot get AllocThreadObjectTrace"); ! return; ! } ! } ! else { ! if (!(stat = getAllocObjectTrace(classId, isArray, numFrames, frames))) { ! PROF_ERROR("OBJECT ALLOC", "Cannot get AllocObjectTrace"); ! return; ! } ! } } --- 120,130 ---- frames[i].lineno = 0; ! if (setup.alloc.threadsEnabled) ! stat = getAllocThreadObjectTrace(envId, classId, isArray, numFrames, frames); ! else ! ! stat = getAllocObjectTrace(classId, isArray, numFrames, frames); } *************** *** 196,200 **** void Prof::event_objectMove( JVMPI_Event* event) { ! jobjectID obj_id = event->u.obj_move.obj_id; AllocInstance* ins = instances.get( obj_id); --- 179,183 ---- void Prof::event_objectMove( JVMPI_Event* event) { ! jobjectID obj_id = event->u.obj_move.obj_id; AllocInstance* ins = instances.get( obj_id); Index: prof_thread.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_thread.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** prof_thread.cpp 12 Mar 2002 22:17:56 -0000 1.15 --- prof_thread.cpp 15 Apr 2002 21:04:18 -0000 1.16 *************** *** 62,73 **** Synchronized sync( dataLock, 0); ! if( !(event->event_type & JVMPI_REQUESTED_EVENT)) sync.enter(); JNIEnv* envId = event->u.thread_start.thread_env_id; ! char* name = event->u.thread_start.thread_name; ! if (!envId) return; ! if (strcmp(name, COMMUN_THREAD) == 0) return; ! if (strcmp(name, SAMPLING_THREAD) == 0) return; static int firstTime = 1; --- 62,73 ---- Synchronized sync( dataLock, 0); ! if( !requestEvent) sync.enter(); JNIEnv* envId = event->u.thread_start.thread_env_id; ! char* name = event->u.thread_start.thread_name; ! if( !envId) return; ! if( !strcmp( name, COMMUN_THREAD)) return; ! if( !strcmp( name, SAMPLING_THREAD)) return; static int firstTime = 1; *************** *** 78,84 **** } ! Thread* t; ! if( t = getThread( envId, 0)) return; ! else t = new Thread; t->threadName = event->u.thread_start.thread_name; --- 78,84 ---- } ! if( getThread( envId, 0)) return; ! ! Thread* t = new Thread; t->threadName = event->u.thread_start.thread_name; *************** *** 119,123 **** Synchronized sync( dataLock); ! Thread* t = getThread(event->env_id, 0); ! if (t) t->deactivate(); } --- 119,123 ---- Synchronized sync( dataLock); ! Thread* t = getThread( event->env_id, 0); ! if( t) t->deactivate(); } |
From: Marek P. <ma...@us...> - 2002-04-15 21:04:28
|
Update of /cvsroot/javaprofiler/library/src/list In directory usw-pr-cvs1:/tmp/cvs-serv21227/src/list Modified Files: list.h listItem.h Log Message: serious bug fixes - monitors, deactivating... interface version checking added new test program for testing of memory profiling added Index: list.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/list/list.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** list.h 21 Nov 2001 22:31:43 -0000 1.9 --- list.h 15 Apr 2002 21:04:18 -0000 1.10 *************** *** 156,159 **** --- 156,160 ---- if( !p) return NULL; + if( !p->L::inList()) return p; ListItem* q = p->L::remove(); Index: listItem.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/list/listItem.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** listItem.h 21 Nov 2001 22:31:43 -0000 1.9 --- listItem.h 15 Apr 2002 21:04:18 -0000 1.10 *************** *** 103,106 **** --- 103,113 ---- ListItem* remove(); + + /** Informs whether item is in any list or not. + ** + ** @return 1 (yes, it is); + ** 0 (no, it is not) */ + + int inList() const { return !!_list;} }; |
From: Marek P. <ma...@us...> - 2002-04-15 21:04:28
|
Update of /cvsroot/javaprofiler/library/src/hash In directory usw-pr-cvs1:/tmp/cvs-serv21227/src/hash Modified Files: hash.h Log Message: serious bug fixes - monitors, deactivating... interface version checking added new test program for testing of memory profiling added Index: hash.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/hash/hash.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -r1.22 -r1.23 *** hash.h 10 Feb 2002 18:36:13 -0000 1.22 --- hash.h 15 Apr 2002 21:04:17 -0000 1.23 *************** *** 218,221 **** --- 218,222 ---- if( !item) return NULL; + if( !item->L::inList()) return item; item->L::remove(); |
From: Marek P. <ma...@us...> - 2002-04-15 21:04:28
|
Update of /cvsroot/javaprofiler/library/src/shared In directory usw-pr-cvs1:/tmp/cvs-serv21227/src/shared Modified Files: class.cpp method.cpp thread.cpp Log Message: serious bug fixes - monitors, deactivating... interface version checking added new test program for testing of memory profiling added Index: class.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/shared/class.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** class.cpp 21 Nov 2001 22:31:51 -0000 1.5 --- class.cpp 15 Apr 2002 21:04:18 -0000 1.6 *************** *** 53,66 **** active = 0; ! Prof::prof().activeClasses.removeNoRehash(this); AllocObject* o; ! if (o = allocObject) o->deactivate(); ! if (o = allocObjectArray) o->deactivate(); Method* m = methods.first(); ! while (m) { m->deactivate(); ! m = methods.next(m); } } --- 53,67 ---- active = 0; ! Prof::prof().activeClasses.removeNoRehash( this); AllocObject* o; ! if( o = allocObject) o->deactivate(); ! if( o = allocObjectArray) o->deactivate(); Method* m = methods.first(); ! while( m) { ! m->deactivate(); ! m = methods.next( m); } } Index: method.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/shared/method.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** method.cpp 21 Nov 2001 22:31:51 -0000 1.14 --- method.cpp 15 Apr 2002 21:04:18 -0000 1.15 *************** *** 60,99 **** void Method::deactivate() { ! Prof::prof().activeMethods.removeNoRehash(this); AllocThreadMethod* atm = allocThreadMethods.first(); ! while (atm) { atm->deactivate(); ! atm = allocThreadMethods.next(atm); } ! CpuThreadMethod* ctm = cpuThreadMethods.first(); ! while (ctm) { ! ctm->deactivate(); ! ctm = cpuThreadMethods.next(ctm); ! } ! MonThreadMethod* mtm = monThreadMethods.first(); ! while (mtm) { ! mtm->deactivate(); ! mtm = monThreadMethods.next(mtm); } AllocTrace* at = allocTraces.first(); ! while (at) { at->deactivate(); ! at = allocTraces.next(at); } CpuTrace* ct = cpuTraces.first(); ! while (ct) { ct->deactivate(); ! ct = cpuTraces.next(ct); } MonTrace* mt = monTraces.first(); ! while (mt) { mt->deactivate(); ! mt = monTraces.next(mt); } } --- 60,112 ---- void Method::deactivate() { ! Prof::prof().activeMethods.removeNoRehash( this); AllocThreadMethod* atm = allocThreadMethods.first(); ! while( atm) { ! atm->deactivate(); ! atm = allocThreadMethods.next( atm); } ! AllocObjectMethod* aom = allocObjectMethods.first(); ! while( aom) { ! aom->deactivate(); ! aom = allocObjectMethods.next( aom); } AllocTrace* at = allocTraces.first(); ! while( at) { ! at->deactivate(); ! at = allocTraces.next( at); ! } ! ! CpuThreadMethod* ctm = cpuThreadMethods.first(); ! while( ctm) { ! ! ctm->deactivate(); ! ctm = cpuThreadMethods.next( ctm); } CpuTrace* ct = cpuTraces.first(); ! while( ct) { ! ct->deactivate(); ! ct = cpuTraces.next( ct); ! } ! ! MonThreadMethod* mtm = monThreadMethods.first(); ! while( mtm) { ! ! mtm->deactivate(); ! mtm = monThreadMethods.next( mtm); } MonTrace* mt = monTraces.first(); ! while( mt) { ! mt->deactivate(); ! mt = monTraces.next( mt); } } Index: thread.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/shared/thread.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** thread.cpp 21 Nov 2001 22:31:51 -0000 1.10 --- thread.cpp 15 Apr 2002 21:04:18 -0000 1.11 *************** *** 59,87 **** active = 0; ! Prof::prof().activeThreads.removeNoRehash(this); ! Prof::prof().sampledThreads.remove(this); AllocThreadObject* ato = allocThreadObjects.first(); ! while (ato) { ato->deactivate(); ! ato = allocThreadObjects.next(ato); } AllocThreadMethod* atm = allocThreadMethods.first(); ! while (atm) { atm->deactivate(); ! atm = allocThreadMethods.next(atm); } ! CpuThreadMethod* ctm = cpuThreadMethods.first(); ! while (ctm) { ctm->deactivate(); ! ctm = cpuThreadMethods.next(ctm); } ! MonThreadMethod* mtm = monThreadMethods.first(); ! while (mtm) { mtm->deactivate(); ! mtm = monThreadMethods.next(mtm); } } --- 59,91 ---- active = 0; ! Prof::prof().activeThreads.removeNoRehash( this); ! Prof::prof().sampledThreads.remove( this); AllocThreadObject* ato = allocThreadObjects.first(); ! while( ato) { ! ato->deactivate(); ! ato = allocThreadObjects.next( ato); } AllocThreadMethod* atm = allocThreadMethods.first(); ! while( atm) { ! atm->deactivate(); ! atm = allocThreadMethods.next( atm); } ! CpuThreadMethod* ctm = cpuThreadMethods.first(); ! while( ctm) { ! ctm->deactivate(); ! ctm = cpuThreadMethods.next( ctm); } ! MonThreadMethod* mtm = monThreadMethods.first(); ! while( mtm) { ! mtm->deactivate(); ! mtm = monThreadMethods.next( mtm); } } |
From: Marek P. <ma...@us...> - 2002-04-15 21:04:28
|
Update of /cvsroot/javaprofiler/library/src/main In directory usw-pr-cvs1:/tmp/cvs-serv21227/src/main Modified Files: main.cpp Log Message: serious bug fixes - monitors, deactivating... interface version checking added new test program for testing of memory profiling added Index: main.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/main/main.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -r1.25 -r1.26 *** main.cpp 21 Nov 2001 22:31:43 -0000 1.25 --- main.cpp 15 Apr 2002 21:04:18 -0000 1.26 *************** *** 50,54 **** ** JNI_ERR (an error occurred) ** ! ** @see JavaVM Profiler Interface (JVMPI) specification, profNotifyEvent() ** ** @author Marek Przeczek */ --- 50,54 ---- ** JNI_ERR (an error occurred) ** ! ** @see JavaVM Profiler Interface (JVMPI) specification ** ** @author Marek Przeczek */ *************** *** 59,66 **** if( jvm->GetEnv( (void**)&jvmpi_interface, JVMPI_VERSION_1) < 0) return JNI_ERR; - jvmpi_interface->NotifyEvent = Prof::notifyEvent; Prof::create( options, jvmpi_interface); - - jvmpi_interface->EnableEvent( JVMPI_EVENT_JVM_INIT_DONE, NULL); return JNI_OK; --- 59,63 ---- |
From: Marek P. <ma...@us...> - 2002-04-15 21:04:28
|
Update of /cvsroot/javaprofiler/library/demo/04 In directory usw-pr-cvs1:/tmp/cvs-serv21227/demo/04 Modified Files: Test.java Log Message: serious bug fixes - monitors, deactivating... interface version checking added new test program for testing of memory profiling added Index: Test.java =================================================================== RCS file: /cvsroot/javaprofiler/library/demo/04/Test.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** Test.java 4 Apr 2002 00:49:14 -0000 1.5 --- Test.java 15 Apr 2002 21:04:16 -0000 1.6 *************** *** 125,131 **** // sockets are used by default iprof = new IProf(); - iprof.run(); try { // til profiled program is going, do nothing --- 125,132 ---- // sockets are used by default iprof = new IProf(); try { + + iprof.run(); // til profiled program is going, do nothing |
From: Marek P. <ma...@us...> - 2002-04-15 21:04:27
|
Update of /cvsroot/javaprofiler/library/demo/07 In directory usw-pr-cvs1:/tmp/cvs-serv21227/demo/07 Modified Files: Test.java Log Message: serious bug fixes - monitors, deactivating... interface version checking added new test program for testing of memory profiling added Index: Test.java =================================================================== RCS file: /cvsroot/javaprofiler/library/demo/07/Test.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Test.java 7 Mar 2002 17:15:38 -0000 1.2 --- Test.java 15 Apr 2002 21:04:17 -0000 1.3 *************** *** 50,56 **** iprof = new IProf(); - iprof.run(); try { // first of all, we need a thread ID Iterator iterator = iprof.getAllThruIterator( 0, --- 50,58 ---- iprof = new IProf(); try { + + iprof.run(); + // first of all, we need a thread ID Iterator iterator = iprof.getAllThruIterator( 0, |
From: Marek P. <ma...@us...> - 2002-04-15 21:04:27
|
Update of /cvsroot/javaprofiler/library/demo/05 In directory usw-pr-cvs1:/tmp/cvs-serv21227/demo/05 Modified Files: Test.java Log Message: serious bug fixes - monitors, deactivating... interface version checking added new test program for testing of memory profiling added Index: Test.java =================================================================== RCS file: /cvsroot/javaprofiler/library/demo/05/Test.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Test.java 9 Dec 2001 16:49:32 -0000 1.1 --- Test.java 15 Apr 2002 21:04:17 -0000 1.2 *************** *** 88,95 **** // stay for a server (so dynamic library must stay for a client) iprof = new IProf( new CommunSetupSocket( ! CommunSetupSocket.SERVER_MODE)); ! iprof.run(); try { // til profiled program is going, do nothing --- 88,96 ---- // stay for a server (so dynamic library must stay for a client) iprof = new IProf( new CommunSetupSocket( ! CommunSetupSocket.SERVER_MODE)); try { + + iprof.run(); // til profiled program is going, do nothing |
From: Marek P. <ma...@us...> - 2002-04-15 21:04:27
|
Update of /cvsroot/javaprofiler/library/src/alloc In directory usw-pr-cvs1:/tmp/cvs-serv21227/src/alloc Modified Files: allocObject.cpp allocObjectMethod.cpp allocObjectTrace.cpp allocThreadMethod.cpp allocThreadObject.cpp allocThreadObjectMethod.cpp allocThreadObjectTrace.cpp allocThreadTrace.cpp allocTrace.cpp Log Message: serious bug fixes - monitors, deactivating... interface version checking added new test program for testing of memory profiling added Index: allocObject.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocObject.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** allocObject.cpp 21 Nov 2001 22:31:41 -0000 1.13 --- allocObject.cpp 15 Apr 2002 21:04:17 -0000 1.14 *************** *** 70,79 **** void AllocObject::deactivate() { ! Prof::prof().activeAllocObjects.removeNoRehash(this); AllocObjectMethod* om = objectMethods.first(); ! while (om) { om->deactivate(); ! om = objectMethods.next(om); } } --- 70,87 ---- void AllocObject::deactivate() { ! Prof::prof().activeAllocObjects.removeNoRehash( this); AllocObjectMethod* om = objectMethods.first(); ! while( om) { ! om->deactivate(); ! om = objectMethods.next( om); ! } ! ! AllocThreadObject* to = threadObjects.first(); ! while( to) { ! ! to->deactivate(); ! to = threadObjects.next( to); } } Index: allocObjectMethod.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocObjectMethod.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** allocObjectMethod.cpp 10 Feb 2002 18:36:13 -0000 1.13 --- allocObjectMethod.cpp 15 Apr 2002 21:04:17 -0000 1.14 *************** *** 73,82 **** void AllocObjectMethod::deactivate() { ! Prof::prof().activeAllocObjectMethods.removeNoRehash(this); AllocObjectTrace* ot = objectTraces.first(); ! while (ot) { ot->deactivate(); ! ot = objectTraces.next(ot); } } --- 73,90 ---- void AllocObjectMethod::deactivate() { ! Prof::prof().activeAllocObjectMethods.removeNoRehash( this); ! ! AllocThreadObjectMethod* tom = threadObjectMethods.first(); ! while( tom) { ! ! tom->deactivate(); ! tom = threadObjectMethods.next( tom); ! } AllocObjectTrace* ot = objectTraces.first(); ! while( ot) { ! ot->deactivate(); ! ot = objectTraces.next( ot); } } Index: allocObjectTrace.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocObjectTrace.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** allocObjectTrace.cpp 10 Feb 2002 18:36:13 -0000 1.13 --- allocObjectTrace.cpp 15 Apr 2002 21:04:17 -0000 1.14 *************** *** 74,78 **** void AllocObjectTrace::deactivate() { ! Prof::prof().activeAllocObjectTraces.removeNoRehash(this); } --- 74,85 ---- void AllocObjectTrace::deactivate() { ! Prof::prof().activeAllocObjectTraces.removeNoRehash( this); ! ! AllocThreadObjectTrace* tot = threadObjectTraces.first(); ! while( tot) { ! ! tot->deactivate(); ! tot = threadObjectTraces.next( tot); ! } } Index: allocThreadMethod.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocThreadMethod.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** allocThreadMethod.cpp 21 Nov 2001 22:31:41 -0000 1.10 --- allocThreadMethod.cpp 15 Apr 2002 21:04:17 -0000 1.11 *************** *** 43,52 **** void AllocThreadMethod::deactivate() { ! Prof::prof().activeAllocThreadMethods.removeNoRehash(this); AllocThreadTrace* tt = threadTraces.first(); ! while (tt) { tt->deactivate(); ! tt = threadTraces.next(tt); } } --- 43,60 ---- void AllocThreadMethod::deactivate() { ! Prof::prof().activeAllocThreadMethods.removeNoRehash( this); ! ! AllocThreadObjectMethod* tom = threadObjectMethods.first(); ! while( tom) { ! ! tom->deactivate(); ! tom = threadObjectMethods.next( tom); ! } AllocThreadTrace* tt = threadTraces.first(); ! while( tt) { ! tt->deactivate(); ! tt = threadTraces.next( tt); } } Index: allocThreadObject.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocThreadObject.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** allocThreadObject.cpp 10 Feb 2002 18:36:13 -0000 1.15 --- allocThreadObject.cpp 15 Apr 2002 21:04:17 -0000 1.16 *************** *** 73,82 **** void AllocThreadObject::deactivate() { ! Prof::prof().activeAllocThreadObjects.removeNoRehash(this); AllocThreadObjectMethod* tom = threadObjectMethods.first(); ! while (tom) { tom->deactivate(); ! tom = threadObjectMethods.next(tom); } } --- 73,83 ---- void AllocThreadObject::deactivate() { ! Prof::prof().activeAllocThreadObjects.removeNoRehash( this); AllocThreadObjectMethod* tom = threadObjectMethods.first(); ! while( tom) { ! tom->deactivate(); ! tom = threadObjectMethods.next( tom); } } Index: allocThreadObjectMethod.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocThreadObjectMethod.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** allocThreadObjectMethod.cpp 21 Nov 2001 22:31:41 -0000 1.14 --- allocThreadObjectMethod.cpp 15 Apr 2002 21:04:17 -0000 1.15 *************** *** 78,87 **** void AllocThreadObjectMethod::deactivate() { ! Prof::prof().activeAllocThreadObjectMethods.removeNoRehash(this); AllocThreadObjectTrace* tot = threadObjectTraces.first(); ! while (tot) { tot->deactivate(); ! tot = threadObjectTraces.next(tot); } } --- 78,88 ---- void AllocThreadObjectMethod::deactivate() { ! Prof::prof().activeAllocThreadObjectMethods.removeNoRehash( this); AllocThreadObjectTrace* tot = threadObjectTraces.first(); ! while( tot) { ! tot->deactivate(); ! tot = threadObjectTraces.next( tot); } } Index: allocThreadObjectTrace.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocThreadObjectTrace.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** allocThreadObjectTrace.cpp 21 Nov 2001 22:31:41 -0000 1.13 --- allocThreadObjectTrace.cpp 15 Apr 2002 21:04:17 -0000 1.14 *************** *** 78,82 **** void AllocThreadObjectTrace::deactivate() { ! Prof::prof().activeAllocThreadObjectTraces.removeNoRehash(this); } --- 78,82 ---- void AllocThreadObjectTrace::deactivate() { ! Prof::prof().activeAllocThreadObjectTraces.removeNoRehash( this); } Index: allocThreadTrace.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocThreadTrace.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** allocThreadTrace.cpp 21 Nov 2001 22:31:41 -0000 1.10 --- allocThreadTrace.cpp 15 Apr 2002 21:04:17 -0000 1.11 *************** *** 44,48 **** void AllocThreadTrace::deactivate() { ! Prof::prof().activeAllocThreadTraces.removeNoRehash(this); } --- 44,55 ---- void AllocThreadTrace::deactivate() { ! Prof::prof().activeAllocThreadTraces.removeNoRehash( this); ! ! AllocThreadObjectTrace* tot = threadObjectTraces.first(); ! while( tot) { ! ! tot->deactivate(); ! tot = threadObjectTraces.next( tot); ! } } Index: allocTrace.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocTrace.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** allocTrace.cpp 21 Nov 2001 22:31:41 -0000 1.10 --- allocTrace.cpp 15 Apr 2002 21:04:17 -0000 1.11 *************** *** 42,46 **** void AllocTrace::deactivate() { ! Prof::prof().activeAllocTraces.removeNoRehash(this); } --- 42,60 ---- void AllocTrace::deactivate() { ! Prof::prof().activeAllocTraces.removeNoRehash( this); ! ! AllocThreadTrace* tt = threadTraces.first(); ! while( tt) { ! ! tt->deactivate(); ! tt = threadTraces.next( tt); ! } ! ! AllocObjectTrace* ot = objectTraces.first(); ! while( ot) { ! ! ot->deactivate(); ! ot = objectTraces.next( ot); ! } } |
From: Marek P. <ma...@us...> - 2002-04-15 21:04:27
|
Update of /cvsroot/javaprofiler/library/src/cpu In directory usw-pr-cvs1:/tmp/cvs-serv21227/src/cpu Modified Files: cpuThreadMethod.cpp cpuThreadTrace.cpp cpuTrace.cpp sampling.cpp Log Message: serious bug fixes - monitors, deactivating... interface version checking added new test program for testing of memory profiling added Index: cpuThreadMethod.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/cpuThreadMethod.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** cpuThreadMethod.cpp 8 Apr 2002 23:30:01 -0000 1.9 --- cpuThreadMethod.cpp 15 Apr 2002 21:04:17 -0000 1.10 *************** *** 61,70 **** void CpuThreadMethod::deactivate() { ! Prof::prof().activeCpuThreadMethods.removeNoRehash(this); CpuThreadTrace* tt = threadTraces.first(); ! while (tt) { tt->deactivate(); ! tt = threadTraces.next(tt); } } --- 61,71 ---- void CpuThreadMethod::deactivate() { ! Prof::prof().activeCpuThreadMethods.removeNoRehash( this); CpuThreadTrace* tt = threadTraces.first(); ! while( tt) { ! tt->deactivate(); ! tt = threadTraces.next( tt); } } Index: cpuThreadTrace.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/cpuThreadTrace.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** cpuThreadTrace.cpp 21 Nov 2001 22:31:42 -0000 1.8 --- cpuThreadTrace.cpp 15 Apr 2002 21:04:17 -0000 1.9 *************** *** 51,55 **** void CpuThreadTrace::deactivate() { ! Prof::prof().activeCpuThreadTraces.removeNoRehash(this); } --- 51,55 ---- void CpuThreadTrace::deactivate() { ! Prof::prof().activeCpuThreadTraces.removeNoRehash( this); } Index: cpuTrace.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/cpuTrace.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** cpuTrace.cpp 8 Apr 2002 23:30:01 -0000 1.9 --- cpuTrace.cpp 15 Apr 2002 21:04:17 -0000 1.10 *************** *** 60,64 **** void CpuTrace::deactivate() { ! Prof::prof().activeCpuTraces.removeNoRehash(this); } --- 60,71 ---- void CpuTrace::deactivate() { ! Prof::prof().activeCpuTraces.removeNoRehash( this); ! ! CpuThreadTrace* tt = threadTraces.first(); ! while( tt) { ! ! tt->deactivate(); ! tt = threadTraces.next( tt); ! } } Index: sampling.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/sampling.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** sampling.cpp 8 Apr 2002 23:30:01 -0000 1.13 --- sampling.cpp 15 Apr 2002 21:04:17 -0000 1.14 *************** *** 293,298 **** lineno = 0; ! if (!(method = _prof->getMethod(methodId))) ! return; p = new CallTreeItem; --- 293,297 ---- lineno = 0; ! method = _prof->getMethod(methodId); p = new CallTreeItem; *************** *** 331,336 **** else { ! if (!(method = _prof->getMethod(methodId))) ! return; p = new CallTreeItem; --- 330,334 ---- else { ! method = _prof->getMethod(methodId); p = new CallTreeItem; *************** *** 454,491 **** if (_prof->setup.cpu.threadsEnabled) { ! if (_prof->setup.cpu.level == Setup::LEVEL_METHOD) { ! if (!(stat = _prof->getCpuThreadMethod(envId, frames[0].method_id))) { ! PROF_ERROR("CPU SAMPLE", "Cannot get CpuThreadMethod"); ! continue; ! } ! } ! else { ! if (!(stat = _prof->getCpuThreadTrace(envId, numFrames, frames))) { ! PROF_ERROR("CPU SAMPLE", "Cannot get CpuThreadTrace"); ! continue; ! } ! } } else { ! if (_prof->setup.cpu.level == Setup::LEVEL_METHOD) { ! if (!(stat = _prof->getMethod(frames[0].method_id))) { ! PROF_ERROR("CPU SAMPLE", "Method not found"); ! continue; ! } ! } ! else { ! if (!(stat = _prof->getCpuTrace(numFrames, frames))) { ! PROF_ERROR("CPU SAMPLE", "Cannot get CPU trace"); ! continue; ! } ! } } ! stat->addCpuStat((jlong)1, (jlong)0); stat->addCpuStat( -1, 0); } --- 452,475 ---- if (_prof->setup.cpu.threadsEnabled) { ! if (_prof->setup.cpu.level == Setup::LEVEL_METHOD) ! stat = _prof->getCpuThreadMethod(envId, frames[0].method_id); ! else ! ! stat = _prof->getCpuThreadTrace(envId, numFrames, frames); } else { ! if (_prof->setup.cpu.level == Setup::LEVEL_METHOD) ! stat = _prof->getMethod(frames[0].method_id); ! else ! ! stat = _prof->getCpuTrace(numFrames, frames); } ! stat->addCpuStat( 1, 0); stat->addCpuStat( -1, 0); } |
From: Marek P. <ma...@us...> - 2002-04-15 21:04:26
|
Update of /cvsroot/javaprofiler/library/demo/08 In directory usw-pr-cvs1:/tmp/cvs-serv21227/demo/08 Modified Files: README Test.java Log Message: serious bug fixes - monitors, deactivating... interface version checking added new test program for testing of memory profiling added Index: README =================================================================== RCS file: /cvsroot/javaprofiler/library/demo/08/README,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** README 8 Apr 2002 23:30:01 -0000 1.1 --- README 15 Apr 2002 21:04:17 -0000 1.2 *************** *** 1 **** ! Test of objects. --- 1,5 ---- ! Test of objects. This example is a bit strange and slow, because of different ! tests of numbers of objects. So therefore we use shared memory communication ! for that to be as fast as possible. See a manual for how to switch ! communication throught shared memory on. ! Index: Test.java =================================================================== RCS file: /cvsroot/javaprofiler/library/demo/08/Test.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Test.java 8 Apr 2002 23:30:01 -0000 1.1 --- Test.java 15 Apr 2002 21:04:17 -0000 1.2 *************** *** 49,56 **** // stay for a server (so dynamic library must stay for a client) ! iprof = new IProf(); ! iprof.run(); try { // first of all, we need a thread ID Iterator iterator = iprof.getAllThruIterator( 0, --- 49,60 ---- // stay for a server (so dynamic library must stay for a client) ! iprof = new IProf( new CommunSetupShMem()); try { + + iprof.run(); + + while( !iprof.isShutdowned()) Thread.sleep( 1000); + // first of all, we need a thread ID Iterator iterator = iprof.getAllThruIterator( 0, *************** *** 62,67 **** --- 66,90 ---- System.out.println( "object: " + sid.objId); + + if( ((IProf.sObjectInfo)iprof.getInfo( sid.infoId, IProf.OBJECT_INFO)).isArray == IProf.JVMPI_NORMAL_OBJECT) + System.out.println(((IProf.sClassInfo)iprof.getInfo( ((IProf.sObjectInfo)iprof.getInfo( sid.infoId, IProf.OBJECT_INFO)).classObjId, IProf.CLASS_INFO)).className); + System.out.println( "totalnum: " + sid.alloc.allocNumInstancesTotal); System.out.println( "livenum: " + sid.alloc.allocNumInstancesLive); + + LinkedList list = iprof.getAll( sid.objId, IProf.ALLOC_OBJECT_METHODS); + System.out.println( "#methods: " + list.size()); + + if( list.size() > sid.alloc.allocNumInstancesTotal) System.out.println( "ERROR"); + + ListIterator iterator2 = list.listIterator(); + while( iterator2.hasNext()) { + + IProf.sID sid2 = (IProf.sID)iterator2.next(); + System.out.println( "mtotal=" + sid2.alloc.allocNumInstancesTotal); + sid.alloc.allocNumInstancesTotal -= sid2.alloc.allocNumInstancesTotal; + } + + if( sid.alloc.allocNumInstancesTotal != 0) System.out.println( "ERROR2"); System.out.println(); |
From: Marek P. <ma...@us...> - 2002-04-15 21:04:26
|
Update of /cvsroot/javaprofiler/library/demo/06 In directory usw-pr-cvs1:/tmp/cvs-serv21227/demo/06 Modified Files: Test.java Log Message: serious bug fixes - monitors, deactivating... interface version checking added new test program for testing of memory profiling added Index: Test.java =================================================================== RCS file: /cvsroot/javaprofiler/library/demo/06/Test.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** Test.java 6 Mar 2002 22:03:20 -0000 1.4 --- Test.java 15 Apr 2002 21:04:17 -0000 1.5 *************** *** 50,56 **** iprof = new IProf(); - iprof.run(); try { // first of all, we need a thread ID Iterator iterator = iprof.getAllThruIterator( 0, --- 50,58 ---- iprof = new IProf(); try { + + iprof.run(); + // first of all, we need a thread ID Iterator iterator = iprof.getAllThruIterator( 0, |
From: Marek P. <ma...@us...> - 2002-04-15 21:04:26
|
Update of /cvsroot/javaprofiler/library/src/commun In directory usw-pr-cvs1:/tmp/cvs-serv21227/src/commun Modified Files: iprof.cpp iprof.h Log Message: serious bug fixes - monitors, deactivating... interface version checking added new test program for testing of memory profiling added Index: iprof.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun/iprof.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** iprof.cpp 4 Apr 2002 00:49:14 -0000 1.15 --- iprof.cpp 15 Apr 2002 21:04:17 -0000 1.16 *************** *** 89,92 **** --- 89,94 ---- Buffer buf; + int firstTime = 1; + while( 1) { *************** *** 99,116 **** Synchronized sync( communLock); ! buf.clear(); ! (*_commun) >> buf; ! if( _commun->hasFailed()) return (conEstabl = 0); ! jint naction = *(jint*)(buf.getBuffer()); ! jint action = ntohl( naction); // back to host-byte-order ! if( action < 0 || action >= FUNC_COUNT) return (conEstabl = 0); ! (this->*(_func[action]))( buf); ! (*_commun) << buf; ! if( _commun->hasFailed()) return (conEstabl = 0); } --- 101,138 ---- Synchronized sync( communLock); ! if( firstTime) { ! ! (*_commun) >> buf; ! if( _commun->hasFailed()) return (conEstabl = 0); ! ! jint version = ntohl( *(const jint*)buf.getBuffer()); ! ! buf.clear(); ! buf += (jint)INTERFACE_VERSION_NUMBER; ! ! (*_commun) << buf; ! if( _commun->hasFailed()) return (conEstabl = 0); ! ! if( version != INTERFACE_VERSION_NUMBER) return (conEstabl = 0); ! ! firstTime = 0; ! } ! else { ! buf.clear(); ! (*_commun) >> buf; ! if( _commun->hasFailed()) return (conEstabl = 0); ! jint naction = *(jint*)(buf.getBuffer()); ! jint action = ntohl( naction); // back to host-byte-order ! if( action < 0 || action >= FUNC_COUNT) return (conEstabl = 0); ! (this->*(_func[action]))( buf); ! ! (*_commun) << buf; ! if( _commun->hasFailed()) return (conEstabl = 0); ! } } Index: iprof.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun/iprof.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** iprof.h 4 Apr 2002 00:49:14 -0000 1.17 --- iprof.h 15 Apr 2002 21:04:17 -0000 1.18 *************** *** 47,50 **** --- 47,53 ---- #include "../list/listItem.h" + /* PLEASE DO NOT FORGET TO INCREASE 'INTERFACE_VERSION_NUMBER' + * CONSTANT OF THIS CLASS WHEN YOU DO ANY CHANGES IN THE INTERFACE. */ + /** Communication interface class. This class implements ** the whole communication interface between this profiler *************** *** 65,68 **** --- 68,74 ---- /// constants enum e { + + /// version number of communication interface + INTERFACE_VERSION_NUMBER = 1, /// number of methods of the interface |
From: Marek P. <ma...@us...> - 2002-04-15 21:04:23
|
Update of /cvsroot/javaprofiler/library/demo/03 In directory usw-pr-cvs1:/tmp/cvs-serv21227/demo/03 Modified Files: Test.java Log Message: serious bug fixes - monitors, deactivating... interface version checking added new test program for testing of memory profiling added Index: Test.java =================================================================== RCS file: /cvsroot/javaprofiler/library/demo/03/Test.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Test.java 28 Nov 2001 23:34:52 -0000 1.1 --- Test.java 15 Apr 2002 21:04:15 -0000 1.2 *************** *** 67,73 **** // sockets are used by default iprof = new IProf(); - iprof.run(); try { // run GC in a cycle while program is running while( !iprof.isShutdowned()) { --- 67,75 ---- // sockets are used by default iprof = new IProf(); try { + + iprof.run(); + // run GC in a cycle while program is running while( !iprof.isShutdowned()) { |
From: Lukas P. <pe...@us...> - 2002-04-15 20:08:08
|
Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime In directory usw-pr-cvs1:/tmp/cvs-serv25095 Modified Files: AllocTypeMethodR.java AllocTypeThreadR.java ImageR.java MethodR.java ThreadR.java Added Files: AllocThreadMethodR.java AllocTypeThreadMethodR.java Log Message: added classes --- NEW FILE: AllocThreadMethodR.java --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ package net.sourceforge.javaprofiler.jpiimpl.realtime; import java.util.*; import net.sourceforge.javaprofiler.api.*; import net.sourceforge.javaprofiler.api.Class; import net.sourceforge.javaprofiler.api.Thread; import net.sourceforge.javaprofiler.api.ThreadGroup; import net.sourceforge.javaprofiler.jpiimpl.commun.IProf; import net.sourceforge.javaprofiler.jpiimpl.commun.IProfException; /** Implementation of API AllocThreadMethod * @author Lukas Petru */ public class AllocThreadMethodR extends DataR implements AllocThreadMethod { /** Tells if any data was loaded from profiled VM about this Type. */ private boolean isReady; /** VM Image that constructed this object. */ private ImageR image; /** Object identification. */ private Integer objId; // roots to which this object is linked private ThreadR thread; private MethodR location; // parents // memory info private long numLiveInstances; private long numTotalInstances; private long sizeLiveInstances; private long sizeTotalInstances; // lists for children private final List allocTypeThreadMethods=new ArrayList(0); // unmodifiable variants of lists for children private final List roAllocTypeThreadMethods=Collections.unmodifiableList( allocTypeThreadMethods); /** Constructs multi-rooted object * @param typeId Identification of <code>AllocTypeR</code> object. Should * be null if N/A. * @param threadId Identification of <code>ThreadR</code> object. Should * be null if N/A. * @param locationId Identification of <code>Location</code> object. * Should be null if N/A. * @param sid Object with data from communication layer. * @param RtImage <code>VirtualMachineImage</code> object to which this * object shall belong */ AllocThreadMethodR(Integer typeId, Integer threadId, Integer locationId, IProf.sID sid, ImageR RtImage) { image=RtImage; objId=new Integer(sid.objId); // resolve roots thread=image.resolveThread(threadId); location=image.resolveMethod(locationId); // resolve parents isReady=true; // add to parents' lists thread.addAllocThreadMethod(this); location.addAllocThreadMethod(this); } /** Constructs object with only <code>ID</code>. * @param oId Object identification. * @param RtImage <code>VirtualMachineImage</code> object to which this * object shall belong */ AllocThreadMethodR(Integer oId, ImageR RtImage) { image=RtImage; objId=oId; } // ---------- return child Lists public List getAllocThreadTraces() { //PENDING return Collections.EMPTY_LIST; } public void refreshAllocTypeThreadMethods() { image.extractMultiRoot(this, IProf.ALLOC_THREAD_METHOD_OBJECTS, image.allocTypeThreadMethodFactory); } public List getAllocTypeThreadMethods() { if ( image.getAlwaysRefresh() ) refreshAllocTypeThreadMethods(); return roAllocTypeThreadMethods; } // ---------- return parents public Thread getParentThread() { needConstructed(); return thread; } public Method getParentMethod() { needConstructed(); return location; } // ---------- return roots of this object /** Returns AllocType root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public AllocTypeR getAllocType() { return null; } /** Returns Thread root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public ThreadR getThread() { needConstructed(); return thread; } /** Returns Location root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public Location getLocation() { needConstructed(); return location; } // ---------- profiler statistic public long getNumOfLiveInstances() { conditionalRefresh(); return numLiveInstances; } public long getTotalNumOfInstances() { conditionalRefresh(); return numTotalInstances; } public long getSizeOfLiveInstances() { conditionalRefresh(); return sizeLiveInstances; } public long getTotalSizeOfInstances() { conditionalRefresh(); return sizeTotalInstances; } // ---------- refresh /** Refreshes statistics. */ public void refresh() { IProf.sData data; try { data = image.getIProf().getData(objId.intValue(), IProf.ALLOC_DATA); } catch (IProfException e) { throw new RuntimeException(e); } setData((IProf.sAllocStatData) data.statData); } // ---------- private / package void addAllocTypeThreadMethod(AllocTypeThreadMethod o) { allocTypeThreadMethods.add(o); } /** Determines whether refresh should be done and does, if so. */ private void conditionalRefresh() { if (image.getAlwaysRefresh()) refresh(); } private void needConstructed() { if (!isReady) { IProf.sParents parents; try { parents=image.getIProf().getParents(objId.intValue()); } catch (IProfException e) { throw new RuntimeException(e); } // link to parents Integer threadId=new Integer(parents.parentUpObjId); thread=image.resolveThread(threadId); Integer locationId=new Integer(parents.parentLeftObjId); location=image.resolveMethod(locationId); // link to roots // (same as parents) isReady=true; // add to parents' lists thread.addAllocThreadMethod(this); location.addAllocThreadMethod(this); } } /** Finishes object construction with info gained from profiled VM. * @param sid Object info. */ void construct(IProf.sID sid) { // not yet determined, how to use this method } /** Fills object with data gained from profiled VM. * @param data Data. */ void setData(IProf.sAllocStatData allocData) { numLiveInstances=allocData.allocNumInstancesLive; numTotalInstances=allocData.allocNumInstancesTotal; sizeLiveInstances=allocData.allocSizeInstancesLive; sizeTotalInstances=allocData.allocSizeInstancesTotal; } /** Fills object with data gained from profiled VM. * @param sid Object info and data. */ void setData(IProf.sID sid) { setData(sid.alloc); } /** Returns number that identifies object for profiler library. */ Integer getId() { return objId; } public String toString() { return getThread() + "-" + getLocation(); } } --- NEW FILE: AllocTypeThreadMethodR.java --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ package net.sourceforge.javaprofiler.jpiimpl.realtime; import java.util.*; import net.sourceforge.javaprofiler.api.*; import net.sourceforge.javaprofiler.api.Class; import net.sourceforge.javaprofiler.api.Thread; import net.sourceforge.javaprofiler.api.ThreadGroup; import net.sourceforge.javaprofiler.jpiimpl.commun.IProf; import net.sourceforge.javaprofiler.jpiimpl.commun.IProfException; /** Implementation of API AllocTypeThreadMethod * @author Lukas Petru */ public class AllocTypeThreadMethodR extends DataR implements AllocTypeThreadMethod { /** Tells if any data was loaded from profiled VM about this Type. */ private boolean isReady; /** VM Image that constructed this object. */ private ImageR image; /** Object identification. */ private final Integer objId; // roots to which this object is linked private AllocTypeR type; private ThreadR thread; private MethodR location; // parents private AllocTypeMethodR typeMethod; private AllocTypeThreadR typeThread; private AllocThreadMethodR threadMethod; // memory info private long numLiveInstances; private long numTotalInstances; private long sizeLiveInstances; private long sizeTotalInstances; /** Constructs multi-rooted object * @param typeId Identification of <code>AllocTypeR</code> object. Should * be null if N/A. * @param threadId Identification of <code>ThreadR</code> object. Should * be null if N/A. * @param locationId Identification of <code>Location</code> object. * Should be null if N/A. * @param sid Object with data from communication layer. * @param RtImage <code>VirtualMachineImage</code> object to which this * object shall belong */ AllocTypeThreadMethodR(Integer typeId, Integer threadId, Integer locationId, IProf.sID sid, ImageR RtImage) { image=RtImage; objId=new Integer(sid.objId); // resolve roots type=image.resolveAllocType(typeId); thread=image.resolveThread(threadId); location=image.resolveMethod(locationId); // resolve parents Integer typeMethodId=new Integer(sid.parentLeftObjId); if (image.containsId(typeMethodId)) typeMethod=(AllocTypeMethodR) image.getObject(typeMethodId); else { typeMethod=new AllocTypeMethodR(typeMethodId, image); image.putObject(typeMethodId, typeMethod); } Integer typeThreadId=new Integer(sid.parentUpObjId); if (image.containsId(typeThreadId)) typeThread=(AllocTypeThreadR) image.getObject(typeThreadId); else { typeThread=new AllocTypeThreadR(typeThreadId, image); image.putObject(typeThreadId, typeThread); } Integer threadMethodId=new Integer(sid.parentRightObjId); if (image.containsId(threadMethodId)) threadMethod=(AllocThreadMethodR) image.getObject(threadMethodId); else { threadMethod=new AllocThreadMethodR(threadMethodId, image); image.putObject(threadMethodId, threadMethod); } isReady=true; // add to parents' lists typeMethod.addAllocTypeThreadMethod(this); typeThread.addAllocTypeThreadMethod(this); threadMethod.addAllocTypeThreadMethod(this); } /** Constructs object with only <code>ID</code>. * @param oId Object identification. * @param RtImage <code>VirtualMachineImage</code> object to which this * object shall belong */ AllocTypeThreadMethodR(Integer oId, ImageR RtImage) { image=RtImage; objId=oId; } // ---------- return child Lists public List getAllocTypeThreadTraces() { //PENDING return Collections.EMPTY_LIST; } // ---------- return parents public AllocTypeMethod getParentAllocTypeMethod() { needConstructed(); return typeMethod; } public AllocThreadMethod getParentAllocThreadMethod() { needConstructed(); return threadMethod; } public AllocTypeThread getParentAllocTypeThread() { needConstructed(); return typeThread; } // ---------- return roots of this object /** Returns AllocType root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public AllocTypeR getAllocType() { needConstructed(); return type; } /** Returns Thread root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public ThreadR getThread() { needConstructed(); return thread; } /** Returns Location root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public Location getLocation() { needConstructed(); return location; } // ---------- profiler statistic public long getNumOfLiveInstances() { conditionalRefresh(); return numLiveInstances; } public long getTotalNumOfInstances() { conditionalRefresh(); return numTotalInstances; } public long getSizeOfLiveInstances() { conditionalRefresh(); return sizeLiveInstances; } public long getTotalSizeOfInstances() { conditionalRefresh(); return sizeTotalInstances; } // ---------- refresh /** Refreshes statistics. */ public void refresh() { IProf.sData data; try { data = image.getIProf().getData(objId.intValue(), IProf.ALLOC_DATA); } catch (IProfException e) { throw new RuntimeException(e); } setData((IProf.sAllocStatData) data.statData); } // ---------- private / package /** Determines whether refresh should be done and does, if so. */ private void conditionalRefresh() { if (image.getAlwaysRefresh()) refresh(); } private void needConstructed() { if (!isReady) { IProf.sParents parents; try { parents=image.getIProf().getParents(objId.intValue()); } catch (IProfException e) { throw new RuntimeException(e); } // link to parents Integer typeMethodId=new Integer(parents.parentLeftObjId); if (image.containsId(typeMethodId)) typeMethod=(AllocTypeMethodR) image.getObject(typeMethodId); else { typeMethod=new AllocTypeMethodR(typeMethodId, image); image.putObject(typeMethodId, typeMethod); } Integer typeThreadId=new Integer(parents.parentUpObjId); if (image.containsId(typeThreadId)) typeThread=(AllocTypeThreadR) image.getObject(typeThreadId); else { typeThread=new AllocTypeThreadR(typeThreadId, image); image.putObject(typeThreadId, typeThread); } Integer threadMethodId=new Integer(parents.parentRightObjId); if (image.containsId(threadMethodId)) threadMethod=(AllocThreadMethodR) image.getObject(threadMethodId); else { threadMethod=new AllocThreadMethodR(threadMethodId, image); image.putObject(threadMethodId, threadMethod); } // link to roots type=typeThread.getAllocType(); thread=typeThread.getThread(); location=(MethodR) typeMethod.getLocation(); isReady=true; // add to parents' lists typeMethod.addAllocTypeThreadMethod(this); typeThread.addAllocTypeThreadMethod(this); threadMethod.addAllocTypeThreadMethod(this); } } /** Finishes object construction with info gained from profiled VM. * @param sid Object info. */ void construct(IProf.sID sid) { // not yet determined, how to use this method } /** Fills object with data gained from profiled VM. * @param data Data. */ void setData(IProf.sAllocStatData allocData) { numLiveInstances=allocData.allocNumInstancesLive; numTotalInstances=allocData.allocNumInstancesTotal; sizeLiveInstances=allocData.allocSizeInstancesLive; sizeTotalInstances=allocData.allocSizeInstancesTotal; } /** Fills object with data gained from profiled VM. * @param sid Object info and data. */ void setData(IProf.sID sid) { setData(sid.alloc); } /** Returns number that identifies object for profiler library. */ Integer getId() { return objId; } public String toString() { return getAllocType() + "-" + getThread() + "-" + getLocation(); } } Index: AllocTypeMethodR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocTypeMethodR.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** AllocTypeMethodR.java 10 Apr 2002 16:01:15 -0000 1.1 --- AllocTypeMethodR.java 15 Apr 2002 19:46:05 -0000 1.2 *************** *** 65,72 **** --- 65,75 ---- // lists for children private final List allocTypeTraces=new ArrayList(0); + private final List allocTypeThreadMethods=new ArrayList(0); // unmodifiable variants of lists for children private final List roAllocTypeTraces=Collections.unmodifiableList( allocTypeTraces); + private final List roAllocTypeThreadMethods=Collections.unmodifiableList( + allocTypeThreadMethods); /** Constructs multi-rooted object *************** *** 159,165 **** } public List getAllocTypeThreadMethods() { ! //PENDING ! return Collections.EMPTY_LIST; } --- 162,174 ---- } + public void refreshAllocTypeThreadMethods() { + image.extractMultiRoot(this, IProf.ALLOC_OBJECT_METHOD_THREADS, + image.allocTypeThreadMethodFactory); + } + public List getAllocTypeThreadMethods() { ! if ( image.getAlwaysRefresh() ) ! refreshAllocTypeThreadMethods(); ! return roAllocTypeThreadMethods; } *************** *** 205,208 **** --- 214,221 ---- void addAllocTypeTrace(AllocTypeTrace o) { allocTypeTraces.add(o); + } + + void addAllocTypeThreadMethod(AllocTypeThreadMethod o) { + allocTypeThreadMethods.add(o); } Index: AllocTypeThreadR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/AllocTypeThreadR.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** AllocTypeThreadR.java 10 Apr 2002 16:01:15 -0000 1.1 --- AllocTypeThreadR.java 15 Apr 2002 19:46:06 -0000 1.2 *************** *** 151,155 **** public void refreshAllocTypeThreadMethods() { ! //PENDING } --- 151,156 ---- public void refreshAllocTypeThreadMethods() { ! image.extractMultiRoot(this, IProf.ALLOC_THREAD_OBJECT_METHODS, ! image.allocTypeThreadMethodFactory); } Index: ImageR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/ImageR.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** ImageR.java 10 Apr 2002 16:01:15 -0000 1.1 --- ImageR.java 15 Apr 2002 19:46:06 -0000 1.2 *************** *** 108,111 **** --- 108,113 ---- final Constructor allocTypeTraceFactory; final Constructor allocTypeThreadFactory; + final Constructor allocThreadMethodFactory; + final Constructor allocTypeThreadMethodFactory; Set getAllFlags=new HashSet(); *************** *** 201,204 **** --- 203,212 ---- "net.sourceforge.javaprofiler.jpiimpl.realtime.AllocTypeThreadR") .getDeclaredConstructor(mrParameterTypes); + allocThreadMethodFactory=java.lang.Class.forName( + "net.sourceforge.javaprofiler.jpiimpl.realtime.AllocThreadMethodR") + .getDeclaredConstructor(mrParameterTypes); + allocTypeThreadMethodFactory=java.lang.Class.forName( + "net.sourceforge.javaprofiler.jpiimpl.realtime.AllocTypeThreadMethodR") + .getDeclaredConstructor(mrParameterTypes); } catch (ClassNotFoundException e) { throw new RuntimeException(e); *************** *** 329,332 **** --- 337,345 ---- case IProf.ALLOC_OBJECT_THREADS: return THREAD_KEY; case IProf.ALLOC_THREAD_OBJECTS: return TYPE_KEY; + case IProf.ALLOC_THREAD_METHODS: return LOCATION_KEY; + case IProf.ALLOC_METHOD_THREADS: return THREAD_KEY; + case IProf.ALLOC_OBJECT_METHOD_THREADS: return THREAD_KEY; + case IProf.ALLOC_THREAD_OBJECT_METHODS: return LOCATION_KEY; + case IProf.ALLOC_THREAD_METHOD_OBJECTS: return TYPE_KEY; default: throw new RuntimeException("No branch in switch!"); } Index: MethodR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/MethodR.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** MethodR.java 10 Apr 2002 16:01:15 -0000 1.1 --- MethodR.java 15 Apr 2002 19:46:06 -0000 1.2 *************** *** 76,83 **** // lists for children ! private List cpuTraces=new ArrayList(0);; ! private List allocTraces=new ArrayList(0);; ! private List monTraces=new ArrayList(0);; ! private List allocTypeMethods=new ArrayList(0);; // unmodifiable variants of lists for children --- 76,84 ---- // lists for children ! private List cpuTraces=new ArrayList(0); ! private List allocTraces=new ArrayList(0); ! private List monTraces=new ArrayList(0); ! private List allocTypeMethods=new ArrayList(0); ! private List allocThreadMethods=new ArrayList(0); // unmodifiable variants of lists for children *************** *** 90,93 **** --- 91,96 ---- private List roAllocTypeMethods=Collections.unmodifiableList( allocTypeMethods); + private List roAllocThreadMethods=Collections.unmodifiableList( + allocThreadMethods); /** Constructs new object with info. *************** *** 179,185 **** } public List getAllocThreadMethods() { ! //PENDING ! return Collections.EMPTY_LIST; } --- 182,194 ---- } + public void refreshAllocThreadMethods() { + image.extractMultiRoot(this, IProf.ALLOC_METHOD_THREADS, + image.allocThreadMethodFactory); + } + public List getAllocThreadMethods() { ! if ( image.getAlwaysRefresh() ) ! refreshAllocThreadMethods(); ! return roAllocThreadMethods; } *************** *** 301,304 **** --- 310,317 ---- void addAllocTypeMethod(AllocTypeMethod o) { allocTypeMethods.add(o); + } + + void addAllocThreadMethod(AllocThreadMethod o) { + allocThreadMethods.add(o); } Index: ThreadR.java =================================================================== RCS file: /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime/ThreadR.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** ThreadR.java 10 Apr 2002 16:01:15 -0000 1.1 --- ThreadR.java 15 Apr 2002 19:46:06 -0000 1.2 *************** *** 78,85 **** --- 78,88 ---- // lists for children private final List allocTypeThreads=new ArrayList(0); + private final List allocThreadMethods=new ArrayList(0); // unmodifiable variants of lists for children private final List roAllocTypeThreads=Collections.unmodifiableList( allocTypeThreads); + private final List roAllocThreadMethods=Collections.unmodifiableList( + allocThreadMethods); /** Constructs new object with info. *************** *** 133,139 **** } public List getAllocThreadMethods() { ! //PENDING ! return Collections.EMPTY_LIST; } --- 136,148 ---- } + public void refreshAllocThreadMethods() { + image.extractMultiRoot(this, IProf.ALLOC_THREAD_METHODS, + image.allocThreadMethodFactory); + } + public List getAllocThreadMethods() { ! if ( image.getAlwaysRefresh() ) ! refreshAllocThreadMethods(); ! return roAllocThreadMethods; } *************** *** 252,255 **** --- 261,268 ---- void addAllocTypeThread(AllocTypeThread o) { allocTypeThreads.add(o); + } + + void addAllocThreadMethod(AllocThreadMethod o) { + allocThreadMethods.add(o); } |
Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime In directory usw-pr-cvs1:/tmp/cvs-serv12442/realtime Added Files: AllocTraceR.java AllocTypeMethodR.java AllocTypeR.java AllocTypeThreadR.java AllocTypeTraceR.java CPUTraceR.java ClassR.java DataR.java FieldR.java FrameR.java ImageR.java Location.java MethodR.java MonTraceR.java ThreadGroupR.java ThreadR.java Log Message: First version of realtime. Not yet complete. --- NEW FILE: AllocTraceR.java --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ package net.sourceforge.javaprofiler.jpiimpl.realtime; import java.util.*; import net.sourceforge.javaprofiler.api.*; import net.sourceforge.javaprofiler.api.Class; import net.sourceforge.javaprofiler.api.ThreadGroup; import net.sourceforge.javaprofiler.jpiimpl.commun.IProf; import net.sourceforge.javaprofiler.jpiimpl.commun.IProfException; /** Implementation of API AllocTrace * @author Lukas Petru */ public class AllocTraceR extends Location implements AllocTrace { /** Tells if any data was loaded from profiled VM about this Type. */ private boolean isReady; /** VM Image that constructed this object. */ private ImageR image; /** Object identification. */ private Integer objId; // all Lists should be synchronized for implementation be thread-safe // private data accessible via getter methods private final List frames=new ArrayList(0); private final List roFrames=Collections.unmodifiableList(frames); // memory info private long numLiveInstances; private long numTotalInstances; private long sizeLiveInstances; private long sizeTotalInstances; // lists for children private final List allocTypeTraces=new ArrayList(0); // unmodifiable variants of lists for children private final List roAllocTypeTraces=Collections.unmodifiableList( allocTypeTraces); /** Constructs new object with info. * @param sid Object with data from communication layer. * @param RtImage <code>VirtualMachineImage</code> object to which this * object shall belong */ AllocTraceR(IProf.sID sid, ImageR RtImage) { image = RtImage; objId = new Integer(sid.objId); construct((IProf.sTraceInfo) sid.info); } /** Creates object with only Id and no info / data. * @param oId Identification of object as assigned by communication layer. * @param RtImage <code>VirtualMachineImage</code> object to which this * object shall belong */ AllocTraceR(Integer oId, ImageR RtImage) { objId = oId; image = RtImage; } // info getter methods public List getFrames() { needConstructed(); return roFrames; } public Method getParentMethod() { needConstructed(); return ((Frame) frames.get(0)).getMethod(); } // children lists getter methods public List getAllocThreadTraces() { return Collections.EMPTY_LIST; } public void refreshAllocTypeTraces() { image.extractMultiRoot(this, IProf.ALLOC_TRACE_OBJECTS, image.allocTypeTraceFactory); } public List getAllocTypeTraces() { if ( image.getAlwaysRefresh() ) refreshAllocTypeTraces(); return roAllocTypeTraces; } // image getter method public VirtualMachineImage getVirtualMachineImage() { return image; } public VirtualMachineImage getParentVirtualMachineImage() { return image; } // statistics getter methods public long getNumOfLiveInstances() { conditionalRefresh(); return numLiveInstances; } public long getTotalNumOfInstances() { conditionalRefresh(); return numTotalInstances; } public long getSizeOfLiveInstances() { conditionalRefresh(); return sizeLiveInstances; } public long getTotalSizeOfInstances() { conditionalRefresh(); return sizeTotalInstances; } // refresh /** Refreshes statistics. */ public void refresh() { // method should synchronize on image to be thread-safe IProf.sData data; try { data = image.getIProf().getData(objId.intValue(), IProf.ALLOC_DATA); } catch (IProfException e) { throw new RuntimeException(e); } setData((IProf.sAllocStatData) data.statData); } // package / private void addAllocTypeTrace(AllocTypeTrace o) { allocTypeTraces.add(o); } // roots /** Returns AllocType root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public AllocTypeR getAllocType() { return null; } /** Returns Thread root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public ThreadR getThread() { return null; } /** Returns Location root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public Location getLocation() { return this; } /** Finishes object construction with info gained from profiled VM. * @param sid Object info. */ void construct(IProf.sID sid) { // method should be synchronized to be thread-safe (because of // isReady) if (!isReady) construct((IProf.sTraceInfo) sid.info); } /** Finishes object construction. * @param info <code>sTraceInfo</code> object with data from * communication layer. */ private void construct (IProf.sTraceInfo info) { Frame caller=null; int i; for (i=info.numFrames-1; i>=0; i--) { caller=new FrameR(info.frames[i], caller, image); frames.add(caller); } isReady = true; ((MethodR) getParentMethod()).addAllocTrace(this); } /** Tests if object needs to load its info and does, if so. */ private void needConstructed() { // method should be synchronized to be thread-safe (because of // isReady) if (!isReady) { IProf.sTraceInfo info; try { info = (IProf.sTraceInfo) image.getIProf(). getInfo(objId.intValue(), IProf.TRACE_INFO); } catch (IProfException e) { throw new RuntimeException(e); } construct(info); } } /** Determines whether refresh should be done and does, if so. */ private void conditionalRefresh() { if (image.getAlwaysRefresh()) refresh(); } /** Fills object with data gained from profiled VM. * @param data Data. */ void setData(IProf.sAllocStatData allocData) { numLiveInstances=allocData.allocNumInstancesLive; numTotalInstances=allocData.allocNumInstancesTotal; sizeLiveInstances=allocData.allocSizeInstancesLive; sizeTotalInstances=allocData.allocSizeInstancesTotal; } /** Fills object with data gained from profiled VM. * @param sid Object info and data. */ void setData(IProf.sID sid) { setData(sid.alloc); } /** Returns number that identifies object for profiler library. */ Integer getId() { return objId; } public String toString() { return "trace of " + getParentMethod(); } } --- NEW FILE: AllocTypeMethodR.java --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ package net.sourceforge.javaprofiler.jpiimpl.realtime; import java.util.*; import net.sourceforge.javaprofiler.api.*; import net.sourceforge.javaprofiler.api.Class; import net.sourceforge.javaprofiler.jpiimpl.commun.IProf; import net.sourceforge.javaprofiler.jpiimpl.commun.IProfException; /** Implementation of API AllocTypeMethod * @author Lukas Petru */ public class AllocTypeMethodR extends DataR implements AllocTypeMethod { /** Tells if any data was loaded from profiled VM about this Type. */ private boolean isReady; /** VM Image that constructed this object. */ private ImageR image; /** Object identification. */ private final Integer objId; // roots to which this object is linked private AllocTypeR type; private MethodR location; // memory info private long numLiveInstances; private long numTotalInstances; private long sizeLiveInstances; private long sizeTotalInstances; // lists for children private final List allocTypeTraces=new ArrayList(0); // unmodifiable variants of lists for children private final List roAllocTypeTraces=Collections.unmodifiableList( allocTypeTraces); /** Constructs multi-rooted object * @param typeId Identification of <code>AllocTypeR</code> object. Should * be null if N/A. * @param threadId Identification of <code>ThreadR</code> object. Should * be null if N/A. * @param locationId Identification of <code>Location</code> object. * Should be null if N/A. * @param sid Object with data from communication layer. * @param RtImage <code>VirtualMachineImage</code> object to which this * object shall belong */ AllocTypeMethodR(Integer typeId, Integer threadId, Integer locationId, IProf.sID sid, ImageR RtImage) { image=RtImage; objId=new Integer(sid.objId); // resolve roots type=image.resolveAllocType(typeId); location=image.resolveMethod(locationId); isReady=true; // add to parents' lists type.addAllocTypeMethod(this); location.addAllocTypeMethod(this); } /** Constructs object with only <code>ID</code>. * @param oId Object identification. * @param RtImage <code>VirtualMachineImage</code> object to which this * object shall belong */ AllocTypeMethodR(Integer oId, ImageR RtImage) { image=RtImage; objId=oId; } // ---------- return parents public AllocType getParentAllocType() { needConstructed(); return type; } public Method getParentMethod() { needConstructed(); return location; } public Method getMethod() { needConstructed(); return location; } // ---------- return roots of this object /** Returns AllocType root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public AllocTypeR getAllocType() { needConstructed(); return type; } /** Returns Thread root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public ThreadR getThread() { return null; } /** Returns Location root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public Location getLocation() { needConstructed(); return location; } // ---------- return child Lists public void refreshAllocTypeTraces() { image.extractMultiRoot(this, IProf.ALLOC_OBJECT_METHOD_TRACES, image.allocTypeTraceFactory); } public List getAllocTypeTraces() { if ( image.getAlwaysRefresh() ) refreshAllocTypeTraces(); return roAllocTypeTraces; } public List getAllocTypeThreadMethods() { //PENDING return Collections.EMPTY_LIST; } // ---------- profiler statistic public long getNumOfLiveInstances() { conditionalRefresh(); return numLiveInstances; } public long getTotalNumOfInstances() { conditionalRefresh(); return numTotalInstances; } public long getSizeOfLiveInstances() { conditionalRefresh(); return sizeLiveInstances; } public long getTotalSizeOfInstances() { conditionalRefresh(); return sizeTotalInstances; } // ---------- refresh /** Refreshes statistics. */ public void refresh() { IProf.sData data; try { data = image.getIProf().getData(objId.intValue(), IProf.ALLOC_DATA); } catch (IProfException e) { throw new RuntimeException(e); } setData((IProf.sAllocStatData) data.statData); } // ---------- private / package void addAllocTypeTrace(AllocTypeTrace o) { allocTypeTraces.add(o); } /** Determines whether refresh should be done and does, if so. */ private void conditionalRefresh() { if (image.getAlwaysRefresh()) refresh(); } private void needConstructed() { if (!isReady) { IProf.sParents parents; try { parents=image.getIProf().getParents(objId.intValue()); } catch (IProfException e) { throw new RuntimeException(e); } // resolve roots type=image.resolveAllocType(new Integer(parents.parentUpObjId)); location=image.resolveMethod(new Integer(parents.parentLeftObjId)); isReady=true; // add to parents' lists type.addAllocTypeMethod(this); location.addAllocTypeMethod(this); } } /** Finishes object construction with info gained from profiled VM. * @param sid Object info. */ void construct(IProf.sID sid) { // not yet determined, how to use this method } /** Fills object with data gained from profiled VM. * @param data Data. */ void setData(IProf.sAllocStatData allocData) { numLiveInstances=allocData.allocNumInstancesLive; numTotalInstances=allocData.allocNumInstancesTotal; sizeLiveInstances=allocData.allocSizeInstancesLive; sizeTotalInstances=allocData.allocSizeInstancesTotal; } /** Fills object with data gained from profiled VM. * @param sid Object info and data. */ void setData(IProf.sID sid) { setData(sid.alloc); } /** Returns number that identifies object for profiler library. */ Integer getId() { return objId; } public String toString() { return getAllocType() + "-" + getLocation(); } } --- NEW FILE: AllocTypeR.java --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ package net.sourceforge.javaprofiler.jpiimpl.realtime; import java.util.*; import net.sourceforge.javaprofiler.api.*; import net.sourceforge.javaprofiler.api.Class; import net.sourceforge.javaprofiler.api.ThreadGroup; import net.sourceforge.javaprofiler.jpiimpl.commun.IProf; import net.sourceforge.javaprofiler.jpiimpl.commun.IProfException; /** Implementation of API AllocType * @author Lukas Petru */ public class AllocTypeR extends DataR implements AllocType { /** Tells if any data was loaded from profiled VM about this Type. */ private boolean isReady; /** VM Image that constructed this object. */ private ImageR image; /** Object identification. */ private Integer objId; // private data accessible via getter methods private String name; private boolean isArray; private boolean isPrimitiveArray; private ClassR componentClass; // memory info private long numLiveInstances; private long numTotalInstances; private long sizeLiveInstances; private long sizeTotalInstances; // lists for children private final List allocTypeMethods=new ArrayList(0); private final List allocTypeTraces=new ArrayList(0); private final List allocTypeThreads=new ArrayList(0); // unmodifiable variants of lists for children private final List roAllocTypeMethods=Collections.unmodifiableList( allocTypeMethods); private final List roAllocTypeTraces=Collections.unmodifiableList( allocTypeTraces); private final List roAllocTypeThreads=Collections.unmodifiableList( allocTypeThreads); /** This constructor will find it's component class on its own through * RtImage. * @param sid Object with data from communication layer. * @param RtImage <code>VirtualMachineImage</code> object to which this * object shall belong */ AllocTypeR(IProf.sID sid, ImageR RtImage) { image = RtImage; objId = new Integer(sid.objId); construct((IProf.sObjectInfo) sid.info); } /** Creates object with only Id and no data. * @param oId Identification of object as assigned by communication layer. * @param RtImage <code>VirtualMachineImage</code> object to which this * object shall belong */ AllocTypeR(Integer oId, ImageR RtImage) { objId = oId; image = RtImage; } // info getter methods /** Returns name of a type. */ public String getName() { needConstructed(); return name; } /** Returns component class of this type. */ public Class getComponentClass() { needConstructed(); return componentClass; } /** Returns true, if this type is an array. */ public boolean isArray() { needConstructed(); return isArray; } /** Returns true, if this type is an array of primitive component type. */ public boolean isArrayOfPrimitives() { needConstructed(); return isPrimitiveArray; } // children lists getter methods public void refreshAllocTypeTraces() { if (! image.getAlwaysRefresh()) refreshAllocTypeMethods(); Iterator it=getAllocTypeMethods().iterator(); while (it.hasNext()) { AllocTypeMethodR o=(AllocTypeMethodR) it.next(); o.refreshAllocTypeTraces(); } } public List getAllocTypeTraces() { if ( image.getAlwaysRefresh() ) refreshAllocTypeTraces(); return roAllocTypeTraces; } public void refreshAllocTypeMethods() { image.extractMultiRoot(this, IProf.ALLOC_OBJECT_METHODS, image.allocTypeMethodFactory); } public List getAllocTypeMethods() { if ( image.getAlwaysRefresh() ) refreshAllocTypeMethods(); return roAllocTypeMethods; } public void refreshAllocTypeThreads() { image.extractMultiRoot(this, IProf.ALLOC_OBJECT_THREADS, image.allocTypeThreadFactory); } public List getAllocTypeThreads() { if ( image.getAlwaysRefresh() ) refreshAllocTypeThreads(); return roAllocTypeThreads; } // image getter method public VirtualMachineImage getVirtualMachineImage () { return image; } public VirtualMachineImage getParentVirtualMachineImage () { return image; } // statistics getter methods public long getNumOfLiveInstances() { conditionalRefresh(); return numLiveInstances; } public long getTotalNumOfInstances() { conditionalRefresh(); return numTotalInstances; } public long getSizeOfLiveInstances() { conditionalRefresh(); return sizeLiveInstances; } public long getTotalSizeOfInstances() { conditionalRefresh(); return sizeTotalInstances; } // refresh /** Refreshes statistics. */ public void refresh() { // method should synchronize on image to be thread-safe IProf.sData data; try { data = image.getIProf().getData(objId.intValue(), IProf.ALLOC_DATA); } catch (IProfException e) { throw new RuntimeException(e); } setData((IProf.sAllocStatData) data.statData); } // roots public AllocTypeR getAllocType() { return this; } public ThreadR getThread() { return null; } public Location getLocation() { return null; } // private / package void addAllocTypeMethod(AllocTypeMethod o) { allocTypeMethods.add(o); } void addAllocTypeTrace(AllocTypeTrace o) { allocTypeTraces.add(o); } void addAllocTypeThread(AllocTypeThread o) { allocTypeThreads.add(o); } /** Finishes object construction with info gained from profiled VM. * @param sid Object info. */ void construct(IProf.sID sid) { // method should be synchronized to be thread-safe (because of // isReady) if (!isReady) construct((IProf.sObjectInfo) sid.info); } /** Finishes object construction. * @param info <code>sObjectInfo</code> object with data from communication layer. * @param component <code>Class</code> object to which this objects links. */ private void construct (IProf.sObjectInfo info, ClassR component) { isArray = true; isPrimitiveArray = component == null; componentClass = component; switch (info.isArray) { case IProf.JVMPI_NORMAL_OBJECT: name = component.getName(); isArray = false; break; case IProf.JVMPI_CLASS: name = component.getName() + "[]"; break; case IProf.JVMPI_BOOLEAN: name = "boolean[]"; //[Z break; case IProf.JVMPI_BYTE: name = "byte[]"; //[B break; case IProf.JVMPI_CHAR: name = "char[]"; //[C break; case IProf.JVMPI_SHORT: name = "short[]"; //[S break; case IProf.JVMPI_INT: name = "int[]"; //[I break; case IProf.JVMPI_LONG: name = "long[]";//[J break; case IProf.JVMPI_FLOAT: name = "float[]"; //[F break; case IProf.JVMPI_DOUBLE: name = "double[]"; //[D break; default: name = ""; } isReady = true; } /** Finishes Type object construction. This method will find component * class of object on its own through image. * @param info <code>sObjectInfo</code> object with data from * communication layer. */ private void construct(IProf.sObjectInfo info) { // resolve component class ClassR component; Integer clId = new Integer(info.classObjId); if (clId.intValue() != 0) component = image.resolveClass(clId); else component = null; construct(info, component); } /** Tests if object needs to load its info and does, if so. */ private void needConstructed() { // method should be synchronized to be thread-safe (because of // isReady) if (!isReady) { IProf.sObjectInfo info; try { info = (IProf.sObjectInfo) image.getIProf(). getInfo(objId.intValue(), IProf.OBJECT_INFO); } catch (IProfException e) { throw new RuntimeException(e); } construct(info); } } /** Determines whether refresh should be done and does, if so. */ private void conditionalRefresh() { if (image.getAlwaysRefresh()) refresh(); } /** Fills object with data gained from profiled VM. * @param data Data. */ void setData(IProf.sAllocStatData allocData) { numLiveInstances=allocData.allocNumInstancesLive; numTotalInstances=allocData.allocNumInstancesTotal; sizeLiveInstances=allocData.allocSizeInstancesLive; sizeTotalInstances=allocData.allocSizeInstancesTotal; } /** Fills object with data gained from profiled VM. * @param sid Object info and data. */ void setData(IProf.sID sid) { setData(sid.alloc); } /** Returns number that identifies object for profiler library. */ Integer getId() { return objId; } public String toString () { return getName(); } } --- NEW FILE: AllocTypeThreadR.java --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ package net.sourceforge.javaprofiler.jpiimpl.realtime; import java.util.*; import net.sourceforge.javaprofiler.api.*; import net.sourceforge.javaprofiler.api.Class; import net.sourceforge.javaprofiler.api.Thread; import net.sourceforge.javaprofiler.api.ThreadGroup; import net.sourceforge.javaprofiler.jpiimpl.commun.IProf; import net.sourceforge.javaprofiler.jpiimpl.commun.IProfException; /** Implementation of API AllocTypeThread * @author Lukas Petru */ public class AllocTypeThreadR extends DataR implements AllocTypeThread { /** Tells if any data was loaded from profiled VM about this Type. */ private boolean isReady; /** VM Image that constructed this object. */ private ImageR image; /** Object identification. */ private final Integer objId; // roots to which this object is linked private AllocTypeR type; private ThreadR thread; // memory info private long numLiveInstances; private long numTotalInstances; private long sizeLiveInstances; private long sizeTotalInstances; // lists for children private final List allocTypeThreadMethods=new ArrayList(0); private final List allocTypeThreadTraces=new ArrayList(0); // unmodifiable variants of lists for children private final List roAllocTypeThreadMethods=Collections.unmodifiableList( allocTypeThreadMethods); private final List roAllocTypeThreadTraces=Collections.unmodifiableList( allocTypeThreadTraces); /** Constructs multi-rooted object * @param typeId Identification of <code>AllocTypeR</code> object. Should * be null if N/A. * @param threadId Identification of <code>ThreadR</code> object. Should * be null if N/A. * @param locationId Identification of <code>Location</code> object. * Should be null if N/A. * @param sid Object with data from communication layer. * @param RtImage <code>VirtualMachineImage</code> object to which this * object shall belong */ AllocTypeThreadR(Integer typeId, Integer threadId, Integer locationId, IProf.sID sid, ImageR RtImage) { image=RtImage; objId=new Integer(sid.objId); // resolve roots type=image.resolveAllocType(typeId); thread=image.resolveThread(threadId); isReady=true; // add to parents' lists type.addAllocTypeThread(this); thread.addAllocTypeThread(this); } /** Constructs object with only <code>ID</code>. * @param oId Object identification. * @param RtImage <code>VirtualMachineImage</code> object to which this * object shall belong */ AllocTypeThreadR(Integer oId, ImageR RtImage) { image=RtImage; objId=oId; } // ---------- return parents public AllocType getParentAllocType() { needConstructed(); return type; } public Thread getParentThread() { needConstructed(); return thread; } // ---------- return roots of this object /** Returns AllocType root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public AllocTypeR getAllocType() { needConstructed(); return type; } /** Returns Thread root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public ThreadR getThread() { needConstructed(); return thread; } /** Returns Location root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public Location getLocation() { needConstructed(); return null; } // ---------- return child Lists public void refreshAllocTypeThreadMethods() { //PENDING } public List getAllocTypeThreadMethods() { if ( image.getAlwaysRefresh() ) refreshAllocTypeThreadMethods(); return roAllocTypeThreadMethods; } public void refreshAllocTypeThreadTraces() { //PENDING } public List getAllocTypeThreadTraces() { if ( image.getAlwaysRefresh() ) refreshAllocTypeThreadTraces(); return roAllocTypeThreadTraces; } // ---------- profiler statistic public long getNumOfLiveInstances() { conditionalRefresh(); return numLiveInstances; } public long getTotalNumOfInstances() { conditionalRefresh(); return numTotalInstances; } public long getSizeOfLiveInstances() { conditionalRefresh(); return sizeLiveInstances; } public long getTotalSizeOfInstances() { conditionalRefresh(); return sizeTotalInstances; } // ---------- refresh /** Refreshes statistics. */ public void refresh() { IProf.sData data; try { data = image.getIProf().getData(objId.intValue(), IProf.ALLOC_DATA); } catch (IProfException e) { throw new RuntimeException(e); } setData((IProf.sAllocStatData) data.statData); } // ---------- private / package void addAllocTypeThreadMethod (AllocTypeThreadMethod o) { allocTypeThreadMethods.add(o); } void addAllocTypeThreadTrace(AllocTypeThreadTrace o) { allocTypeThreadTraces.add(o); } /** Determines whether refresh should be done and does, if so. */ private void conditionalRefresh() { if (image.getAlwaysRefresh()) refresh(); } private void needConstructed() { if (!isReady) { IProf.sParents parents; try { parents=image.getIProf().getParents(objId.intValue()); } catch (IProfException e) { throw new RuntimeException(e); } // resolve roots type=image.resolveAllocType(new Integer(parents.parentLeftObjId)); thread=image.resolveThread(new Integer(parents.parentUpObjId)); isReady=true; // add to parents' lists type.addAllocTypeThread(this); thread.addAllocTypeThread(this); } } /** Finishes object construction with info gained from profiled VM. * @param sid Object info. */ void construct(IProf.sID sid) { // not yet determined, how to use this method } /** Fills object with data gained from profiled VM. * @param data Data. */ void setData(IProf.sAllocStatData allocData) { numLiveInstances=allocData.allocNumInstancesLive; numTotalInstances=allocData.allocNumInstancesTotal; sizeLiveInstances=allocData.allocSizeInstancesLive; sizeTotalInstances=allocData.allocSizeInstancesTotal; } /** Fills object with data gained from profiled VM. * @param sid Object info and data. */ void setData(IProf.sID sid) { setData(sid.alloc); } /** Returns number that identifies object for profiler library. */ Integer getId() { return objId; } public String toString() { return getAllocType() + "-" + getThread(); } } --- NEW FILE: AllocTypeTraceR.java --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ package net.sourceforge.javaprofiler.jpiimpl.realtime; import java.util.*; import net.sourceforge.javaprofiler.api.*; import net.sourceforge.javaprofiler.api.Class; import net.sourceforge.javaprofiler.api.ThreadGroup; import net.sourceforge.javaprofiler.jpiimpl.commun.IProf; import net.sourceforge.javaprofiler.jpiimpl.commun.IProfException; /** Implementation of API AllocTypeTrace * @author Lukas Petru */ public class AllocTypeTraceR extends DataR implements AllocTypeTrace { /** Tells if any data was loaded from profiled VM about this Type. */ private boolean isReady; /** VM Image that constructed this object. */ private ImageR image; /** Object identification. */ private Integer objId; // roots to which this object is linked private AllocTypeR type; private AllocTraceR location; // parents private AllocTypeMethodR method; // memory info private long numLiveInstances; private long numTotalInstances; private long sizeLiveInstances; private long sizeTotalInstances; /** Constructs multi-rooted object * @param typeId Identification of <code>AllocTypeR</code> object. Should * be null if N/A. * @param threadId Identification of <code>ThreadR</code> object. Should * be null if N/A. * @param locationId Identification of <code>Location</code> object. * Should be null if N/A. * @param sid Object with data from communication layer. * @param RtImage <code>VirtualMachineImage</code> object to which this * object shall belong */ AllocTypeTraceR(Integer typeId, Integer threadId, Integer locationId, IProf.sID sid, ImageR RtImage) { image=RtImage; objId=new Integer(sid.objId); // resolve roots type=image.resolveAllocType(typeId); location=image.resolveAllocTrace(locationId); // resolve parent Integer methodId=new Integer(sid.parentUpObjId); if (image.containsId(methodId)) method=(AllocTypeMethodR) image.getObject(methodId); else { method=new AllocTypeMethodR(methodId, image); image.putObject(methodId, method); } isReady=true; // add to parents' lists type.addAllocTypeTrace(this); location.addAllocTypeTrace(this); method.addAllocTypeTrace(this); } /** Constructs object with only <code>ID</code>. * @param oId Object identification. * @param RtImage <code>VirtualMachineImage</code> object to which this * object shall belong */ AllocTypeTraceR(Integer oId, ImageR RtImage) { image=RtImage; objId=oId; } // ---------- return child Lists public List getAllocTypeThreadTraces() { //PENDING return Collections.EMPTY_LIST; } // ---------- return parents public AllocTypeMethod getParentAllocTypeMethod() { needConstructed(); return method; } public AllocType getParentAllocType() { needConstructed(); return type; } public AllocTrace getParentAllocTrace() { needConstructed(); return location; } // ---------- return roots of this object /** Returns AllocType root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public AllocTypeR getAllocType() { needConstructed(); return type; } /** Returns Thread root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public ThreadR getThread() { return null; } /** Returns Location root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public Location getLocation() { needConstructed(); return location; } // ---------- profiler statistic public long getNumOfLiveInstances() { conditionalRefresh(); return numLiveInstances; } public long getTotalNumOfInstances() { conditionalRefresh(); return numTotalInstances; } public long getSizeOfLiveInstances() { conditionalRefresh(); return sizeLiveInstances; } public long getTotalSizeOfInstances() { conditionalRefresh(); return sizeTotalInstances; } // ---------- refresh /** Refreshes statistics. */ public void refresh() { IProf.sData data; try { data = image.getIProf().getData(objId.intValue(), IProf.ALLOC_DATA); } catch (IProfException e) { throw new RuntimeException(e); } setData((IProf.sAllocStatData) data.statData); } // ---------- private / package /** Determines whether refresh should be done and does, if so. */ private void conditionalRefresh() { if (image.getAlwaysRefresh()) refresh(); } private void needConstructed() { if (!isReady) { IProf.sParents parents; try { parents=image.getIProf().getParents(objId.intValue()); } catch (IProfException e) { throw new RuntimeException(e); } // link to parents Integer methodId=new Integer(parents.parentUpObjId); if (image.containsId(methodId)) method=(AllocTypeMethodR) image.getObject(methodId); else method=new AllocTypeMethodR(methodId, image); location=image.resolveAllocTrace(new Integer(parents. parentLeftObjId)); // get type type=method.getAllocType(); isReady=true; // add to parents' and root lists type.addAllocTypeTrace(this); location.addAllocTypeTrace(this); method.addAllocTypeTrace(this); } } /** Finishes object construction with info gained from profiled VM. * @param sid Object info. */ void construct(IProf.sID sid) { // not yet determined, how to use this method } /** Fills object with data gained from profiled VM. * @param data Data. */ void setData(IProf.sAllocStatData allocData) { numLiveInstances=allocData.allocNumInstancesLive; numTotalInstances=allocData.allocNumInstancesTotal; sizeLiveInstances=allocData.allocSizeInstancesLive; sizeTotalInstances=allocData.allocSizeInstancesTotal; } /** Fills object with data gained from profiled VM. * @param sid Object info and data. */ void setData(IProf.sID sid) { setData(sid.alloc); } /** Returns number that identifies object for profiler library. */ Integer getId() { return objId; } public String toString() { return getAllocType() + "-" + getLocation(); } } --- NEW FILE: CPUTraceR.java --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ package net.sourceforge.javaprofiler.jpiimpl.realtime; import java.util.*; import net.sourceforge.javaprofiler.api.*; import net.sourceforge.javaprofiler.api.Class; import net.sourceforge.javaprofiler.jpiimpl.commun.IProf; import net.sourceforge.javaprofiler.jpiimpl.commun.IProfException; /** Implementation of API CPUTrace * @author Lukas Petru */ public class CPUTraceR extends Location implements CPUTrace { /** Tells if any data was loaded from profiled VM about this Type. */ private boolean isReady; /** VM Image that constructed this object. */ private ImageR image; /** Object identification. */ private Integer objId; // all Lists should be synchronized for implementation be thread-safe // private data accessible via getter methods private final List frames=new ArrayList(0); private final List roFrames=Collections.unmodifiableList(frames); // CPU info private long hits; private long pureTime; // lists for children // unmodifiable variants of lists for children /** Constructs new object with info. * @param sid Object with data from communication layer. * @param RtImage <code>VirtualMachineImage</code> object to which this * object shall belong */ CPUTraceR(IProf.sID sid, ImageR RtImage) { image = RtImage; objId = new Integer(sid.objId); construct((IProf.sTraceInfo) sid.info); } /** Creates object with only Id and no info / data. * @param oId Identification of object as assigned by communication layer. * @param RtImage <code>VirtualMachineImage</code> object to which this * object shall belong */ CPUTraceR(Integer oId, ImageR RtImage) { objId = oId; image = RtImage; } // info getter methods public List getFrames() { needConstructed(); return roFrames; } public Method getParentMethod() { needConstructed(); return ((Frame) frames.get(0)).getMethod(); } // children lists getter methods public void refreshCPUThreadTraces() { } public List getCPUThreadTraces() { //PENDING return Collections.EMPTY_LIST; } // image getter method public VirtualMachineImage getVirtualMachineImage() { return image; } public VirtualMachineImage getParentVirtualMachineImage() { return image; } // statistics getter methods public long getNumOfHits() { conditionalRefresh(); return hits; } public long getPureTime() { conditionalRefresh(); return pureTime; } // refresh /** Refreshes statistics. */ public void refresh() { IProf.sData data; try { data = image.getIProf().getData(objId.intValue(), IProf.CPU_DATA); } catch (IProfException e) { throw new RuntimeException(e); } setData((IProf.sCpuStatData) data.statData); } // roots /** Returns AllocType root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public AllocTypeR getAllocType() { return null; } /** Returns Thread root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public ThreadR getThread() { return null; } /** Returns Location root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public Location getLocation() { return this; } // package / private /** Finishes object construction with info gained from profiled VM. * @param sid Object info. */ void construct(IProf.sID sid) { if (!isReady) construct((IProf.sTraceInfo) sid.info); } /** Finishes object construction. * @param info <code>sTraceInfo</code> object with data from * communication layer. */ private void construct (IProf.sTraceInfo info) { Frame caller=null; int i; for (i=info.numFrames-1; i>=0; i--) { caller=new FrameR(info.frames[i], caller, image); frames.add(caller); } isReady = true; ((MethodR) getParentMethod()).addCPUTrace(this); } private void needConstructed() { // lazy object data acquirement if (!isReady) { IProf.sTraceInfo info; try { info = (IProf.sTraceInfo) image.getIProf(). getInfo(objId.intValue(), IProf.TRACE_INFO); } catch (IProfException e) { throw new RuntimeException(e); } construct(info); } } /** Determines whether refresh should be done and does, if so. */ private void conditionalRefresh() { if (image.getAlwaysRefresh()) refresh(); } /** Fills object with data gained from profiled VM. * @param data Data. */ void setData(IProf.sCpuStatData cpuData) { hits=cpuData.hits; pureTime=cpuData.pureTime; } /** Fills object with data gained from profiled VM. * @param sid Object info and data. */ void setData(IProf.sID sid) { setData(sid.cpu); } /** Returns number that identifies object for profiler library. */ Integer getId() { return objId; } public String toString() { return "trace of " + getParentMethod(); } } --- NEW FILE: ClassR.java --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ package net.sourceforge.javaprofiler.jpiimpl.realtime; import java.util.*; import net.sourceforge.javaprofiler.api.*; import net.sourceforge.javaprofiler.api.Class; import net.sourceforge.javaprofiler.jpiimpl.commun.IProf; import net.sourceforge.javaprofiler.jpiimpl.commun.IProfException; /** Implementation of API Class * @author Lukas Petru */ public class ClassR extends DataR implements Class { /** Tells if any data was loaded from profiled VM about this object. */ private boolean isReady; /** VM Image that constructed this object. */ private ImageR image; /** Object identification. */ private final Integer objId; private String name; private String sourceFilename; private int instanceSize; private List fields; private List roFields; // all Lists should be synchronized for implementation be thread-safe // memory info private long numLiveInstances; private long numTotalInstances; private long sizeLiveInstances; private long sizeTotalInstances; // lists for children private final List methods=new ArrayList(0); // unmodifiable variants of lists for children private final List roMethods=Collections.unmodifiableList( methods); /** Creates object with info. * @param sid Object with data from communication layer. * @param RtImage Object that manages this realtime set. */ ClassR(IProf.sID sid, ImageR RtImage) { image=RtImage; objId=new Integer(sid.objId); construct((IProf.sClassInfo) sid.info); } /** Creates object with only Id, no info and no data. * @param oId Identification of object as assigned by communication layer. * @param RtImage Object that manages this realtime set. */ ClassR(Integer oId, ImageR RtImage) { objId=oId; image=RtImage; } // info getter methods public String getName() { needConstructed(); return name; } public String getSourceFileName() { needConstructed(); return sourceFilename; } public int getInstanceSize() { needConstructed(); return instanceSize; } /** Returns list of <code>Field</code>. */ public List getFields() { needConstructed(); return roFields; } // children lists getter methods public void refreshMethods() { image.extractChildRoot(this.objId, IProf.CLASS_METHODS, image. methodFactory); } public List getMethods() { if ( image.getAlwaysRefresh() ) refreshMethods(); return roMethods; } // image getter method public VirtualMachineImage getVirtualMachineImage() { return image; } // statistics getter methods public long getNumOfLiveInstances() { conditionalRefresh(); return numLiveInstances; } public long getTotalNumOfInstances() { conditionalRefresh(); return numTotalInstances; } public long getSizeOfLiveInstances() { conditionalRefresh(); return sizeLiveInstances; } public long getTotalSizeOfInstances() { conditionalRefresh(); return sizeTotalInstances; } // refresh /** Refreshes statistics. */ public void refresh() { // no data from IProf } // roots /** Returns AllocType root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public AllocTypeR getAllocType() { return null; } /** Returns Thread root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public ThreadR getThread() { return null; } /** Returns Location root of multi-rooted object. Returns <code>null * </code> if this root is N / A. */ public Location getLocation() { return null; } // package / private void addMethod(Method o) { methods.add(o); // PENDING event } /** Finishes object construction with info gained from profiled VM. * @param sid Object info. */ void construct(IProf.sID sid) { if (!isReady) construct((IProf.sClassInfo) sid.info); } /** Finishes object construction. * @param info Object <code>sClassInfo</code> with data from * communication layer. */ private void construct(IProf.sClassInfo info) { name=info.className; sourceFilename=info.sourceName; //FIXME instanceSize=0; // fill fields list fields=new ArrayList(); roFields=Collections.unmodifiableList(fields); final int parent=objId.intValue(); Iterator itChildren; { final int direction=IProf.CLASS_FIELDS_STATICS; try { itChildren = image.getIProf().getAllThruIterator(parent, direction, true, true, IProf.NO_OPTIONAL_ARG, true); } catch (IProfException e) { throw new RuntimeException(e); } while (itChildren.hasNext()) { IProf.sID sid=(IProf.sID) itChildren.next(); fields.add(new FieldR(sid, this, true)); } } { final int direction=IProf.CLASS_FIELDS_INSTANCES; try { itChildren = image.getIProf().getAllThruIterator(parent, direction, true, true, IProf.NO_OPTIONAL_ARG, true); } catch (IProfException e) { throw new RuntimeException(e); } while (itChildren.hasNext()) { IProf.sID sid=(IProf.sID) itChildren.next(); fields.add(new FieldR(sid, this, false)); } } isReady=true; } private void needConstructed() { // lazy object data acquirement if (!isReady) { IProf.sClassInfo info; try { info = (IProf.sClassInfo) image.getIProf(). getInfo(objId.intValue(), IProf.CLASS_INFO); } catch (IProfException e) { throw new RuntimeException(e); } construct(info); } } /** Determines whether refresh should be done and does, if so. */ private void conditionalRefresh() { if (image.getAlwaysRefresh()) refresh(); } /** Fills object with data gained from profiled VM. * @param data Data. */ void setData(IProf.sAllocStatData allocData) { numLiveInstances=allocData.allocNumInstancesLive; numTotalInstances=allocData.allocNumInstancesTotal; sizeLiveInstances=allocData.allocSizeInstancesLive; sizeTotalInstances=allocData.allocSizeInstancesTotal; } /** Fills object with data gained from profiled VM. * @param sid Object info and data. */ void setData(IProf.sID sid) { // we don't get any data for Class } /** Returns number that identifies object for profiler library. */ Integer getId() { return objId; } public String toString() { return getName(); } } --- NEW FILE: DataR.java --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ package net.sourceforge.javaprofiler.jpiimpl.realtime; import net.sourceforge.... [truncated message content] |
From: Lukas P. <pe...@us...> - 2002-04-10 18:31:46
|
Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime In directory usw-pr-cvs1:/tmp/cvs-serv11674/realtime Log Message: Directory /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/realtime added to the repository |