From: Marek P. <ma...@us...> - 2001-08-23 23:57:33
|
Update of /cvsroot/javaprofiler/library In directory usw-pr-cvs1:/tmp/cvs-serv1062 Modified Files: README config.mk Log Message: shared memory implementation; java client and dynamic library can now communicate thru sockets or shmem; main README completely rewritten; new classes - for shared memory, semaphores etc.; java native class CommunShMem implementation Index: README =================================================================== RCS file: /cvsroot/javaprofiler/library/README,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** README 2001/07/28 05:13:30 1.17 --- README 2001/08/23 23:57:30 1.18 *************** *** 1,79 **** ! REQUIREMENTS for pre-alpha: - * Microsoft Windows NT4/2000 - Microsoft Windows 9x - SunOS 5.8 ! * Visual C/C++ 6.0 ! Borland C/C++ 5.5.1 (http://www.borland.com) ! GNU C/C++ 3.0 (http://www.gnu.org) ! * JDK 1.3.1 (http://java.sun.com) ! * DOC++ 3.4.7 (http://docpp.sourceforge.net) ! config/ configuration files for various platforms/compilers ! doc/html/ project documentation ! (generated automatically during compilation) ! doc/visio/ data structure scheme of profiler dynamic library ! (mem/cpu profiling), data flows and relations between ! structures; ! note: Visio 2000 or later (download trial version ! at www.microsoft.com) must be used to view these schemes ! there are schemes in JPEG format in doc/visio/jpegs/ ! src/ C++ source files of profiler dynamic library ! src2/ Java source files of the interface to this profiler dynamic library ! COMPILATION: ! * replace "config.mk" file by appropriate one from config/ subdirectory ! copy appropriate configuration file from config/ subdirectory ! (depending on your own system configuration and used compiler) ! to "root" directory of these sources and rename it to "config.mk" ! (so, you replace original file) ! * modify new "config.mk" - paths etc. ! * run "nmake" (for Visual C/C++ 6.0) or other equivalent (eg. "make") ! Win32 platform: ! compile sources by "nmake /f Makefile.mak" (for Visual C/C++) ! or "make -f Makefile.mak" (for Borland C/C++) instead of plain "make" ! Unix platform: ! compile sources by "make" as usually ! --- ! $(MAKE) compile the whole source tree ! $(MAKE) doc generate project documentation only ! $(MAKE) src compile sources only ! $(MAKE) clean clean binary object files (sources remain) ! * where $(MAKE) is appropriate "make" program for given platform/compiler ! --- ! SOLARIS ! compilation and library was tested on SunOS 5.8 SPARC system but it should be ! possible to compile sources on different version of OS (Solaris7) and of course ! on x86 platform ! use GNU make 3.7x as a "make" program (download at ftp://ftp.gnu.org) ! Marek Przeczek, 2001 ! Petr Luner, 2001 --- 1,324 ---- ! Java Profiling Tool ! alpha version ! CONTENTS ! 1. REQUIREMENTS + 1.1 Operating system + 1.2 Programming language + 1.3 Additional tools + 2. DIRECTORY STRUCTURE ! 3. UNSUPPORTED PLATFORMS ! 4. DOWNLOAD ! 5. COMPILATION ! 5.1 Win32 platform ! 5.2 Unix platforms ! 5.3 Make rules ! 6. PROFILING ! 6.1 Example ! 6.2 Profiler dynamic library command-line arguments ! 7. AUTHORS ! 1. REQUIREMENTS ! 1.1 Operating system ! The library is tested for use on the following operating systems; the main reason ! is that for these OSes good Java Virtual Machines exist (meaning with functional ! Java Virtual Machine Profiler Interface - JVMPI or at least JVMPI functions used ! in library's sources are supported). ! * Microsoft Windows NT4/2000 ! * Microsoft Windows 9x ! * SunOS 5.8 ! 1.2 Programming language ! The library sources are written in C++. ! On Win32 platform, Microsoft Visual C/C++ or Borland C/C++ 5.5.1 can be used. ! On Unix platforms (in this time, Solaris only) GNU C/C++ 3.0 _MUST_ be used. ! Genuine Sun Workshop Compilers had problems with creating the dynamic library ! under SunOS. So had the elder versions of GNU C/C++. ! * Visual C/C++ 6.0 ! * Borland C/C++ 5.5.1 ! * GNU C/C++ 3.0 ! Client part of communication interface for accessing data of profiled JVM ! (gained and stored inside the structures of the library) is written in Java. ! Because of stability and standard Sun's JVM is used. ! * JDK 1.3.1 ! 1.3 Additional tools ! These tools are not necessary for building of profiler dynamic library. ! Project documentation is written directly to the sources. So all classes, ! methods and class members are well-documented. For creating of project ! documentation in HTML (or PDF) format, DOC++ (for C++ sources) and JavaDoc ! (for Java sources) are used. ! * DOC++ 3.4.7 ! Data flows, schemes and relations between structures are described using ! Microsoft Visio 2000. These schemes are exported to JPEG format, too. ! * Microsoft Visio 2000 + GNU C/C++ must be used together with GNU make 3.7x. Another versions + of "make" utility can be incompatible with GNU make 3.7x. + * GNU make 3.7x ! ! 2. DIRECTORY STRUCTURE ! ! config/ configuration files for various platforms/compilers ! ! doc/ documentation (most of it is generated during compilation) ! ! doc/html/interface/ project documentation to the sources ! of Java interface to the library ! ! doc/html/library/ project documentation to the sources ! of the profiler dynamic library ! ! doc/html/native/ project documentation to the sources ! of native Java classes of the interface ! ! doc/visio/ data flows, schemes and relations between ! structures inside of profiler dynamic library ! ! doc/visio/jpegs/ Visio files exported to JPEG format ! ! ! src/ C++ sources of profiler dynamic library ! ! src2/ Java sources of the low-level interface to this library ! ! ! 3. UNSUPPORTED PLATFORMS ! ! Sun's JDK for Linux is under high development and JVMPI part is a bit unstable, ! some features are not implemented or have strange behavior. The sources can be ! compiled with no problems under Linux but we do not guarantee the functionality. ! ! Sources should compile on Sun's SunOS 5.7, too. You can use the same configuration ! file as for SunOS 5.8. It doesn't matter if SPARC or x86 platform. ! ! ! 4. DOWNLOAD ! ! Following links can be used for download (or order/buy) of tools needed ! for building of the profiler dynamic library. ! ! * Microsoft Windows 9x/NT4/2000 (www.microsoft.com) ! * SunOS 5.8 (www.sun.com) [free] ! ! * Microsoft Visual C/C++ 6.0 (www.microsoft.com) ! * Borland C/C++ 5.5.1 (www.borland.com) [free] ! * GNU C/C++ 3.0 (gcc.gnu.org) [free] ! ! * JDK 1.3.1 (java.sun.com) [free] ! ! * DOC++ 3.4.7 (docpp.sourceforge.net) [free] ! * Microsoft Visio 2000 (www.microsoft.com) ! * GNU make 3.7x (www.gnu.org) [free] ! ! ! 5. COMPILATION ! ! 5.1 Win32 platform ! ! 5.1.1 replace "config.mk" file by appropriate one from config/ subdirectory ! ! copy appropriate configuration file from config/ subdirectory ! (depending on your own system configuration and used compiler) ! to the top directory of these sources and rename it to "config.mk" ! (so, you replace original file) ! ! 5.1.2 modify new "config.mk" - paths etc. ! ! 5.1.3 run "nmake" (for Visual C/C++ 6.0) or other equivalent (eg. "make") ! ! compile sources by "nmake /f Makefile.mak" (for Visual C/C++) ! or "make -f Makefile.mak" (for Borland C/C++) from top directory ! ! 5.1.4 if successful, following files were created: ! ! src/profiler/profiler.dll profiler dynamic library ! src2/IProf.jar Java interface to dynamic library ! src2/CommunShMem.dll Java native class ! ! doc/html/ project documentation in HTML format ! ! ! 5.2 Unix platforms ! ! 5.2.1 same as 5.1.1 ! ! 5.2.2 same as 5.1.2 ! ! 5.2.3 run "make" from top directory (as usual) ! ! 5.2.4 same as 5.1.4 ! ! ! 5.3 Make rules ! ! $(MAKE) compile the whole source tree ! $(MAKE) doc generate project documentation only ! $(MAKE) src compile sources only ! $(MAKE) clean clean binary object files (sources remain) ! ! where $(MAKE) is appropriate "make" program for given platform/compiler ! ! ! 6. PROFILING ! ! 6.1 Example ! ! following example runs JVM together with our profiler dynamic library, ! "test" is compiled Java program which we want to profile ! ! on Win32 platform ! ! ! C:\> java -Xrunprofiler test ! ! ! or on Unix platforms ! ! ! $ java -Xrunprofiler test ! ! ! How to gain data from the library (or do something else with it) ! ilustrates this simple Java program (eg. a part of some Java IDE) ! ! public class X { ! ! public static void main( String[] args) { ! ! try { ! ! IProf iprof = new IProf(); ! ! iprof.run(); ! ! // this suspends profiled JVM ! iprof.suspendVM(); ! ! // this resumes profiled JVM ! iprof.resumeVM(); ! ! // ... ! ! iprof.stop(); ! } ! catch( IProf_Exception e) { ! ! System.out.println( "error"); ! } ! } ! }; ! ! ! 6.2 Profiler dynamic library command-line arguments ! ! Profiler dynamic library can be set-up thru following command-line arguments: ! ! $ java -Xrunprofiler:arg1=val1,arg2=val2,... <Java program> ! ! ! Argument Value Description ! ---------------------------------------------------------------------------------- ! ! alloc {on|off} turns memory profiling on/off ! default: on ! ! alloc_level {object|method|trace} memory profiling granularity level ! default: trace ! ! object ... low ! method ... medium ! trace ... high ! ! alloc_trace_depth [positive number] maximum number of frames in a trace; ! used when alloc_level=trace ! default: 2 ! ! alloc_thread {on|off} memory profiling data distinguished ! to Java threads ! default: on ! ! cpu {on|off} turn cpu profiling on/off ! default: on ! ! cpu_method {exact|sampling} cpu profiling method ! default: sampling ! ! exact ... slower ! sampling ... faster ! ! cpu_level {method|trace} cpu profiling granularity level ! default: trace ! ! method ... low ! trace ... high ! ! cpu_trace_depth [positive number] maximum number of frames in a trace; ! used when cpu_level=trace ! default: 2 ! ! cpu_thread {on|off} cpu profiling data distinguished ! to Java threads ! default: on ! ! commun_type {socket|shmem} type of communication (media) ! default: shmem ! ! socket ... TCP sockets ! shmem ... shared memory ! ! commun_host [host] hostname of opposite side; ! used when commun_type=socket ! and connect_mode=client ! default: 127.0.0.1 (localhost) ! ! commun_port [positive number] port where the library is listening ! for incoming requests; ! used when commun_type=socket ! and connect_mode=server ! default: 25595 ! ! commun_shmem_id [string 3 chars long] unique identifier of shared memory ! block; it can be only 3 characters ! long, not more ! ! default: com ! ! commun_shmem_size [positive number] shared memory block size (in bytes) ! default: 262144 ! ! connect_mode {server|client} library's role in communication; ! used when commun_type=socket ! default: server ! ! ! 7. AUTHORS ! ! * Marek Przeczek * Petr Luner ! ma...@us... lu...@us... Index: config.mk =================================================================== RCS file: /cvsroot/javaprofiler/library/config.mk,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** config.mk 2001/08/09 23:22:55 1.16 --- config.mk 2001/08/23 23:57:30 1.17 *************** *** 1,11 **** ################################################################ # configuration file ! # Microsoft Windows NT 4.0/2000, x86, Borland C/C++ 5.5.1 # # author: Marek Przeczek ! PROF_LIBRARY_NAME = profiler.dll PROF_JAVA_INTERF_PACKAGE = IProf.jar ################################################################ # PATHS --- 1,13 ---- ################################################################ # configuration file ! # Microsoft Windows NT 4.0/2000, x86, Visual C/C++ 6.0 # # author: Marek Przeczek ! PROF_LIBRARY_NAME = profiler\profiler.dll PROF_JAVA_INTERF_PACKAGE = IProf.jar + NATIVE_LIBRARY_NAME = CommunShMem.dll + ################################################################ # PATHS *************** *** 13,22 **** # do not use "\" as a last character in path definition ! COMPILER_PATH = C:\Borland\BCC55 JAVA_PATH = C:\jdk1.3.1 DOCPP_PATH = C:\Local\doc++ ! CCC = "$(COMPILER_PATH)\Bin\bcc32" ! LD = "$(COMPILER_PATH)\Bin\bcc32" JAVAC = "$(JAVA_PATH)\bin\javac" JAVAH = "$(JAVA_PATH)\bin\javah" --- 15,24 ---- # do not use "\" as a last character in path definition ! COMPILER_PATH = C:\Program Files\Microsoft Visual Studio\VC98 JAVA_PATH = C:\jdk1.3.1 DOCPP_PATH = C:\Local\doc++ ! CCC = "$(COMPILER_PATH)\Bin\cl" ! LD = "$(COMPILER_PATH)\Bin\link" JAVAC = "$(JAVA_PATH)\bin\javac" JAVAH = "$(JAVA_PATH)\bin\javah" *************** *** 29,33 **** # don't modify ! DOCPPFLAGS = -p JDOCFLAGS = -private --- 31,35 ---- # don't modify ! DOCPPFLAGS = -p -I JDOCFLAGS = -private *************** *** 36,69 **** # modify as needed ! DEFINES = -DWIN32 -tWD -tWM -VM -Vd \ ! -w-inl -w-pia -w-rch -w-par -w-aus -w-csu ! INCLUDES = -I$(JAVA_PATH)\include -I$(JAVA_PATH)\include\win32 \ ! -I$(COMPILER_PATH)\Include # debug or not ? # choose one of following two possibilities ! #FLAGS = -Od -D_DEBUG ! FLAGS = -O -O2 -D_DEBUG -6 -f- -k- -Oc -Oi -OS -Ov -v- -x- -RT- ! LDFLAGS = $(DEFINES) -L$(COMPILER_PATH)\Lib \ ! -L$(COMPILER_PATH)\Lib\PSDK LDLIBS = wsock32.lib winmm.lib ! CPPFLAGS = -c $(FLAGS) $(DEFINES) $(INCLUDES) ################################################################ # MAKEFILE ! MFLAGS = -f Makefile.mak ! !include dir.info all: ! for %i in (xxx $(DIRS)) do if not %i == xxx $(MAKE) $(MFLAGS) %i.dir ! for %i in (xxx $(FILES)) do if not %i == xxx $(MAKE) $(MFLAGS) %i.obj clean: ! for %i in (xxx $(CLEAN_FILES)) do if exist %i del %i ! for %i in (xxx $(DIRS)) do if not %i == xxx $(MAKE) $(MFLAGS) %i.clean --- 38,71 ---- # modify as needed ! DEFINES = /DWIN32 ! INCLUDES = /I "$(JAVA_PATH)\include" /I "$(JAVA_PATH)\include\win32" # debug or not ? # choose one of following two possibilities ! FLAGS = /Od /Zi /D_DEBUG /MDd /LDd ! #FLAGS = /O2 /Og /Oi /Ot /Ox /DNDEBUG /MD /LD /G6 /GD ! LDFLAGS = /NOLOGO /DLL /OUT:$(PROF_LIBRARY_NAME) LDLIBS = wsock32.lib winmm.lib + + LDFLAGS2 = /NOLOGO /DLL /OUT:$(NATIVE_LIBRARY_NAME) + LDLIBS2 = wsock32.lib ! CPPFLAGS = /nologo /c $(FLAGS) $(DEFINES) $(INCLUDES) ################################################################ # MAKEFILE ! MFLAGS = /NOLOGO /f Makefile.mak ! include dir.info all: ! for %i in (xxx $(DIRS)) do if not %%i == xxx $(MAKE) $(MFLAGS) %%i.dir ! for %i in (xxx $(FILES)) do if not %%i == xxx $(MAKE) $(MFLAGS) %%i.obj clean: ! for %i in (xxx $(CLEAN_FILES)) do if exist %%i del %%i ! for %i in (xxx $(DIRS)) do if not %%i == xxx $(MAKE) $(MFLAGS) %%i.clean |