From: Marek P. <ma...@us...> - 2001-11-21 22:32:16
|
Update of /cvsroot/javaprofiler/library/src/main In directory usw-pr-cvs1:/tmp/cvs-serv12170/src/main Modified Files: Makefile.rules dir.info includes.h main.cpp Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux Index: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/src/main/Makefile.rules,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Makefile.rules 2001/07/22 23:37:58 1.2 --- Makefile.rules 2001/11/21 22:31:43 1.3 *************** *** 1,3 **** main.o \ ! main.obj: main.cpp includes.h $(CCC) $(CPPFLAGS) main.cpp --- 1,3 ---- main.o \ ! main.obj: main.cpp $(CCC) $(CPPFLAGS) main.cpp Index: dir.info =================================================================== RCS file: /cvsroot/javaprofiler/library/src/main/dir.info,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** dir.info 2001/07/28 04:11:17 1.4 --- dir.info 2001/11/21 22:31:43 1.5 *************** *** 1,3 **** FILES = main - CLEAN_FILES = *.pdb *.obj *.o --- 1,2 ---- Index: includes.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/main/includes.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -r1.25 -r1.26 *** includes.h 2001/09/18 22:19:28 1.25 --- includes.h 2001/11/21 22:31:43 1.26 *************** *** 33,178 **** */ #ifdef WIN32 ! #include <winsock2.h> ! #include <windows.h> ! #include <stdlib.h> ! #include <mmsystem.h> #else ! #include <pthread.h> ! #include <stdlib.h> #include <sys/types.h> #include <netinet/in.h> #include <sys/socket.h> #include <unistd.h> ! #include <sys/time.h> #include <sys/ipc.h> #include <sys/sem.h> #include <sys/shm.h> ! #include <netdb.h> ! #endif ! ! #include <assert.h> ! #include <iostream.h> #include <string.h> ! #include <jvmpi.h> #include <time.h> ! class IdObject; ! struct TraceKey; ! class Class; ! class Method; ! class Trace; ! class Thread; ! struct AllocObjectKey; ! struct AllocObjectMethodKey; ! struct AllocObjectTraceKey; ! struct AllocThreadMethodKey; ! struct AllocThreadTraceKey; ! struct AllocThreadObjectKey; ! struct AllocThreadObjectMethodKey; ! struct AllocThreadObjectTraceKey; ! class AllocTrace; class AllocObject; class AllocObjectMethod; class AllocObjectTrace; class AllocThreadMethod; - class AllocThreadTrace; class AllocThreadObject; class AllocThreadObjectMethod; class AllocThreadObjectTrace; ! ! struct CpuThreadMethodKey; ! struct CpuThreadTraceKey; ! ! class CpuTrace; class CpuThreadMethod; class CpuThreadTrace; ! ! struct MonThreadMethodKey; ! struct MonThreadTraceKey; ! ! class MonTrace; class MonThreadMethod; class MonThreadTrace; ! class AllocInstance; ! class Allocator; ! class Prof; ! class Setup; ! #include "../main/const.h" ! #include "../allocator/allocator.h" ! #include "../string/string.h" ! #include "../prof/lock.h" ! #include "../prof/synchronized.h" ! #include "../delay/delay.h" ! ! #include "../list/refCount.h" ! #include "../list/listItem.h" ! #include "../list/list.h" ! #include "../hash/hash.h" ! ! #include "../commun/buffer.h" ! #include "../commun/binaryFormat.h" ! #include "../commun/commun.h" ! #include "../commun/communSocket.h" ! #include "../commun/statDataModification.h" ! #include "../commun2/objectTable.h" ! #include "../commun2/counter.h" ! #include "../commun2/idObject.h" ! ! #include "../alloc/allocStatData.h" ! #include "../alloc/allocAbstractStatThreadObject.h" ! #include "../cpu/cpuStatData.h" ! #include "../mon/monStatData.h" ! ! #include "../commun/iprof.h" ! #include "../commun3/semaphore.h" ! #include "../commun3/sharedMemory.h" ! #include "../commun3/communShMem.h" ! ! #include "../cpu/cpuStack.h" ! #include "../cpu/sampling.h" ! ! #include "../shared/classField.h" ! #include "../shared/class.h" ! #include "../shared/method.h" ! #include "../shared/traceFrame.h" ! #include "../shared/trace.h" ! #include "../shared/groupThread.h" ! #include "../shared/thread.h" ! ! #include "../alloc/allocTrace.h" ! #include "../alloc/allocObject.h" ! #include "../alloc/allocObjectMethod.h" ! #include "../alloc/allocObjectTrace.h" ! #include "../alloc/allocThreadMethod.h" ! #include "../alloc/allocThreadTrace.h" ! #include "../alloc/allocThreadObject.h" ! #include "../alloc/allocThreadObjectMethod.h" ! #include "../alloc/allocThreadObjectTrace.h" ! ! #include "../cpu/cpuTrace.h" ! #include "../cpu/cpuThreadMethod.h" ! #include "../cpu/cpuThreadTrace.h" ! ! #include "../mon/monTrace.h" ! #include "../mon/monThreadMethod.h" ! #include "../mon/monThreadTrace.h" ! ! #include "../alloc/allocArena.h" ! #include "../alloc/allocInstance.h" ! ! #include "../alloc/allocGlobalRef.h" ! ! #include "../gc/gc.h" ! ! #include "../commun/iprof.h" ! #include "../setup/setup.h" ! #include "../prof/prof.h" --- 33,155 ---- */ + #ifndef _INCLUDES_H_ + #define _INCLUDES_H_ + #ifdef WIN32 ! // WIN32 headers #else ! #ifdef SUNOS ! // SUNOS headers ! #else ! // LINUX headers #include <sys/types.h> #include <netinet/in.h> #include <sys/socket.h> #include <unistd.h> ! #include <netdb.h> ! #include <stdlib.h> #include <sys/ipc.h> #include <sys/sem.h> #include <sys/shm.h> ! #include <sys/time.h> #include <string.h> ! #include <iostream.h> #include <time.h> + #include <signal.h> ! #ifndef USE_RAW_MONITORS ! #include <pthread.h> ! #endif ! #endif ! #endif ! #include <jvmpi.h> ! #ifdef PROF_ERROR_ON ! #define PROF_ERROR(context, error) \ ! Prof::dumpError(context, error, __FILE__, __LINE__) ! #else ! #define PROF_ERROR(context, error) ! #endif // PROF_ERROR_ON ! class Allocator; ! class AllocAbstractStatThreadObject; ! class AllocArena; ! class AllocGlobalRef; ! class AllocInstance; class AllocObject; class AllocObjectMethod; class AllocObjectTrace; + class AllocStatData; class AllocThreadMethod; class AllocThreadObject; class AllocThreadObjectMethod; class AllocThreadObjectTrace; ! class AllocThreadTrace; ! class AllocTrace; ! class Buffer; ! class Class; ! class ClassField; ! class Commun; ! class CommunShMem; ! class CommunSocket; ! class Counter; ! class CpuStack; ! class CpuStatData; class CpuThreadMethod; class CpuThreadTrace; ! class CpuTrace; ! class DataBinaryFormat; ! class Delay; ! class GC; ! class GroupThread; ! class IdObject; ! class InfoBinaryFormat; ! class IProf; ! class ListItem; ! class LI1; ! class LI2; ! class LI3; ! class LI4; ! class LI5; ! class Lock; ! class Method; ! class MonStatData; class MonThreadMethod; class MonThreadTrace; + class MonTrace; + class ObjectTable; + class Prof; + class RefCount; + class Sampling; + class Semaphore; + class Setup; + class SharedMemory; + class StatDataModification; + class String; + class Synchronized; + class Thread; + class Trace; ! template<class T, class K, class L> ! class Hash; ! template<class T, class L> ! class List; ! struct AllocObjectKey; ! struct AllocObjectMethodKey; ! struct AllocObjectTraceKey; ! struct AllocThreadMethodKey; ! struct AllocThreadObjectKey; ! struct AllocThreadObjectMethodKey; ! struct AllocThreadObjectTraceKey; ! struct AllocThreadTraceKey; ! struct CpuThreadTraceKey; ! struct MonThreadMethodKey; ! struct MonThreadTraceKey; ! struct TraceFrame; ! struct TraceKey; ! #endif // _INCLUDES_H_ Index: main.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/main/main.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -r1.24 -r1.25 *** main.cpp 2001/09/18 22:19:28 1.24 --- main.cpp 2001/11/21 22:31:43 1.25 *************** *** 34,37 **** --- 34,38 ---- #include "../main/includes.h" + #include "../prof/prof.h" extern "C" { *************** *** 58,126 **** if( jvm->GetEnv( (void**)&jvmpi_interface, JVMPI_VERSION_1) < 0) return JNI_ERR; - Prof* p = Prof::create( options); - jvmpi_interface->NotifyEvent = Prof::notifyEvent; ! p->jvmpiInterface = jvmpi_interface; ! ! jvmpi_interface->EnableEvent( JVMPI_EVENT_THREAD_END, NULL); ! jvmpi_interface->EnableEvent( JVMPI_EVENT_THREAD_START, NULL); ! ! jvmpi_interface->EnableEvent( JVMPI_EVENT_CLASS_LOAD, NULL); ! // jvmpi_interface->EnableEvent( JVMPI_EVENT_CLASS_LOAD_HOOK, NULL); ! jvmpi_interface->EnableEvent( JVMPI_EVENT_CLASS_UNLOAD, NULL); ! ! // jvmpi_interface->EnableEvent( JVMPI_EVENT_COMPILED_METHOD_LOAD, NULL); ! // jvmpi_interface->EnableEvent( JVMPI_EVENT_COMPILED_METHOD_UNLOAD, NULL); ! ! if( p->setup.cpu.turnedOn && (!p->setup.cpu.sampling)) { ! ! jvmpi_interface->EnableEvent( JVMPI_EVENT_METHOD_ENTRY, NULL); ! // jvmpi_interface->EnableEvent( JVMPI_EVENT_METHOD_ENTRY2, NULL); ! jvmpi_interface->EnableEvent( JVMPI_EVENT_METHOD_EXIT, NULL); ! } ! ! if( p->setup.alloc.turnedOn) { ! ! jvmpi_interface->EnableEvent( JVMPI_EVENT_ARENA_DELETE, NULL); ! jvmpi_interface->EnableEvent( JVMPI_EVENT_ARENA_NEW, NULL); ! ! jvmpi_interface->EnableEvent( JVMPI_EVENT_OBJECT_ALLOC, NULL); ! jvmpi_interface->EnableEvent( JVMPI_EVENT_OBJECT_FREE, NULL); ! jvmpi_interface->EnableEvent( JVMPI_EVENT_OBJECT_MOVE, NULL); - jvmpi_interface->EnableEvent( JVMPI_EVENT_JNI_GLOBALREF_ALLOC, NULL); - jvmpi_interface->EnableEvent( JVMPI_EVENT_JNI_GLOBALREF_FREE, NULL); - jvmpi_interface->EnableEvent( JVMPI_EVENT_JNI_WEAK_GLOBALREF_ALLOC, NULL); - jvmpi_interface->EnableEvent( JVMPI_EVENT_JNI_WEAK_GLOBALREF_FREE, NULL); - } - - if( p->setup.mon.turnedOn) { - - jvmpi_interface->EnableEvent( JVMPI_EVENT_MONITOR_CONTENDED_ENTER, NULL); - jvmpi_interface->EnableEvent( JVMPI_EVENT_MONITOR_CONTENDED_ENTERED, NULL); - // jvmpi_interface->EnableEvent( JVMPI_EVENT_MONITOR_CONTENDED_EXIT, NULL); - - // jvmpi_interface->EnableEvent( JVMPI_EVENT_MONITOR_WAIT, NULL); - jvmpi_interface->EnableEvent( JVMPI_EVENT_MONITOR_WAITED, NULL); - } - - // jvmpi_interface->EnableEvent( JVMPI_EVENT_RAW_MONITOR_CONTENDED_ENTER, NULL); - // jvmpi_interface->EnableEvent( JVMPI_EVENT_RAW_MONITOR_CONTENDED_ENTERED, NULL); - // jvmpi_interface->EnableEvent( JVMPI_EVENT_RAW_MONITOR_CONTENDED_EXIT, NULL); - - jvmpi_interface->EnableEvent( JVMPI_EVENT_GC_FINISH, NULL); - jvmpi_interface->EnableEvent( JVMPI_EVENT_GC_START, NULL); - - // jvmpi_interface->EnableEvent( JVMPI_EVENT_DATA_DUMP_REQUEST, NULL); - // jvmpi_interface->EnableEvent( JVMPI_EVENT_DATA_RESET_REQUEST, NULL); - - // jvmpi_interface->EnableEvent( JVMPI_EVENT_HEAP_DUMP, NULL); - // jvmpi_interface->EnableEvent( JVMPI_EVENT_MONITOR_DUMP, NULL); - // jvmpi_interface->EnableEvent( JVMPI_EVENT_OBJECT_DUMP, NULL); - jvmpi_interface->EnableEvent( JVMPI_EVENT_JVM_INIT_DONE, NULL); - jvmpi_interface->EnableEvent( JVMPI_EVENT_JVM_SHUT_DOWN, NULL); - - // jvmpi_interface->EnableEvent( JVMPI_EVENT_INSTRUCTION_START, NULL); return JNI_OK; --- 59,66 ---- if( jvm->GetEnv( (void**)&jvmpi_interface, JVMPI_VERSION_1) < 0) return JNI_ERR; jvmpi_interface->NotifyEvent = Prof::notifyEvent; ! Prof::create( options, jvmpi_interface); jvmpi_interface->EnableEvent( JVMPI_EVENT_JVM_INIT_DONE, NULL); return JNI_OK; |