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
|
Update of /cvsroot/javaprofiler/library/src2 In directory usw-pr-cvs1:/tmp/cvs-serv1062/src2 Modified Files: Buffer.java CommunSetupSocket.java CommunShMem.java CommunSocket.java IProf.java Makefile.rules dir.info Added Files: CommunShMem.cpp 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 --- NEW FILE: CommunShMem.cpp --- #include "CommunShMem.h" #include "../src/main/includes.h" /** JNI implementation of shared memory communication. This class is ** used by native methods of Java CommunShMem class. It contains ** necessary information about communication - semaphore objects, ** shared memory object and references to used Java class methods. ** ** @see Java CommunShMem class ** ** @author Marek Przeczek */ class NativeCommunShMem { public: /// read-write semaphore Semaphore sem1; /// write-read semaphore Semaphore sem2; /// init semaphore Semaphore isem; /// shared memory SharedMemory shmem; /// indication of a failure jboolean failed; public: /** Constructor. Initializes semaphores and shared memory. ** ** @param shmemId shared memory identifier (3 characters long only) ** @param size size of shared memory */ NativeCommunShMem( const String& shmemId, int size) : sem1( String( "1") + shmemId + "XXXXXXXXXX"), sem2( String( "2") + shmemId + "XXXXXXXXXX"), isem( String( "3") + shmemId + "XXXXXXXXXX", 1), shmem( String( "4") + shmemId + "XXXXXXXXXX", size), failed( JNI_FALSE) {}; /** Get pointer to data. This static method returns pointer ** to object of NativeCommunShMem type associated with ** this instance of Java CommunShMem object. ** ** @param env pointer to JNI environment ** @param obj this object */ static NativeCommunShMem* get( JNIEnv* env, jobject obj); public: /** Get size of buffer. This method is a native call ** of Buffer.getSize() method. ** ** Same as b.getSize() call in Java. ** ** @param env pointer to JNI environment ** @param b instance of Java Buffer object ** ** @return size of buffer */ jint Buffer_getSize( JNIEnv* env, jobject b); /** Get buffer. This method is a native call ** of Buffer.getBuffer() method. ** ** Same as b.getBuffer() call in Java. ** ** @param env pointer to JNI environment ** @param b instance of Java Buffer object ** @param array output variable for JNI byte array identifier ** ** @return pointer to byte array */ jbyte* Buffer_getBuffer( JNIEnv* env, jobject b, jbyteArray& array); /** Clear buffer. This method is a native call ** of Buffer.clear() method. ** ** Same as b.clear() call in Java. ** ** @param env pointer to JNI environment ** @param b instance of Java Buffer object */ void Buffer_clear( JNIEnv* env, jobject b); /** Replace buffer. This method is a native call ** of Buffer.useBuffer() method. ** ** Same as b.useBuffer( buf, size) call in Java. ** ** @param env pointer to JNI environment ** @param b instance of Java Buffer object ** @param buf pointer to byte array to use ** @param size size of 'buf' buffer */ void Buffer_useBuffer( JNIEnv* env, jobject b, jbyte* buf, jint size); }; NativeCommunShMem* NativeCommunShMem::get( JNIEnv* env, jobject obj) { static NativeCommunShMem* n = NULL; if( !n) { jclass clazz = env->GetObjectClass( obj); jfieldID fId = env->GetFieldID( clazz, "data", "J"); jlong data = env->GetLongField( obj, fId); n = *(NativeCommunShMem**)&data; } return n; } jint NativeCommunShMem::Buffer_getSize( JNIEnv* env, jobject b) { static jmethodID mId = NULL; if( !mId) { jclass clazz = env->GetObjectClass( b); mId = env->GetMethodID( clazz, "getSize", "()I"); } return env->CallIntMethod( b, mId); } jbyte* NativeCommunShMem::Buffer_getBuffer( JNIEnv* env, jobject b, jbyteArray& array) { static jmethodID mId = NULL; if( !mId) { jclass clazz = env->GetObjectClass( b); mId = env->GetMethodID( clazz, "getBuffer", "()[B"); } array = (jbyteArray)env->CallObjectMethod( b, mId); return env->GetByteArrayElements( array, NULL); } void NativeCommunShMem::Buffer_clear( JNIEnv* env, jobject b) { static jmethodID mId = NULL; if( !mId) { jclass clazz = env->GetObjectClass( b); mId = env->GetMethodID( clazz, "clear", "()V"); } env->CallVoidMethod( b, mId); } void NativeCommunShMem::Buffer_useBuffer( JNIEnv* env, jobject b, jbyte* buf, jint size) { static jmethodID mId = NULL; if( !mId) { jclass clazz = env->GetObjectClass( b); mId = env->GetMethodID( clazz, "useBuffer", "([BI)LBuffer;"); } jbyteArray array = env->NewByteArray( size); jbyte* p = env->GetByteArrayElements( array, NULL); memcpy( p, buf, size); env->ReleaseByteArrayElements( array, p, 0); env->CallObjectMethod( b, mId, array, size); } #ifdef __cplusplus extern "C" { #endif /** Native CommunShMem::construct() method. This method ** is used instead of a constructor. It initializes ** data and structures associated with current instance ** of native Java class. ** ** @param env pointer to JNI environment ** @param obj this object ** @param shmemId shared memory identifier (3 characters long) ** @param shmemSize shared memory size ** ** @see Java_CommunShMem_finalize() ** ** @author Marek Przeczek */ /* * Class: CommunShMem * Method: construct * Signature: (Ljava/lang/String;I)V */ JNIEXPORT void JNICALL Java_CommunShMem_construct ( JNIEnv* env, jobject obj, jstring shmemId, jint shmemSize) { if( sizeof( jlong) < sizeof( NativeCommunShMem*)) return; const char* str = env->GetStringUTFChars( shmemId, NULL); jlong data; *(NativeCommunShMem**)&data = new NativeCommunShMem( str, shmemSize); env->ReleaseStringUTFChars( shmemId, str); jclass clazz = env->GetObjectClass( obj); jfieldID fId = env->GetFieldID( clazz, "data", "J"); env->SetLongField( obj, fId, data); } /** Native CommunShMem::finalize() method. This method is usually ** used for native classes. When the GC destroys garbaged instance, ** it calls an object's finalize() method. So, this method destroys ** dynamically allocated data associated with current instance ** of native Java class. ** ** @param env pointer to JNI environment ** @param obj this object ** ** @see Java_CommunShMem_construct() ** ** @author Marek Przeczek */ /* * Class: CommunShMem * Method: finalize * Signature: ()V */ JNIEXPORT void JNICALL Java_CommunShMem_finalize (JNIEnv* env, jobject obj) { NativeCommunShMem* n = NativeCommunShMem::get( env, obj); if( n) delete n; } /** Native CommunShMem::read() method. This method reads data ** from shared memory to buffer. ** ** @param env pointer to JNI environment ** @param obj this object ** @param b instance of Java Buffer object ** ** @return this object ** ** @see Java_CommunShMem_write() ** ** @author Marek Przeczek */ /* * Class: CommunShMem * Method: read * Signature: (LBuffer;)LCommun; */ JNIEXPORT jobject JNICALL Java_CommunShMem_read ( JNIEnv* env, jobject obj, jobject b) { NativeCommunShMem* n = NativeCommunShMem::get( env, obj); if( !n) return obj; n->sem2.wait(); n->isem.wait(); void* p = n->shmem.getAddress(); int shmemSize = n->shmem.getSize(); jint size = ntohl( *(jint*)p); if( size < 0) { n->failed = JNI_TRUE; n->sem2.release(); n->isem.release(); return obj; } n->isem.release(); if( size) { jint num = size/shmemSize; jbyte* buf = new jbyte[size]; jbyte* q = buf; for( int i = 0; i < num; i++, q += shmemSize) { n->sem1.release(); n->sem2.wait(); memcpy( q, p, shmemSize); } jint rest = size%shmemSize; if( rest) { n->sem1.release(); n->sem2.wait(); memcpy( q, p, rest); } n->sem1.release(); n->Buffer_useBuffer( env, b, buf, size); delete[] buf; } else n->Buffer_clear( env, b); return obj; } /** Native CommunShMem::write() method. This method ** writes data from buffer to shared memory. ** ** @param env pointer to JNI environment ** @param obj this object ** @param b instance of Java Buffer object ** ** @return this object ** ** @see Java_CommunShMem_read() ** ** @author Marek Przeczek */ /* * Class: CommunShMem * Method: write * Signature: (LBuffer;)LCommun; */ JNIEXPORT jobject JNICALL Java_CommunShMem_write ( JNIEnv* env, jobject obj, jobject b) { NativeCommunShMem* n = NativeCommunShMem::get( env, obj); if( !n) return obj; n->isem.wait(); void* p = n->shmem.getAddress(); int shmemSize = n->shmem.getSize(); if( ntohl( *(jint*)p) < 0) { n->failed = JNI_TRUE; n->isem.release(); return obj; } n->isem.release(); jint size = n->Buffer_getSize( env, b); *(jint*)p = htonl( size); if( size) { n->sem1.release(); n->sem2.wait(); jint num = size/shmemSize; jbyteArray array; jbyte* elems = n->Buffer_getBuffer( env, b, array); jbyte* q = elems; for( int i = 0; i < num; i++, q += shmemSize) { memcpy( p, q, shmemSize); n->sem1.release(); n->sem2.wait(); } jint rest = size%shmemSize; if( rest) { memcpy( p, q, rest); n->sem1.release(); n->sem2.wait(); } env->ReleaseByteArrayElements( array, elems, JNI_ABORT); } else n->sem1.release(); return obj; } /** Native CommunShMem::hasFailed() method. This method ** indicates that a failure happened. ** ** @param env pointer to JNI environment ** @param obj this object ** ** @return JNI_TRUE (failure has happened); ** JNI_FALSE (everything ok) ** ** @author Marek Przeczek */ /* * Class: CommunShMem * Method: hasFailed * Signature: ()Z */ JNIEXPORT jboolean JNICALL Java_CommunShMem_hasFailed ( JNIEnv* env, jobject obj) { NativeCommunShMem* n = NativeCommunShMem::get( env, obj); if( !n) return JNI_TRUE; return n->failed; } /** Native CommunShMem::stopCommun() method. This method ** stop shared memory communication and writes EOF (-1) ** to the shared memory, so server will find this out. ** ** @param env pointer to JNI environment ** @param obj this object ** ** @author Marek Przeczek */ /* * Class: CommunShMem * Method: stopCommun * Signature: ()V */ JNIEXPORT void JNICALL Java_CommunShMem_stopCommun ( JNIEnv* env, jobject obj) { NativeCommunShMem* n = NativeCommunShMem::get( env, obj); if( !n) return; n->isem.wait(); *(jint*)n->shmem.getAddress() = htonl( -1); n->isem.release(); } #ifdef __cplusplus } #endif Index: Buffer.java =================================================================== RCS file: /cvsroot/javaprofiler/library/src2/Buffer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Buffer.java 2001/07/28 04:12:18 1.1 --- Buffer.java 2001/08/23 23:57:31 1.2 *************** *** 19,26 **** } ! public void useBuffer( byte[] buf, int size) { _size = size; _buf = buf; } --- 19,28 ---- } ! public Buffer useBuffer( byte[] buf, int size) { _size = size; _buf = buf; + + return this; } Index: CommunSetupSocket.java =================================================================== RCS file: /cvsroot/javaprofiler/library/src2/CommunSetupSocket.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** CommunSetupSocket.java 2001/08/12 07:35:31 1.1 --- CommunSetupSocket.java 2001/08/23 23:57:31 1.2 *************** *** 6,10 **** ! public int connectMode = SERVER_MODE; public String hostname = new String( "127.0.0.1"); --- 6,10 ---- ! public int connectMode = CLIENT_MODE; public String hostname = new String( "127.0.0.1"); Index: CommunShMem.java =================================================================== RCS file: /cvsroot/javaprofiler/library/src2/CommunShMem.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** CommunShMem.java 2001/08/12 07:35:31 1.2 --- CommunShMem.java 2001/08/23 23:57:31 1.3 *************** *** 1,19 **** public class CommunShMem implements Commun { - private String shmemId; - - private int shmemSize; - - private long data = 0; ! public CommunShMem( String shmemId, int shmemSize) { ! ! this.shmemId = new String( shmemId); ! this.shmemSize = shmemSize; ! } ! public native boolean initialize(); public native Commun read( Buffer b); --- 1,15 ---- public class CommunShMem implements Commun { private long data = 0; ! public CommunShMem( String shmemId, int shmemSize) { construct( shmemId, shmemSize);} ! private native void construct( String shmemId, int shmemSize); ! ! protected native void finalize(); ! ! ! public boolean initialize() { return true;} public native Commun read( Buffer b); Index: CommunSocket.java =================================================================== RCS file: /cvsroot/javaprofiler/library/src2/CommunSocket.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** CommunSocket.java 2001/08/12 07:35:31 1.3 --- CommunSocket.java 2001/08/23 23:57:31 1.4 *************** *** 20,29 **** private BufferedOutputStream _out; ! private Buffer _buf = new Buffer( new byte[4], 4); public CommunSocket( int connectMode, String host, int port) { ! _connectMode = _connectMode; _host = new String( host); _port = port; --- 20,29 ---- private BufferedOutputStream _out; ! private Buffer _buf = (new Buffer()).useBuffer( new byte[4], 4); public CommunSocket( int connectMode, String host, int port) { ! _connectMode = connectMode; _host = new String( host); _port = port; *************** *** 36,44 **** if( _connectMode == 0) { // server ! // not implemented yet } - _sock = new Socket( _host, _port); - _in = new BufferedInputStream( _sock.getInputStream()); _out = new BufferedOutputStream( _sock.getOutputStream()); --- 36,46 ---- if( _connectMode == 0) { // server ! ServerSocket sock = new ServerSocket( _port); ! sock.setSoTimeout( 0); ! _sock = sock.accept(); ! sock.close(); } + else _sock = new Socket( _host, _port); _in = new BufferedInputStream( _sock.getInputStream()); _out = new BufferedOutputStream( _sock.getOutputStream()); *************** *** 106,114 **** try { - - if( _connectMode == 0) { // server - - // not implemented yet - } _in .close(); --- 108,111 ---- Index: IProf.java =================================================================== RCS file: /cvsroot/javaprofiler/library/src2/IProf.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** IProf.java 2001/08/12 07:35:31 1.3 --- IProf.java 2001/08/23 23:57:31 1.4 *************** *** 26,59 **** } - private Timer _timer; - - - public boolean runClient() { - if( _commun.hasFailed() || !_commun.initialize()) return false; - _timer = new Timer(); - _timer.schedule( new TimerTask() { - - public void run() { - - try { - - idle(); - } - catch( Exception e) { - - _timer.cancel(); - } - } - }, 1000, 1000); - return true; } ! public synchronized void stopClient() { - _timer.cancel(); _commun.stopCommun(); } --- 26,38 ---- } + public boolean run() { if( _commun.hasFailed() || !_commun.initialize()) return false; return true; } ! public synchronized void stop() { _commun.stopCommun(); } *************** *** 78,83 **** private static final int F_GET_CHANGED = 8; - private static final int F_IDLE = 9; - private Buffer _buf = new Buffer(); --- 57,60 ---- *************** *** 778,795 **** return getChangedOrAll( F_GET_CHANGED, objId, seqType); - } - - public synchronized void idle() - - throws COMMUN_Exception { - - _buf.clear(); - _buf.putInt( F_IDLE); - - _commun.write( _buf); - if( _commun.hasFailed()) throw new COMMUN_Exception(); - - _commun.read( _buf); - if( _commun.hasFailed()) throw new COMMUN_Exception(); } }; --- 755,758 ---- Index: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/src2/Makefile.rules,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Makefile.rules 2001/08/09 23:22:55 1.2 --- Makefile.rules 2001/08/23 23:57:31 1.3 *************** *** 3,11 **** $(JAVAC) *.java ! native.o \ ! native.obj: $(JAVAH) CommunShMem do_link.o \ do_link.obj: $(JAR) cf $(PROF_JAVA_INTERF_PACKAGE) *.class --- 3,13 ---- $(JAVAC) *.java ! CommunShMem.o \ ! CommunShMem.obj: CommunShMem.cpp ../src/main/includes.h $(JAVAH) CommunShMem + $(CCC) $(CPPFLAGS) CommunShMem.cpp do_link.o \ do_link.obj: $(JAR) cf $(PROF_JAVA_INTERF_PACKAGE) *.class + $(LD) $(LDFLAGS2) $(OBJ_FILES) $(LDLIBS2) Index: dir.info =================================================================== RCS file: /cvsroot/javaprofiler/library/src2/dir.info,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** dir.info 2001/08/09 23:22:55 1.2 --- dir.info 2001/08/23 23:57:31 1.3 *************** *** 1,3 **** ! FILES = java native do_link ! CLEAN_FILES = *.class *.jar *.h *.dll *.so --- 1,5 ---- ! FILES = java CommunShMem do_link ! CLEAN_FILES = *.class *.jar *.h *.dll *.so *.obj *.o *.pdb *.lib *.exp ! ! OBJ_FILES = *.o* ../src/string/*.o* |
From: Marek P. <ma...@us...> - 2001-08-23 23:57:35
|
Update of /cvsroot/javaprofiler/library/src/string In directory usw-pr-cvs1:/tmp/cvs-serv1062/src/string Modified Files: string.cpp string.h Log Message: shared memory implementation; java client and dynamic library can now communicate thru sockets or shmem; main README completely rewritten; new classes - for shared memory, semaphores etc.; java native class CommunShMem implementation Index: string.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/string/string.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** string.cpp 2001/07/28 04:11:17 1.4 --- string.cpp 2001/08/23 23:57:31 1.5 *************** *** 1,6 **** #include "../main/includes.h" - Allocator String::_allocator( sizeof( String)); - String::String( const char* str) { --- 1,4 ---- Index: string.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/string/string.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** string.h 2001/07/28 04:11:17 1.6 --- string.h 2001/08/23 23:57:31 1.7 *************** *** 148,166 **** String cutLeft(); - - private: - - /// allocator - static Allocator _allocator; - - public: - - /** Overloaded new() operator. */ - - void* operator new( size_t) { return _allocator.get();} - - /** Overloaded delete() operator. */ - - void operator delete( void* unit) { _allocator.put( unit);} }; --- 148,151 ---- |
From: Marek P. <ma...@us...> - 2001-08-23 23:57:35
|
Update of /cvsroot/javaprofiler/library/src/cpu In directory usw-pr-cvs1:/tmp/cvs-serv1062/src/cpu Modified Files: sampling.cpp sampling.h Log Message: shared memory implementation; java client and dynamic library can now communicate thru sockets or shmem; main README completely rewritten; new classes - for shared memory, semaphores etc.; java native class CommunShMem implementation Index: sampling.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/sampling.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** sampling.cpp 2001/08/05 01:37:10 1.4 --- sampling.cpp 2001/08/23 23:57:31 1.5 *************** *** 1,25 **** #include "../main/includes.h" ! Sampling::Sampling() ! { _cmd = CMD_TURN_ON; #ifdef WIN32 - _turnedOn = CreateEvent(NULL, TRUE, TRUE, NULL); InitializeCriticalSection(&_cs); - - _wait = CreateEvent(NULL, TRUE, FALSE, NULL); - #else - pthread_cond_init(&_cond, NULL); pthread_mutex_init(&_mutex, NULL); - - pthread_cond_init(&_waitCond, NULL); - pthread_mutex_init(&_waitMutex, NULL); - - pthread_mutex_lock(&_waitMutex); - #endif --- 1,14 ---- #include "../main/includes.h" ! Sampling::Sampling() { ! _cmd = CMD_TURN_ON; #ifdef WIN32 _turnedOn = CreateEvent(NULL, TRUE, TRUE, NULL); InitializeCriticalSection(&_cs); #else pthread_cond_init(&_cond, NULL); pthread_mutex_init(&_mutex, NULL); #endif *************** *** 34,53 **** #ifdef WIN32 - CloseHandle(_turnedOn); DeleteCriticalSection(&_cs); - - CloseHandle(_wait); - #else - pthread_cond_destroy(&_cond); pthread_mutex_destroy(&_mutex); - - pthread_mutex_unlock(&_waitMutex); - - pthread_cond_destroy(&_waitCond); - pthread_mutex_destroy(&_waitMutex); - #endif } --- 23,31 ---- *************** *** 118,131 **** if (_cmd != CMD_TURN_ON) continue; ! delay(waitTime); } } - // not documented - for internal use only - void Sampling::samplingMain(void*) { - - prof().sampling.main(); - } - int Sampling::startThread(int turnedOn) { --- 96,103 ---- if (_cmd != CMD_TURN_ON) continue; ! waitDelay.delay(waitTime); } } int Sampling::startThread(int turnedOn) { *************** *** 235,270 **** } - void Sampling::delay(long wait) { - - #ifdef WIN32 - - WaitForSingleObject(_wait, wait); - - #else - - struct timespec ts; - struct timeval tv; - - long sec; - long microSec; - - gettimeofday(&tv, NULL); - - sec = tv.tv_sec; - - sec += wait / 1000; - microSec = (wait % 1000) * 1000 + tv.tv_usec; - - sec += microSec / 1000000; - microSec = microSec % 1000000; - - ts.tv_sec = sec; - ts.tv_nsec = microSec * 1000; - - pthread_cond_timedwait(&_waitCond, &_waitMutex, &ts); - - #endif - } - unsigned long Sampling::getMilliticks() { --- 207,210 ---- *************** *** 386,388 **** --- 326,333 ---- } } + } + + void Sampling::samplingMain( void*) { + + prof().sampling.main(); } Index: sampling.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/cpu/sampling.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** sampling.h 2001/08/05 01:37:10 1.4 --- sampling.h 2001/08/23 23:57:31 1.5 *************** *** 7,18 **** ** created during profiler start-up. ** ! ** @author Petr Luner */ class Sampling { - friend void samplingMain(void* prm); - - private: - /// thread commands enum CMD { --- 7,14 ---- ** created during profiler start-up. ** ! ** @author Petr Luner, Marek Przeczek */ class Sampling { /// thread commands enum CMD { *************** *** 27,31 **** #ifdef WIN32 - /// handle to 'turned on' event object HANDLE _turnedOn; --- 23,26 ---- *************** *** 33,42 **** /// for thread control synchronization CRITICAL_SECTION _cs; - - /// handle to event used to wait on in delay() method - HANDLE _wait; - #else - /// condition varible for thread control pthread_cond_t _cond; --- 28,32 ---- *************** *** 44,72 **** /// associated mutex pthread_mutex_t _mutex; - - /// condition variable used to wait on in delay() method - pthread_cond_t _waitCond; - - /// associated mutex - pthread_mutex_t _waitMutex; - #endif private: /// Thread main function. - void main(); /// Performs one sample. - void doOneSample(); - /** Delays thread execution for specified time. - ** - ** @param wait time in milliseconds */ - - void delay(long wait); - /** Gets current milliticks. ** --- 34,50 ---- /// associated mutex pthread_mutex_t _mutex; #endif + /// wait object + Delay waitDelay; + private: /// Thread main function. void main(); /// Performs one sample. void doOneSample(); /** Gets current milliticks. ** *************** *** 78,86 **** /// Consctructor - Sampling(); /// Destructor - ~Sampling(); --- 56,62 ---- *************** *** 117,121 **** ** @param ? not used */ ! static void samplingMain(void*); #ifdef _DEBUG --- 93,97 ---- ** @param ? not used */ ! static void samplingMain( void*); #ifdef _DEBUG |
From: Marek P. <ma...@us...> - 2001-08-23 23:57:35
|
Update of /cvsroot/javaprofiler/library/src/prof In directory usw-pr-cvs1:/tmp/cvs-serv1062/src/prof Modified Files: lock.h prof.cpp prof.h prof_gc.cpp prof_jvm.cpp 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: lock.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/lock.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** lock.h 2001/08/09 23:22:55 1.11 --- lock.h 2001/08/23 23:57:31 1.12 *************** *** 61,65 **** void wait() { ! #ifdef WIN32 EnterCriticalSection( &cs); --- 61,65 ---- void wait() { ! #ifdef WIN32 EnterCriticalSection( &cs); Index: prof.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** prof.cpp 2001/08/09 23:22:55 1.20 --- prof.cpp 2001/08/23 23:57:31 1.21 *************** *** 77,83 **** prof().shutdownLock.wait(); ! while( !communThreadEnd) { ! prof().runServer(); ! } } --- 77,81 ---- prof().shutdownLock.wait(); ! while( !communThreadEnd) prof().run(); } Index: prof.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof.h,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -r1.30 -r1.31 *** prof.h 2001/08/09 23:22:55 1.30 --- prof.h 2001/08/23 23:57:31 1.31 *************** *** 756,760 **** ** to take the communication channel away when garbage collector is running. */ ! virtual void idle(); private: --- 756,760 ---- ** to take the communication channel away when garbage collector is running. */ ! virtual void idle() {}; private: Index: prof_gc.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_gc.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** prof_gc.cpp 2001/07/12 22:23:23 1.6 --- prof_gc.cpp 2001/08/23 23:57:31 1.7 *************** *** 1,13 **** #include "../main/includes.h" - // for internal use only - // not documented - static Synchronized* sync1; - static Synchronized* sync2; - void Prof::event_gcStart( JVMPI_Event* event) { ! sync1 = new Synchronized( communLock); ! sync2 = new Synchronized( dataLock); GC* gc = new GC; --- 1,8 ---- #include "../main/includes.h" void Prof::event_gcStart( JVMPI_Event* event) { ! communLock.wait(); ! dataLock.wait(); GC* gc = new GC; *************** *** 27,31 **** gc->totalObjectSpace = event->u.gc_info.total_object_space; ! delete sync2; ! delete sync1; } --- 22,26 ---- gc->totalObjectSpace = event->u.gc_info.total_object_space; ! dataLock.release(); ! communLock.release(); } Index: prof_jvm.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/prof/prof_jvm.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** prof_jvm.cpp 2001/08/05 01:37:10 1.17 --- prof_jvm.cpp 2001/08/23 23:57:31 1.18 *************** *** 399,401 **** --- 399,402 ---- destroyProf(); + exit( 0); } |
From: Marek P. <ma...@us...> - 2001-08-23 23:57:35
|
Update of /cvsroot/javaprofiler/library/src/main In directory usw-pr-cvs1:/tmp/cvs-serv1062/src/main Modified Files: includes.h Log Message: shared memory implementation; java client and dynamic library can now communicate thru sockets or shmem; main README completely rewritten; new classes - for shared memory, semaphores etc.; java native class CommunShMem implementation Index: includes.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/main/includes.h,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** includes.h 2001/08/09 23:22:55 1.20 --- includes.h 2001/08/23 23:57:31 1.21 *************** *** 70,73 **** --- 70,74 ---- #include "../commun3/semaphore.h" #include "../commun3/sharedMemory.h" + #include "../delay/delay.h" #include "../list/refCount.h" |
From: Marek P. <ma...@us...> - 2001-08-23 23:57:35
|
Update of /cvsroot/javaprofiler/library/src/delay In directory usw-pr-cvs1:/tmp/cvs-serv1062/src/delay Added Files: Makefile Makefile.mak Makefile.rules delay.cpp delay.h dir.info 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 --- NEW FILE: Makefile --- include ../../config.mk include Makefile.rules --- NEW FILE: Makefile.mak --- !include ../../config.mk !include Makefile.rules --- NEW FILE: Makefile.rules --- delay.o \ delay.obj: delay.cpp ../main/includes.h $(CCC) $(CPPFLAGS) delay.cpp --- NEW FILE: delay.cpp --- #include "../main/includes.h" Delay::Delay() { #ifdef WIN32 _wait = CreateEvent( NULL, TRUE, FALSE, NULL); #else pthread_cond_init( &_waitCond, NULL); pthread_mutex_init( &_waitMutex, NULL); pthread_mutex_lock( &_waitMutex); #endif } Delay::~Delay() { #ifdef WIN32 CloseHandle( _wait); #else pthread_mutex_unlock( &_waitMutex); pthread_cond_destroy( &_waitCond); pthread_mutex_destroy( &_waitMutex); #endif } void Delay::delay( long ms) { #ifdef WIN32 WaitForSingleObject( _wait, ms); #else struct timespec ts; struct timeval tv; long sec; long microSec; gettimeofday( &tv, NULL); sec = tv.tv_sec; sec += ms/1000; microSec = (ms%1000)*1000+tv.tv_usec; sec += microSec/1000000; microSec = microSec%1000000; ts.tv_sec = sec; ts.tv_nsec = microSec*1000; pthread_cond_timedwait( &_waitCond, &_waitMutex, &ts); #endif } --- NEW FILE: delay.h --- #ifndef _DELAY_H_ #define _DELAY_H_ /** Delay in milliseconds. This class should be used when ** sleeping for N milliseconds is necessary. Its implementation ** is system/platform dependend. ** ** @author Petr Luner, Marek Przeczek */ class Delay { #ifdef WIN32 /// handle to event used to wait on in delay() method HANDLE _wait; #else /// condition variable used to wait on in delay() method pthread_cond_t _waitCond; /// associated mutex pthread_mutex_t _waitMutex; #endif public: /// Default constructor. Delay(); /// Destructor. ~Delay(); /** Sleep. This method delays calling thread ** for 'ms' milliseconds. ** ** @param ms number of milliseconds */ void delay( long ms); }; #endif // _DELAY_H_ --- NEW FILE: dir.info --- FILES = delay CLEAN_FILES = *.pdb *.obj *.o |
From: Marek P. <ma...@us...> - 2001-08-23 23:57:34
|
Update of /cvsroot/javaprofiler/library/src/commun2 In directory usw-pr-cvs1:/tmp/cvs-serv1062/src/commun2 Modified Files: prof_interface.cpp 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: prof_interface.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun2/prof_interface.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** prof_interface.cpp 2001/08/05 01:37:10 1.8 --- prof_interface.cpp 2001/08/23 23:57:31 1.9 *************** *** 21,26 **** if( threadsSuspended) return; gcLock.wait(); ! jvmpiInterface->DisableGC(); dataLock.wait(); --- 21,28 ---- if( threadsSuspended) return; + communLock.release(); gcLock.wait(); ! jvmpiInterface->DisableGC(); ! communLock.wait(); dataLock.wait(); *************** *** 50,55 **** dataLock.release(); ! jvmpiInterface->EnableGC(); ! gcLock.release(); } } --- 52,57 ---- dataLock.release(); ! jvmpiInterface->EnableGC(); ! gcLock.release(); } } *************** *** 503,509 **** return getAllOrChanged( objId, what, seq, 0); - } - - void Prof::idle() { } --- 505,508 ---- |
Update of /cvsroot/javaprofiler/library/config In directory usw-pr-cvs1:/tmp/cvs-serv1062/config Modified Files: config_sparc_sunos58_gcc30.mk config_x86_nt40_bcc551.mk config_x86_nt40_vc98.mk config_x86_win9x_bcc551.mk config_x86_win9x_vc98.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: config_sparc_sunos58_gcc30.mk =================================================================== RCS file: /cvsroot/javaprofiler/library/config/config_sparc_sunos58_gcc30.mk,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** config_sparc_sunos58_gcc30.mk 2001/08/09 23:22:55 1.3 --- config_sparc_sunos58_gcc30.mk 2001/08/23 23:57:31 1.4 *************** *** 8,11 **** --- 8,13 ---- PROF_JAVA_INTERF_PACKAGE = IProf.jar + NATIVE_LIBRARY_NAME = libCommunShMem.so + ################################################################ # PATHS *************** *** 29,33 **** # don't modify ! DOCPPFLAGS = -p JDOCFLAGS = -private --- 31,35 ---- # don't modify ! DOCPPFLAGS = -p -I JDOCFLAGS = -private *************** *** 47,52 **** LDFLAGS = $(DEFINES) -shared -o $(PROF_LIBRARY_NAME) - LDLIBS = -lsocket -lpthread -lthread -lnsl CPPFLAGS = -c $(FLAGS) $(DEFINES) $(INCLUDES) --- 49,56 ---- LDFLAGS = $(DEFINES) -shared -o $(PROF_LIBRARY_NAME) LDLIBS = -lsocket -lpthread -lthread -lnsl + + LDFLAGS2 = $(DEFINES) -shared -o $(NATIVE_LIBRARY_NAME) + LDLIBS2 = -lsocket CPPFLAGS = -c $(FLAGS) $(DEFINES) $(INCLUDES) Index: config_x86_nt40_bcc551.mk =================================================================== RCS file: /cvsroot/javaprofiler/library/config/config_x86_nt40_bcc551.mk,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** config_x86_nt40_bcc551.mk 2001/08/09 23:22:55 1.6 --- config_x86_nt40_bcc551.mk 2001/08/23 23:57:31 1.7 *************** *** 8,11 **** --- 8,13 ---- PROF_JAVA_INTERF_PACKAGE = IProf.jar + NATIVE_LIBRARY_NAME = CommunShMem.dll + ################################################################ # PATHS *************** *** 29,33 **** # don't modify ! DOCPPFLAGS = -p JDOCFLAGS = -private --- 31,35 ---- # don't modify ! DOCPPFLAGS = -p -I JDOCFLAGS = -private *************** *** 48,54 **** #FLAGS = -O -O2 -DNDEBUG -6 -f- -k- -Oc -Oi -OS -Ov -v- -x- -RT- ! LDFLAGS = $(DEFINES) -L$(COMPILER_PATH)\Lib \ ! -L$(COMPILER_PATH)\Lib\PSDK LDLIBS = wsock32.lib winmm.lib CPPFLAGS = -c $(FLAGS) $(DEFINES) $(INCLUDES) --- 50,58 ---- #FLAGS = -O -O2 -DNDEBUG -6 -f- -k- -Oc -Oi -OS -Ov -v- -x- -RT- ! LDFLAGS = $(DEFINES) -L$(COMPILER_PATH)\Lib -L$(COMPILER_PATH)\Lib\PSDK LDLIBS = wsock32.lib winmm.lib + + LDFLAGS2 = $(LDFLAGS) + LDLIBS2 = wsock32.lib CPPFLAGS = -c $(FLAGS) $(DEFINES) $(INCLUDES) Index: config_x86_nt40_vc98.mk =================================================================== RCS file: /cvsroot/javaprofiler/library/config/config_x86_nt40_vc98.mk,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** config_x86_nt40_vc98.mk 2001/08/09 23:22:55 1.12 --- config_x86_nt40_vc98.mk 2001/08/23 23:57:31 1.13 *************** *** 8,11 **** --- 8,13 ---- PROF_JAVA_INTERF_PACKAGE = IProf.jar + NATIVE_LIBRARY_NAME = CommunShMem.dll + ################################################################ # PATHS *************** *** 29,33 **** # don't modify ! DOCPPFLAGS = -p JDOCFLAGS = -private --- 31,35 ---- # don't modify ! DOCPPFLAGS = -p -I JDOCFLAGS = -private *************** *** 48,51 **** --- 50,56 ---- 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) Index: config_x86_win9x_bcc551.mk =================================================================== RCS file: /cvsroot/javaprofiler/library/config/config_x86_win9x_bcc551.mk,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** config_x86_win9x_bcc551.mk 2001/08/09 23:22:55 1.6 --- config_x86_win9x_bcc551.mk 2001/08/23 23:57:31 1.7 *************** *** 8,11 **** --- 8,13 ---- PROF_JAVA_INTERF_PACKAGE = IProf.jar + NATIVE_LIBRARY_NAME = CommunShMem.dll + ################################################################ # PATHS *************** *** 29,33 **** # don't modify ! DOCPPFLAGS = -p JDOCFLAGS = -private --- 31,35 ---- # don't modify ! DOCPPFLAGS = -p -I JDOCFLAGS = -private *************** *** 48,54 **** #FLAGS = -O -O2 -DNDEBUG -6 -f- -k- -Oc -Oi -OS -Ov -v- -x- -RT- ! LDFLAGS = $(DEFINES) -L$(COMPILER_PATH)\Lib \ ! -L$(COMPILER_PATH)\Lib\PSDK LDLIBS = wsock32.lib winmm.lib CPPFLAGS = -c $(FLAGS) $(DEFINES) $(INCLUDES) --- 50,58 ---- #FLAGS = -O -O2 -DNDEBUG -6 -f- -k- -Oc -Oi -OS -Ov -v- -x- -RT- ! LDFLAGS = $(DEFINES) -L$(COMPILER_PATH)\Lib -L$(COMPILER_PATH)\Lib\PSDK LDLIBS = wsock32.lib winmm.lib + + LDFLAGS2 = $(LDFLAGS) + LDLIBS2 = wsock32.lib CPPFLAGS = -c $(FLAGS) $(DEFINES) $(INCLUDES) Index: config_x86_win9x_vc98.mk =================================================================== RCS file: /cvsroot/javaprofiler/library/config/config_x86_win9x_vc98.mk,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** config_x86_win9x_vc98.mk 2001/08/09 23:22:55 1.11 --- config_x86_win9x_vc98.mk 2001/08/23 23:57:31 1.12 *************** *** 8,11 **** --- 8,13 ---- PROF_JAVA_INTERF_PACKAGE = IProf.jar + NATIVE_LIBRARY_NAME = CommunShMem.dll + ################################################################ # PATHS *************** *** 29,33 **** # don't modify ! DOCPPFLAGS = -p JDOCFLAGS = -private --- 31,35 ---- # don't modify ! DOCPPFLAGS = -p -I JDOCFLAGS = -private *************** *** 48,51 **** --- 50,56 ---- 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) |
From: Marek P. <ma...@us...> - 2001-08-23 23:57:34
|
Update of /cvsroot/javaprofiler/library/src/commun In directory usw-pr-cvs1:/tmp/cvs-serv1062/src/commun Modified Files: commun.h communSocket.cpp communSocket.h iprof.cpp iprof.h Log Message: shared memory implementation; java client and dynamic library can now communicate thru sockets or shmem; main README completely rewritten; new classes - for shared memory, semaphores etc.; java native class CommunShMem implementation Index: commun.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun/commun.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** commun.h 2001/07/22 23:37:58 1.2 --- commun.h 2001/08/23 23:57:31 1.3 *************** *** 72,75 **** --- 72,84 ---- int hasFailed() { return _failed;} + + /** Communication channel ready for reading. This method + ** returns TRUE, if there are data in communication channel + ** and should be read from it. + ** + ** @return 0 (nothing); + ** 1 (data in channel) */ + + virtual int isReady() { return 0;} }; Index: communSocket.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun/communSocket.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** communSocket.cpp 2001/08/12 07:35:31 1.5 --- communSocket.cpp 2001/08/23 23:57:31 1.6 *************** *** 83,86 **** --- 83,88 ---- if( !_connectMode) { // server + if( _csock >= 0) closesocket( _csock); + _failed = ((_csock = accept( _sock, (sockaddr*)&cin, &csize)) == INVALID_SOCKET); } *************** *** 103,106 **** --- 105,110 ---- if( !_connectMode) { // server + if( _csock >= 0) close( _csock); + _failed = ((_csock = accept( _sock, (sockaddr*)&cin, &csize)) < 0); } *************** *** 186,188 **** --- 190,217 ---- return *this; + } + + int CommunSocket::isReady() { + + fd_set fds; + + FD_ZERO( &fds); + FD_SET( _csock, &fds); + + timeval tv; + tv.tv_sec = 0; + tv.tv_sec = 1000; + + int rc = select( _csock+1, &fds, NULL, NULL, &tv); + + #ifdef WIN32 + if( rc == SOCKET_ERROR) { + #else + if( rc < 0) { + #endif + _failed = 1; + return 0; + } + + return rc; } Index: communSocket.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun/communSocket.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** communSocket.h 2001/08/12 07:35:31 1.5 --- communSocket.h 2001/08/23 23:57:31 1.6 *************** *** 92,95 **** --- 92,104 ---- virtual Commun& operator<<( const Buffer& b); + + /** Communication channel ready for reading. This method + ** returns TRUE, if there are data in communication channel + ** and should be read from it. + ** + ** @return 0 (nothing); + ** 1 (data in channel) */ + + virtual int isReady(); }; Index: iprof.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun/iprof.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** iprof.cpp 2001/08/12 07:35:31 1.5 --- iprof.cpp 2001/08/23 23:57:31 1.6 *************** *** 6,13 **** communLock( "_commun_lock"), ! conEstabl( 0) - { - _func[F_SHUTDOWN] = &IProf::_shutdown; _func[F_IS_SHUTDOWNED] = &IProf::_isShutdowned; --- 6,11 ---- communLock( "_commun_lock"), ! conEstabl( 0) { _func[F_SHUTDOWN] = &IProf::_shutdown; _func[F_IS_SHUTDOWNED] = &IProf::_isShutdowned; *************** *** 19,23 **** _func[F_GET_ALL] = &IProf::_getAll; _func[F_GET_CHANGED] = &IProf::_getChanged; - _func[F_IDLE] = &IProf::_idle; if( setup.com.communType == COMMUN_SOCKET) --- 17,20 ---- *************** *** 35,74 **** } ! int IProf::runServer() { conEstabl = 0; ! if( _commun->hasFailed() || !_commun->initialize()) return 0; conEstabl = 1; Buffer buf; while( 1) { ! Synchronized sync( communLock); ! buf.clear(); ! (*_commun) >> buf; ! if( _commun->hasFailed()) { ! conEstabl = 0; ! return 0; } jint naction = *(jint*)(buf.getBuffer()); jint action = ntohl( naction); // back to host-byte-order ! if( action < 0 || action >= FUNC_COUNT) { ! ! conEstabl = 0; ! return 0; ! } (this->*(_func[action]))( buf); (*_commun) << buf; ! if( _commun->hasFailed()) { ! ! conEstabl = 0; ! return 0; ! } } --- 32,71 ---- } ! int IProf::run() { conEstabl = 0; ! if( !_commun->initialize()) return 0; conEstabl = 1; + Delay d; Buffer buf; while( 1) { ! Synchronized sync( communLock, 0); ! while( 1) { ! sync.enter(); ! if( _commun->isReady()) break; ! sync.release(); ! ! if( _commun->hasFailed()) return (conEstabl = 0); ! ! d.delay( 10); } + 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); } *************** *** 206,214 **** void* buf2 = &b; seq.forEach( sToBin, &buf2); - } - - void IProf::_idle( Buffer& b) { - - idle(); - b.clear(); } --- 203,205 ---- Index: iprof.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/commun/iprof.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** iprof.h 2001/08/09 23:22:55 1.8 --- iprof.h 2001/08/23 23:57:31 1.9 *************** *** 30,34 **** /// number of methods of the interface ! FUNC_COUNT = 10 }; --- 30,34 ---- /// number of methods of the interface ! FUNC_COUNT = 9 }; *************** *** 87,90 **** --- 87,92 ---- }; + public: + /// indexes of methods enum eFunction { *************** *** 116,124 **** /// getChanged() F_GET_CHANGED = 8, - - /// idle() - F_IDLE = 9 }; /// type of information enum eInfoType { --- 118,125 ---- /// getChanged() F_GET_CHANGED = 8, }; + protected: + /// type of information enum eInfoType { *************** *** 354,365 **** virtual ~IProf(); ! /** Main server loop. This method starts the server and stays in main ! ** server loop. To exit the loop client must disconnect itself from ! ** the server (must close connection). ** ** @return 0 (failure occurred); ** 1 (ok, never occurrs) */ ! int runServer(); private: --- 355,368 ---- virtual ~IProf(); ! /** Main server loop. This method starts the server and ! ** stays in main server (client) loop. To exit the loop ! ** client must disconnect itself from the server (must close ! ** connection). When connect_mode is set to 'client', it ! ** starts the client. ** ** @return 0 (failure occurred); ** 1 (ok, never occurrs) */ ! int run(); private: *************** *** 464,477 **** void _getChanged( Buffer& b); - /** Idle. This method processes in/out buffer, gains - ** arguments and calls idle() method. When finished, - ** in 'b' there is binary output of called method. - ** - ** @param b in/out buffer - ** - ** @see idle() */ - - void _idle( Buffer& b); - public: --- 467,470 ---- *************** *** 546,555 **** eSeqType what, // in (jint) seqID& seq) = 0; // out - - /** Idle. An abstract method implemented by Prof class. - ** - ** @see Prof::idle(), Prof */ - - virtual void idle() = 0; private: --- 539,542 ---- |
From: Marek P. <ma...@us...> - 2001-08-23 23:57:34
|
Update of /cvsroot/javaprofiler/library/src In directory usw-pr-cvs1:/tmp/cvs-serv1062/src Modified Files: Makefile.rules dir.info 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: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/src/Makefile.rules,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** Makefile.rules 2001/08/09 23:22:55 1.6 --- Makefile.rules 2001/08/23 23:57:31 1.7 *************** *** 95,98 **** --- 95,114 ---- $(MAKE) $(MFLAGS) cpu clean + delay.dir: + cd delay + $(MAKE) $(MFLAGS) + cd .. + + delay.dir.2: + $(MAKE) $(MFLAGS) delay + + delay.clean: + cd delay + $(MAKE) $(MFLAGS) clean + cd .. + + delay.clean.2: + $(MAKE) $(MFLAGS) delay clean + gc.dir: cd gc Index: dir.info =================================================================== RCS file: /cvsroot/javaprofiler/library/src/dir.info,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** dir.info 2001/08/09 23:22:55 1.11 --- dir.info 2001/08/23 23:57:31 1.12 *************** *** 1,3 **** ! DIRS = profiler alloc allocator commun commun2 commun3 cpu gc main \ prof setup shared string --- 1,3 ---- ! DIRS = profiler alloc allocator commun commun2 commun3 cpu delay gc main \ prof setup shared string *************** *** 5,8 **** OBJ_FILES = profiler/*.o* alloc/*.o* allocator/*.o* commun/*.o* commun2/*.o* \ ! commun3/*.o* cpu/*.o* gc/*.o* main/*.o* prof/*.o* setup/*.o* \ ! shared/*.o* string/*.o* --- 5,8 ---- OBJ_FILES = profiler/*.o* alloc/*.o* allocator/*.o* commun/*.o* commun2/*.o* \ ! commun3/*.o* cpu/*.o* delay/*.o* gc/*.o* main/*.o* prof/*.o* \ ! setup/*.o* shared/*.o* string/*.o* |
From: Marek P. <ma...@us...> - 2001-08-23 23:57:34
|
Update of /cvsroot/javaprofiler/library/doc/html/native In directory usw-pr-cvs1:/tmp/cvs-serv1062/doc/html/native Added Files: Makefile Makefile.mak Makefile.rules dir.info 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 --- NEW FILE: Makefile --- include ../../../config.mk include Makefile.rules --- NEW FILE: Makefile.mak --- !include ../../../config.mk !include Makefile.rules --- NEW FILE: Makefile.rules --- doc.obj: dir /S /B ..\..\..\src2\*.cpp > files.dat $(DOCPP) $(DOCPPFLAGS) files.dat --- NEW FILE: dir.info --- FILES = doc CLEAN_FILES = *.html *.class *.gif *.db files.dat doc++.conf |
From: Marek P. <ma...@us...> - 2001-08-23 23:57:34
|
Update of /cvsroot/javaprofiler/library/doc/html In directory usw-pr-cvs1:/tmp/cvs-serv1062/doc/html Modified Files: Makefile.rules dir.info 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: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/doc/html/Makefile.rules,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** Makefile.rules 2001/07/28 04:11:17 1.3 --- Makefile.rules 2001/08/23 23:57:31 1.4 *************** *** 30,31 **** --- 30,47 ---- interface.clean.2: $(MAKE) $(MFLAGS) interface clean + + native.dir: + cd native + $(MAKE) $(MFLAGS) + cd .. + + native.dir.2: + $(MAKE) $(MFLAGS) native + + native.clean: + cd native + $(MAKE) $(MFLAGS) clean + cd .. + + native.clean.2: + $(MAKE) $(MFLAGS) native clean Index: dir.info =================================================================== RCS file: /cvsroot/javaprofiler/library/doc/html/dir.info,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** dir.info 2001/07/28 04:11:17 1.3 --- dir.info 2001/08/23 23:57:31 1.4 *************** *** 1 **** ! DIRS = library interface --- 1 ---- ! DIRS = library interface native |
From: Marek P. <ma...@us...> - 2001-08-23 23:57:34
|
Update of /cvsroot/javaprofiler/library/doc/html/library In directory usw-pr-cvs1:/tmp/cvs-serv1062/doc/html/library Modified Files: Makefile.rules 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: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/doc/html/library/Makefile.rules,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Makefile.rules 2001/07/22 23:37:58 1.2 --- Makefile.rules 2001/08/23 23:57:31 1.3 *************** *** 2,5 **** dir /S /B ..\..\..\src\*.h > files.dat dir /S /B ..\..\..\src\*.cpp >> files.dat ! $(DOCPP) $(DOCPPFLAGS) -I files.dat ! --- 2,4 ---- dir /S /B ..\..\..\src\*.h > files.dat dir /S /B ..\..\..\src\*.cpp >> files.dat ! $(DOCPP) $(DOCPPFLAGS) files.dat |
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 |
From: Marek P. <ma...@us...> - 2001-08-23 23:53:38
|
Update of /cvsroot/javaprofiler/library/src/delay In directory usw-pr-cvs1:/tmp/cvs-serv32686/delay Log Message: Directory /cvsroot/javaprofiler/library/src/delay added to the repository |
From: Marek P. <ma...@us...> - 2001-08-23 23:52:25
|
Update of /cvsroot/javaprofiler/library/doc/html/native In directory usw-pr-cvs1:/tmp/cvs-serv32432/native Log Message: Directory /cvsroot/javaprofiler/library/doc/html/native added to the repository |
Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/connect In directory usw-pr-cvs1:/tmp/cvs-serv7476 Added Files: ArgumentImpl.java BooleanArgumentImpl.java IntegerArgumentImpl.java LaunchConnector.java SelectedArgumentImpl.java ShmemAttachConnector.java ShmemLaunchConnector.java ShmemListenConnector.java ShmemTransport.java SocketAttachConnector.java SocketLaunchConnector.java SocketListenConnector.java SocketTransport.java StringArgumentImpl.java Log Message: First version of Connectors. --- NEW FILE: ArgumentImpl.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 Developer 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.connect; import net.sourceforge.javaprofiler.jpi.connect.Connector; /** * Specification for and value of a Connector argument. Will always implement * a subinterface of ArgumentImpl: {@link StringArgumentImpl}, * {@link BooleanArgumentImpl}, {@link IntegerArgumentImpl}, * or {@link SelectedArgumentImpl}. * * @author Jan Stola */ public class ArgumentImpl implements Connector.Argument { /** Indicates whether this argument must be specified. */ protected boolean mandatory; /** Short human-readable label for this argument. */ protected String label; /** Human-readable description of this argument and its purpose. */ protected String description; /** Value of the argument. */ protected String value; /** * Short, unique identifier for the argument, not intended for * exposure to end-user. */ protected String name; /** * Creates new ArgumentImpl. * * @param mandatory indicates whether this argument must be specified. * @param label short human-readable label for this argument. * @param description human-readable description of this argument and its purpose. * @param name short, unique identifier for the argument, not intended for * exposure to end-user. */ ArgumentImpl(boolean mandatory, String label, String description, String name) { this.mandatory=mandatory; this.label=label; this.description=description; this.name=name; } /** * Indicates whether the argument must be specified. If <code>true</code>, * {@link #setValue(String)} must be used to set a non-<code>null</code> value * before using this argument in establishing a connection. * * @return <code>true</code> if the argument must be specified; <code>false</code> otherwise. */ public boolean isMandatory() { return mandatory; } /** * Returns a short human-readable label for this argument. * * @return a label for this argument */ public String label() { return label; } /** * Performs basic sanity check of argument. * * @return <code>true</code> if the value is valid to be used in {@link #setValue(String)} */ public boolean isValid(String value) { return (value!=null); } /** * Sets the value of the argument. The value should be checked with * {@link #isValid(String)} before setting it; invalid values will throw * an exception when the connection is established ({@link #connect} * method is called). */ public void setValue(String value) { this.value=value; } /** * Returns the current value of the argument. Initially, the default value * is returned. If the value is currently unspecified, <code>null</code> is returned. * * @return the current value of the argument. */ public String value() { return value; } /** * Returns a human-readable description of this argument and its purpose. * * @return the description of this argument */ public String description() { return description; } /** * Returns a short, unique identifier for the argument. Not intended for * exposure to end-user. * * @return the name of this argument. */ public String name() { return name; } } /* * $Log: ArgumentImpl.java,v $ * Revision 1.1 2001/08/22 13:35:31 stolis * First version of Connectors. * */ --- NEW FILE: BooleanArgumentImpl.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 Developer 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.connect; import net.sourceforge.javaprofiler.jpi.connect.Connector; /** * Specification for and value of a Connector argument, whose value is * Boolean. * * @author Jan Stola */ public class BooleanArgumentImpl extends ArgumentImpl implements Connector.BooleanArgument { /** * Creates new BooleanArgumentImpl. * * @param mandatory indicates whether this argument must be specified. * @param label short human-readable label for this argument. * @param description human-readable description of this argument and its purpose. * @param name short, unique identifier for the argument, not intended for * exposure to end-user. */ BooleanArgumentImpl(boolean mandatory, String label, String description, String name) { super(mandatory, label, description, name); } /** * Performs basic sanity check of argument. * * @return <code>true</code> if value is a string representation of a boolean value. */ public boolean isValid(String value) { return ("true".equals(value)||"false".equals(value)); } /** * Sets the value of the argument. */ public void setValue(boolean value) { this.value=String.valueOf(value); } /** * Return the value of the argument as a boolean. Since the argument * may not have been set or may have an invalid value {@link #isValid(String)} * should be called on {@link ArgumentImpl#value()} to check its validity. * If it is invalid the boolean returned by this method is undefined. * * @return the value of the argument as a boolean. */ public boolean booleanValue() { return ("true".equals(value)); } } /* * $Log: BooleanArgumentImpl.java,v $ * Revision 1.1 2001/08/22 13:35:31 stolis * First version of Connectors. * */ --- NEW FILE: IntegerArgumentImpl.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 Developer 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.connect; import net.sourceforge.javaprofiler.jpi.connect.*; /** * Specification for and value of a Connector argument, whose value is * an integer. Integer values are represented by their corresponding strings. * * @author Jan Stola */ public class IntegerArgumentImpl extends ArgumentImpl implements Connector.IntegerArgument { /** The lower bound for the value of this argument. */ protected int min; /** The upper bound for the value of this argument. */ protected int max; /** * Creates new IntegerArgumentImpl. * * @param mandatory indicates whether this argument must be specified. * @param label short human-readable label for this argument. * @param description human-readable description of this argument and its purpose. * @param name short, unique identifier for the argument, not intended for * exposure to end-user. * @param min the lower bound for the value of this argument. * @param max the upper bound for the value of this argument. */ IntegerArgumentImpl(boolean mandatory, String label, String description, String name, int min, int max) { super(mandatory, label, description, name); this.min=min; this.max=max; } /** * Sets the value of the argument. The value should be checked with * {@link #isValid(int)} before setting it; invalid values will throw * an exception when the connection is established ({@link #connect} * method is called). */ public void setValue(int value) { this.value=String.valueOf(value); } /** * Performs basic sanity check of argument. * * @return <code>true</code> if value represents an int that is * <code>min() <= value <= max()</code> */ public boolean isValid(String value) { int i; try { i=Integer.valueOf(value).intValue(); } catch (NumberFormatException e) { return false; } return isValid(i); } /** * Performs basic sanity check of argument. * * @return <code>true</code> if <code>min() <= value <= max()</code> */ public boolean isValid(int value) { return ((min()<=value) && (value<=max())); } /** * Return the value of the argument as a int. Since the argument may * not have been set or may have an invalid value {@link #isValid(String)} * should be called on {@link Connector.Argument#value()} to check its * validity. If it is invalid the int returned by this method is undefined. * * @return the value of the argument as a int. */ public int intValue() { try { return Integer.valueOf(value).intValue(); } catch (NumberFormatException e) { return 0; } } /** * The upper bound for the value. * * @return the maximum allowed value for this argument. */ public int max() { return max; } /** * The lower bound for the value. * * @return the minimum allowed value for this argument. */ public int min() { return min; } } /* * $Log: IntegerArgumentImpl.java,v $ * Revision 1.1 2001/08/22 13:35:31 stolis * First version of Connectors. * */ --- NEW FILE: LaunchConnector.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 Developer 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.connect; import java.util.Map; import java.util.List; import java.util.HashMap; import java.util.ArrayList; import java.util.ResourceBundle; import net.sourceforge.javaprofiler.jpi.connect.*; /** * Abstract super class for launching connectors. * * @author Jan Stola */ public abstract class LaunchConnector implements Connector { /** * Returns the arguments accepted by this Connector and their default values. * The keys of the returned map are string argument names. The values are * {@link Connector.Argument} containing information about the argument * and its default value. * * @return the map associating argument names with argument information * and default value. */ public Map defaultArguments() { ResourceBundle bundle=ResourceBundle.getBundle("net.sourceforge.javaprofiler.jpiimpl.bundle"); Map args=new HashMap(); String sep=System.getProperty("file.separator"); Connector.Argument arg=new StringArgumentImpl(false, bundle.getString("Launcher"), bundle.getString("LauncherDesc"), "launcher"); arg.setValue(System.getProperty("java.home")+sep+"bin"+sep+"java"); args.put(arg.name(), arg); arg=new StringArgumentImpl(false, bundle.getString("Options"), bundle.getString("OptionsDesc"), "options"); arg.setValue(""); args.put(arg.name(), arg); arg=new StringArgumentImpl(true, bundle.getString("Class"), bundle.getString("ClassDesc"), "class"); arg.setValue(""); args.put(arg.name(), arg); arg=new StringArgumentImpl(false, bundle.getString("Arguments"), bundle.getString("ArgumentsDesc"), "arguments"); arg.setValue(""); args.put(arg.name(), arg); arg=new StringArgumentImpl(false, bundle.getString("Workdir"), bundle.getString("WorkdirDesc"), "workdir"); arg.setValue(System.getProperty("user.dir")); args.put(arg.name(), arg); arg=new StringArgumentImpl(false, bundle.getString("Quote"), bundle.getString("QuoteDesc"), "quote"); arg.setValue("\""); args.put(arg.name(), arg); //profiling args List choices=new ArrayList(4); choices.add("off"); choices.add("object"); choices.add("method"); choices.add("trace"); arg=new SelectedArgumentImpl(false, bundle.getString("AllocLevel"), bundle.getString("AllocLevelDesc"), "allocLevel", choices); arg.setValue("trace"); args.put(arg.name(), arg); arg=new BooleanArgumentImpl(false, bundle.getString("AllocThread"), bundle.getString("AllocThreadDesc"), "allocThread"); ((Connector.BooleanArgument)arg).setValue(true); args.put(arg.name(), arg); arg=new IntegerArgumentImpl(false, bundle.getString("AllocThraceDepth"), bundle.getString("AllocTraceDepthDesc"), "allocTraceDepth", 1, 100); ((Connector.IntegerArgument)arg).setValue(2); args.put(arg.name(), arg); choices=new ArrayList(3); choices.add("off"); choices.add("method"); choices.add("trace"); arg=new SelectedArgumentImpl(false, bundle.getString("CPULevel"), bundle.getString("CPULevelDesc"), "cpuLevel", choices); arg.setValue("trace"); args.put(arg.name(), arg); arg=new BooleanArgumentImpl(false, bundle.getString("CPUThread"), bundle.getString("CPUThreadDesc"), "cpuThread"); ((Connector.BooleanArgument)arg).setValue(true); args.put(arg.name(), arg); arg=new IntegerArgumentImpl(false, bundle.getString("CPUTraceDepth"), bundle.getString("CPUTraceDepthDesc"), "cpuTraceDepth", 1, 100); ((Connector.IntegerArgument)arg).setValue(2); args.put(arg.name(), arg); choices=new ArrayList(2); choices.add("exact"); choices.add("sampling"); arg=new SelectedArgumentImpl(false, bundle.getString("CPUMethod"), bundle.getString("CPUMethodDesc"), "cpuMethod", choices); arg.setValue("sampling"); args.put(arg.name(), arg); return args; } } /* * $Log: LaunchConnector.java,v $ * Revision 1.1 2001/08/22 13:35:31 stolis * First version of Connectors. * */ --- NEW FILE: SelectedArgumentImpl.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 Developer 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.connect; import java.util.List; import net.sourceforge.javaprofiler.jpi.connect.Connector; /** * Specification for and value of a Connector argument, whose value is * a String selected from a list of choices. * * @author Jan Stola */ public class SelectedArgumentImpl extends ArgumentImpl implements Connector.SelectedArgument { /** Possible values for the argument. */ protected List choices; /** * Creates new SelectedArgumentImpl. * * @param mandatory indicates whether this argument must be specified. * @param label short human-readable label for this argument. * @param description human-readable description of this argument and its purpose. * @param name short, unique identifier for the argument, not intended for * exposure to end-user. * @param choices possible values for the argument. */ SelectedArgumentImpl(boolean mandatory, String label, String description, String name, List choices) { super(mandatory, label, description, name); this.choices=choices; } /** * Return the possible values for the argument. * * @return List of String */ public List choices() { return choices; } /** * Performs basic sanity check of argument. * * @return <code>true</code> if value is one of {@link #choices()}. */ public boolean isValid(String value) { return choices.contains(value); } } /* * $Log: SelectedArgumentImpl.java,v $ * Revision 1.1 2001/08/22 13:35:31 stolis * First version of Connectors. * */ --- NEW FILE: ShmemAttachConnector.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 Developer 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.connect; import IProf; import CommunSetupShMem; import java.util.Map; import java.util.HashMap; import java.util.Iterator; import java.util.ResourceBundle; import net.sourceforge.javaprofiler.jpi.VirtualMachine; import net.sourceforge.javaprofiler.jpi.connect.*; /** * Connector that attaches by shared memory to other VM. * * @author Jan Stola */ public class ShmemAttachConnector implements Connector { public static ResourceBundle bundle=ResourceBundle.getBundle("net.sourceforge.javaprofiler.jpiimpl.bundle"); /** * Attaches to VM using shared memory. */ public VirtualMachine connect(Map arguments) throws IllegalConnectorArgumentsException, ConnectingException { ((ShmemTransport)transport()).initialize(); String address=null; Iterator iter=arguments.keySet().iterator(); while (iter.hasNext()) { Connector.Argument arg=(Connector.Argument)iter.next(); if ("address".equals(arg.name())) { String val=arg.value(); if ((val!=null)&&(val.length()!=0)) { address=val; } } } if (address!=null) { throw new IllegalConnectorArgumentsException("Wrong or missing shared memory area address.", "address"); } IProf prof=new IProf(new CommunSetupShMem(address, 256*1024)); prof.runClient(); //PENDING return null; } /** * Returns the transport mechanism used by this connector to establish * connections with a target VM. * * @return the {@link Transport} used by this connector. */ public Transport transport() { return ShmemTransport.getDefault(); } /** * Returns the arguments accepted by this Connector and their default values. * The keys of the returned map are string argument names. The values are * {@link Connector.Argument} containing information about the argument * and its default value. * * @return the map associating argument names with argument information * and default value. */ public Map defaultArguments() { Map args=new HashMap(1); Connector.Argument arg=new StringArgumentImpl(true, bundle.getString("Address"), bundle.getString("AttachAddress"), "address"); arg.setValue(""); args.put(arg.name(), arg); return args; } /** * Returns a type of this connector. Three currently supported types are * attaching, listening and launching connectors. * * @return the type of this connector */ public int type() { return Connector.ATTACHING_CONNECTOR; } /** * Returns a human-readable description of this connector and its purpose. * * @return the description of this connector */ public String description() { return bundle.getString("ShmemAttachDesc"); } /** * Returns a short identifier for the connector. Connector implementors * should follow similar naming conventions as are used with packages * to avoid name collisions. For example, our connector implementations * have names prefixed with "net.sourceforge.javaprofiler.jpi.". Not intended * for exposure to the end-user. * * @return the name of this connector. */ public String name() { return "net.sourceforge.javaprofiler.jpi.ShmemAttachConnector"; } } /* * $Log: ShmemAttachConnector.java,v $ * Revision 1.1 2001/08/22 13:35:31 stolis * First version of Connectors. * */ --- NEW FILE: ShmemLaunchConnector.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 Developer 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.connect; import java.util.Map; import java.util.ResourceBundle; import net.sourceforge.javaprofiler.jpi.VirtualMachine; import net.sourceforge.javaprofiler.jpi.connect.*; /** * Connector that launches target VM using command line * and attaches to it through shared memory. * * @author Jan Stola */ public class ShmemLaunchConnector extends LaunchConnector { public static ResourceBundle bundle=ResourceBundle.getBundle("net.sourceforge.javaprofiler.jpiimpl.bundle"); /** * Launches the VM and connects to it through shared memory. */ public VirtualMachine connect(Map arguments) throws IllegalConnectorArgumentsException, ConnectingException { ((ShmemTransport)transport()).initialize(); //PENDING return null; } /** * Returns the transport mechanism used by this connector to establish * connections with a target VM. * * @return the {@link Transport} used by this connector. */ public Transport transport() { return ShmemTransport.getDefault(); } /** * Returns the arguments accepted by this Connector and their default values. * The keys of the returned map are string argument names. The values are * {@link Connector.Argument} containing information about the argument * and its default value. * * @return the map associating argument names with argument information * and default value. */ public Map defaultArguments() { Map args=super.defaultArguments(); Connector.Argument arg=new StringArgumentImpl(false, bundle.getString("Address"), bundle.getString("LaunchAddress"), "address"); arg.setValue(""); args.put(arg.name(), arg); return args; } /** * Returns a type of this connector. Three currently supported types are * attaching, listening and launching connectors. * * @return the type of this connector */ public int type() { return Connector.LAUNCHING_CONNECTOR; } /** * Returns a human-readable description of this connector and its purpose. * * @return the description of this connector */ public String description() { return bundle.getString("ShmemLaunchDesc"); } /** * Returns a short identifier for the connector. Connector implementors * should follow similar naming conventions as are used with packages * to avoid name collisions. For example, our connector implementations * have names prefixed with "net.sourceforge.javaprofiler.jpi.". Not intended * for exposure to the end-user. * * @return the name of this connector. */ public String name() { return "net.sourceforge.javaprofiler.jpi.ShmemLaunchConnector"; } } /* * $Log: ShmemLaunchConnector.java,v $ * Revision 1.1 2001/08/22 13:35:31 stolis * First version of Connectors. * */ --- NEW FILE: ShmemListenConnector.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 Developer 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.connect; import IProf; import CommunSetupShMem; import java.util.Map; import java.util.HashMap; import java.util.Iterator; import java.util.ResourceBundle; import net.sourceforge.javaprofiler.jpi.VirtualMachine; import net.sourceforge.javaprofiler.jpi.connect.*; /** * Connector that accepts shared memory connections initiated by other VMs. * * @author Jan Stola */ public class ShmemListenConnector implements Connector { public static ResourceBundle bundle=ResourceBundle.getBundle("net.sourceforge.javaprofiler.jpiimpl.bundle"); /** * Listens for connections initiated by other VMs. */ public VirtualMachine connect(Map arguments) throws IllegalConnectorArgumentsException, ConnectingException { ((ShmemTransport)transport()).initialize(); String address=null; Iterator iter=arguments.keySet().iterator(); while (iter.hasNext()) { Connector.Argument arg=(Connector.Argument)iter.next(); if ("address".equals(arg.name())) { String val=arg.value(); if ((val!=null)&&(val.length()!=0)) { address=val; } } } if (address!=null) { throw new IllegalConnectorArgumentsException("Wrong or missing shared memory area address.", "address"); } IProf prof=new IProf(new CommunSetupShMem(address, 256*1024)); prof.runClient(); //PENDING return null; } /** * Returns the transport mechanism used by this connector to establish * connections with a target VM. * * @return the {@link Transport} used by this connector. */ public Transport transport() { return SocketTransport.getDefault(); } /** * Returns the arguments accepted by this Connector and their default values. * The keys of the returned map are string argument names. The values are * {@link Connector.Argument} containing information about the argument * and its default value. * * @return the map associating argument names with argument information * and default value. */ public Map defaultArguments() { Map args=new HashMap(1); Connector.Argument arg=new StringArgumentImpl(true, bundle.getString("Address"), bundle.getString("ListenAddress"), "address"); arg.setValue(""); args.put(arg.name(), arg); return args; } /** * Returns a type of this connector. Three currently supported types are * attaching, listening and launching connectors. * * @return the type of this connector */ public int type() { return Connector.LISTENING_CONNECTOR; } /** * Returns a human-readable description of this connector and its purpose. * * @return the description of this connector */ public String description() { return bundle.getString("ShmemListenDesc"); } /** * Returns a short identifier for the connector. Connector implementors * should follow similar naming conventions as are used with packages * to avoid name collisions. For example, our connector implementations * have names prefixed with "net.sourceforge.javaprofiler.jpi.". Not intended * for exposure to the end-user. * * @return the name of this connector. */ public String name() { return "net.sourceforge.javaprofiler.jpi.ShmemListenConnector"; } } /* * $Log: ShmemListenConnector.java,v $ * Revision 1.1 2001/08/22 13:35:31 stolis * First version of Connectors. * */ --- NEW FILE: ShmemTransport.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 Developer 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.connect; import net.sourceforge.javaprofiler.jpi.connect.Transport; /** * Shared memory transport. * * @author Jan Stola */ public class ShmemTransport implements Transport { /** Name of this transport. */ private static final String name="net.sourceforge.javaprofiler.jpi.SharedMemoryTransport"; /** Singleton instance of this class. */ private static ShmemTransport instance; /** * Creates new SocketTransport. The constructor is private * because the class should be singleton. */ private ShmemTransport() { } /** * Initializes this transport. Loads the <code>pt_shmem</code> shared library * (<code>pt_shmem.dll</code> or <code>libpt_shmem.so</code>). */ protected void initialize() { System.loadLibrary("pt_shmem"); } /** * Returns singleton instance of this class. * * @return singleton instance of this class. */ public static ShmemTransport getDefault() { if (instance==null) { instance=new ShmemTransport(); } return instance; } /** * Returns a short identifier for the transport. Transport implementors * should follow similar naming conventions as are used with packages * to avoid name collisions. For example, our transport implementations * have names prefixed with "net.sourceforge.javaprofiler.jpi.". * * @return the name of this transport. */ public String name() { return name; } } /* * $Log: ShmemTransport.java,v $ * Revision 1.1 2001/08/22 13:35:31 stolis * First version of Connectors. * */ --- NEW FILE: SocketAttachConnector.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 Developer 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.connect; import IProf; import CommunSetupSocket; import java.util.Map; import java.util.HashMap; import java.util.Iterator; import java.util.ResourceBundle; import net.sourceforge.javaprofiler.jpi.VirtualMachine; import net.sourceforge.javaprofiler.jpi.connect.*; /** * Connector that attaches by socket to other VM. * * @author Jan Stola */ public class SocketAttachConnector implements Connector { public static ResourceBundle bundle=ResourceBundle.getBundle("net.sourceforge.javaprofiler.jpiimpl.bundle"); /** * Attaches to VM using socket. */ public VirtualMachine connect(Map arguments) throws IllegalConnectorArgumentsException, ConnectingException { String host="localhost"; int port=-1; Connector.Argument invalid=null; Iterator iter=arguments.keySet().iterator(); while (iter.hasNext()) { Connector.Argument arg=(Connector.Argument)iter.next(); if ("port".equals(arg.name())) { if (arg.isValid(arg.value())) { port=((Connector.IntegerArgument)arg).intValue(); } } if ("host".equals(arg.name())) { String val=arg.value(); if ((val!=null)&&(val.length()!=0)) { host=val; } } } if (port==-1) { throw new IllegalConnectorArgumentsException("Wrong or missing port number.", "port"); } IProf prof=new IProf(new CommunSetupSocket(CommunSetupSocket.CLIENT_MODE, host, port)); prof.runClient(); //PENDING return null; } /** * Returns the transport mechanism used by this connector to establish * connections with a target VM. * * @return the {@link Transport} used by this connector. */ public Transport transport() { return SocketTransport.getDefault(); } /** * Returns the arguments accepted by this Connector and their default values. * The keys of the returned map are string argument names. The values are * {@link Connector.Argument} containing information about the argument * and its default value. * * @return the map associating argument names with argument information * and default value. */ public Map defaultArguments() { Map args=new HashMap(2); Connector.Argument arg=new StringArgumentImpl(false, bundle.getString("Host"), bundle.getString("AttachHost"), "host"); arg.setValue(""); args.put(arg.name(), arg); arg=new IntegerArgumentImpl(true, bundle.getString("Port"), bundle.getString("AttachPort"), "port", 0, 65535); ((Connector.IntegerArgument)arg).setValue(0); args.put(arg.name(), arg); return args; } /** * Returns a type of this connector. Three currently supported types are * attaching, listening and launching connectors. * * @return the type of this connector */ public int type() { return Connector.ATTACHING_CONNECTOR; } /** * Returns a human-readable description of this connector and its purpose. * * @return the description of this connector */ public String description() { return bundle.getString("SocketAttachDesc"); } /** * Returns a short identifier for the connector. Connector implementors * should follow similar naming conventions as are used with packages * to avoid name collisions. For example, our connector implementations * have names prefixed with "net.sourceforge.javaprofiler.jpi.". Not intended * for exposure to the end-user. * * @return the name of this connector. */ public String name() { return "net.sourceforge.javaprofiler.jpi.SocketAttachConnector"; } } /* * $Log: SocketAttachConnector.java,v $ * Revision 1.1 2001/08/22 13:35:31 stolis * First version of Connectors. * */ --- NEW FILE: SocketLaunchConnector.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 Developer 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.connect; import java.util.Map; import java.util.ResourceBundle; import net.sourceforge.javaprofiler.jpi.VirtualMachine; import net.sourceforge.javaprofiler.jpi.connect.*; /** * Connector that launches target VM using command line * and attaches to it through socket. * * @author Jan Stola */ public class SocketLaunchConnector extends LaunchConnector { public static ResourceBundle bundle=ResourceBundle.getBundle("net.sourceforge.javaprofiler.jpiimpl.bundle"); /** * Launches the VM and connects to it through socket. */ public VirtualMachine connect(Map arguments) throws IllegalConnectorArgumentsException, ConnectingException { //PENDING return null; } /** * Returns the transport mechanism used by this connector to establish * connections with a target VM. * * @return the {@link Transport} used by this connector. */ public Transport transport() { return SocketTransport.getDefault(); } /** * Returns the arguments accepted by this Connector and their default values. * The keys of the returned map are string argument names. The values are * {@link Connector.Argument} containing information about the argument * and its default value. * * @return the map associating argument names with argument information * and default value. */ public Map defaultArguments() { Map args=super.defaultArguments(); Connector.IntegerArgument arg=new IntegerArgumentImpl(false, bundle.getString("Port"), bundle.getString("LaunchPort"), "port", 0, 65535); arg.setValue(0); args.put(arg.name(), arg); return args; } /** * Returns a type of this connector. Three currently supported types are * attaching, listening and launching connectors. * * @return the type of this connector */ public int type() { return Connector.LAUNCHING_CONNECTOR; } /** * Returns a human-readable description of this connector and its purpose. * * @return the description of this connector */ public String description() { return bundle.getString("SocketLaunchDesc"); } /** * Returns a short identifier for the connector. Connector implementors * should follow similar naming conventions as are used with packages * to avoid name collisions. For example, our connector implementations * have names prefixed with "net.sourceforge.javaprofiler.jpi.". Not intended * for exposure to the end-user. * * @return the name of this connector. */ public String name() { return "net.sourceforge.javaprofiler.jpi.SocketLaunchConnector"; } } /* * $Log: SocketLaunchConnector.java,v $ * Revision 1.1 2001/08/22 13:35:31 stolis * First version of Connectors. * */ --- NEW FILE: SocketListenConnector.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 Developer 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.connect; import IProf; import CommunSetupSocket; import java.util.Map; import java.util.HashMap; import java.util.Iterator; import java.util.ResourceBundle; import net.sourceforge.javaprofiler.jpi.VirtualMachine; import net.sourceforge.javaprofiler.jpi.connect.*; /** * Connector that accepts socket connections initiated by other VMs. * * @author Jan Stola */ public class SocketListenConnector implements Connector { public static ResourceBundle bundle=ResourceBundle.getBundle("net.sourceforge.javaprofiler.jpiimpl.bundle"); /** * Listens for connections initiated by other VMs. */ public VirtualMachine connect(Map arguments) throws IllegalConnectorArgumentsException, ConnectingException { int port=-1; Connector.Argument invalid=null; Iterator iter=arguments.keySet().iterator(); while (iter.hasNext()) { Connector.Argument arg=(Connector.Argument)iter.next(); if ("port".equals(arg.name())) { if (arg.isValid(arg.value())) { port=((Connector.IntegerArgument)arg).intValue(); } } } if (port==-1) { throw new IllegalConnectorArgumentsException("Wrong or missing port number.", "port"); } IProf prof=new IProf(new CommunSetupSocket(CommunSetupSocket.SERVER_MODE, "localhost", port)); prof.runClient(); //PENDING return null; } /** * Returns the transport mechanism used by this connector to establish * connections with a target VM. * * @return the {@link Transport} used by this connector. */ public Transport transport() { return SocketTransport.getDefault(); } /** * Returns the arguments accepted by this Connector and their default values. * The keys of the returned map are string argument names. The values are * {@link Connector.Argument} containing information about the argument * and its default value. * * @return the map associating argument names with argument information * and default value. */ public Map defaultArguments() { Map args=new HashMap(1); Connector.IntegerArgument arg=new IntegerArgumentImpl(true, bundle.getString("Port"), bundle.getString("ListenPort"), "port", 0, 65535); arg.setValue(0); args.put(arg.name(), arg); return args; } /** * Returns a type of this connector. Three currently supported types are * attaching, listening and launching connectors. * * @return the type of this connector */ public int type() { return Connector.LISTENING_CONNECTOR; } /** * Returns a human-readable description of this connector and its purpose. * * @return the description of this connector */ public String description() { return bundle.getString("SocketListenDesc"); } /** * Returns a short identifier for the connector. Connector implementors * should follow similar naming conventions as are used with packages * to avoid name collisions. For example, our connector implementations * have names prefixed with "net.sourceforge.javaprofiler.jpi.". Not intended * for exposure to the end-user. * * @return the name of this connector. */ public String name() { return "net.sourceforge.javaprofiler.jpi.SocketListenConnector"; } } /* * $Log: SocketListenConnector.java,v $ * Revision 1.1 2001/08/22 13:35:31 stolis * First version of Connectors. * */ --- NEW FILE: SocketTransport.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 Developer 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.connect; import net.sourceforge.javaprofiler.jpi.connect.Transport; /** * Socket transport. * * @author Jan Stola */ public class SocketTransport implements Transport { /** Name of this transport. */ private static final String name="net.sourceforge.javaprofiler.jpi.SocketTransport"; /** Singleton instance of this class. */ private static SocketTransport instance; /** * Creates new SocketTransport. The constructor is private * because the class should be singleton. */ private SocketTransport() { } /** * Returns singleton instance of this class. * * @return singleton instance of this class. */ public static SocketTransport getDefault() { if (instance==null) { instance=new SocketTransport(); } return instance; } /** * Returns a short identifier for the transport. Transport implementors * should follow similar naming conventions as are used with packages * to avoid name collisions. For example, our transport implementations * have names prefixed with "net.sourceforge.javaprofiler.jpi.". * * @return the name of this transport. */ public String name() { return name; } } /* * $Log: SocketTransport.java,v $ * Revision 1.1 2001/08/22 13:35:31 stolis * First version of Connectors. * */ --- NEW FILE: StringArgumentImpl.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 Developer 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.connect; import net.sourceforge.javaprofiler.jpi.connect.Connector; /** * Specification for and value of a Connector argument, whose value * is a String. * * @author Jan Stola */ public class StringArgumentImpl extends ArgumentImpl implements Connector.StringArgument { /** * Creates new StringArgumentImpl. * * @param mandatory indicates whether this argument must be specified. * @param label short human-readable label for this argument. * @param description human-readable description of this argument and its purpose. * @param name short, unique identifier for the argument, not intended for * exposure to end-user. */ StringArgumentImpl(boolean mandatory, String label, String description, String name) { super(mandatory, label, description, name); } } /* * $Log: StringArgumentImpl.java,v $ * Revision 1.1 2001/08/22 13:35:31 stolis * First version of Connectors. * */ |
From: Jan S. <st...@us...> - 2001-08-22 13:31:41
|
Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/connect In directory usw-pr-cvs1:/tmp/cvs-serv5747/connect Log Message: Directory /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl/connect added to the repository |
From: Jan S. <st...@us...> - 2001-08-22 13:27:38
|
Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl In directory usw-pr-cvs1:/tmp/cvs-serv2950 Added Files: bundle.properties Log Message: Resource bundle. --- NEW FILE: bundle.properties --- SocketLaunchDesc=Connector that launches target VM using command line and attaches to it through shared memory. ShmemAttachDesc=Connector that attaches by shared memory to other VM. Port=Port Address=Address ListenPort=Port number at which to listen for VM connection. OptionsDesc=Launched VM options. Options=Options LauncherDesc=Command to launch target VM. Launcher=Launcher AttachPort=Port number to which to attach for VM connection. AttachHost=Machine name to which to attach for VM connection. Host=Host AttachAddress=Name of the shared memory area to which to attach for VM connection. ListenAddress=Name of the shared memory area at which to listen for VM connection. ShmemLaunchDesc=Connector that launches target VM using command line and attaches to it through socket. ShmemListenDesc=Connector that accepts shared memory connections initiated by other VMs. LaunchPort=Port number to used for the communication. LaunchAddress=Name of the shared memory area to use for the communication. QuoteDesc=Character used to combine space-delimited text into a single command line argument. Quote=Quote WorkdirDesc=Working directory of the profiled process. Workdir=Working directory ArgumentsDesc=Arguments of the profiled class. Arguments=Arguments ClassDesc=Main class, or if -jar is an options, the main jar file. Class=Class SocketListenDesc=Connector that accepts socket connections initiated by other VMs. SocketAttachDesc=Connector that attaches by socket to other VM. |
From: Jan S. <st...@us...> - 2001-08-22 13:25:02
|
Update of /cvsroot/javaprofiler/jpiimpl/net/sourceforge/javaprofiler/jpiimpl In directory usw-pr-cvs1:/tmp/cvs-serv2029 Added Files: VirtualMachineManagerImpl.java Log Message: First version of implementation of VirtualMachineManager. --- NEW FILE: VirtualMachineManagerImpl.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 Developer 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; import java.util.List; import java.util.LinkedList; import net.sourceforge.javaprofiler.jpi.VirtualMachineManager; import net.sourceforge.javaprofiler.jpi.connect.Connector; import net.sourceforge.javaprofiler.jpiimpl.connect.*; /** * Implementation of Virtual Machine Manager. * * @see net.sourceforge.javaprofiler.jpi.VirtualMachineManager * @author Jan Stola */ public class VirtualMachineManagerImpl implements VirtualMachineManager { /** * All connectors. The first item of this array should be default * launching connector. */ private static final Connector[] allConnectors={new SocketLaunchConnector(), new ShmemLaunchConnector(), new SocketAttachConnector(), new ShmemAttachConnector(), new SocketListenConnector(), new ShmemListenConnector()}; /** * All VMs that are connected to the profiler. * List of {@link net.sourceforge.javaprofiler.jpi.VirtualMachine} objects. */ private List allVMs; /** * Returns the list of all known * {@link net.sourceforge.javaprofiler.jpi.connect.Connector} objects * of the given <code>type</code>. * * @param type mask for the type of connectors that should be listed. * @return a list of * {@link net.sourceforge.javaprofiler.jpi.connect.Connector} objects. */ public List connectors(int type) { List cons=new LinkedList(); for (int i=0; i<allConnectors.length; i++) { if (allConnectors[i].type()==type) { cons.add(allConnectors[i]); } } return cons; } /** * Lists all target VMs which are connected to the profiler. The list includes * {@link net.sourceforge.javaprofiler.jpi.VirtualMachine} instances for any target * VMs which initiated a connection and any target VMs to which this manager has * initiated a connection. A target VM will remain in this list until it is discarded * through {@link net.sourceforge.javaprofiler.jpi.VirtualMachine#dispose()} or until * it stops, whichever happens first. * * @return a list of {@link net.sourceforge.javaprofiler.jpi.VirtualMachine} objects, * each mirroring a target VM. */ public List connectedVirtualMachines() { return allVMs; } /** * Identifies the default connector. This connector should be used as * the launching connector when selection of a connector with specific * characteristics is unnecessary. * * @return the default launching connector * {@link net.sourceforge.javaprofiler.jpi.connect.Connector#LAUNCHING_CONNECTOR} */ public Connector defaultConnector() { return allConnectors[0]; } } /* * $Log: VirtualMachineManagerImpl.java,v $ * Revision 1.1 2001/08/22 13:24:59 stolis * First version of implementation of VirtualMachineManager. * */ |
Update of /cvsroot/javaprofiler/interface/net/sourceforge/javaprofiler/jpi In directory usw-pr-cvs1:/tmp/cvs-serv31535 Modified Files: ClassType.java ProfilerInfo.java ReferenceType.java Snapshot.java ThreadInfo.java Log Message: Full qualification of classes removed where it is not necessary. Index: ClassType.java =================================================================== RCS file: /cvsroot/javaprofiler/interface/net/sourceforge/javaprofiler/jpi/ClassType.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** ClassType.java 2000/11/27 17:45:11 1.1.1.1 --- ClassType.java 2001/08/22 13:19:47 1.2 *************** *** 46,50 **** * Returns a the single non-abstract {@link Method} visible from this class * that has the given name and signature. See ! * {@link ReferenceType#methodsByName(java.lang.String, java.lang.String)} * for information on signature format. * The returned method (if non-<code>null</code>) is a component --- 46,50 ---- * Returns a the single non-abstract {@link Method} visible from this class * that has the given name and signature. See ! * {@link ReferenceType#methodsByName(String, String)} * for information on signature format. * The returned method (if non-<code>null</code>) is a component *************** *** 120,123 **** --- 120,126 ---- /* * $Log$ + * Revision 1.2 2001/08/22 13:19:47 stolis + * Full qualification of classes removed where it is not necessary. + * * Revision 1.1.1.1 2000/11/27 17:45:11 stolis * First version of the interface of our architecture. Index: ProfilerInfo.java =================================================================== RCS file: /cvsroot/javaprofiler/interface/net/sourceforge/javaprofiler/jpi/ProfilerInfo.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** ProfilerInfo.java 2000/11/27 17:44:41 1.1.1.1 --- ProfilerInfo.java 2001/08/22 13:19:47 1.2 *************** *** 89,96 **** * in the target VM, a {@link ThreadInfo} that holds information about it * is placed in the list. The returned list contains threads created through ! * <code>java.lang.Thread</code>, all native threads attached to the target * VM through JNI, and system threads created by the target VM. * <p>Thread objects that have not yet been started ! * (through <code>java.lang.Thread.start()</code>) and thread objects that * have completed their execution are not included in the returned list. * --- 89,96 ---- * in the target VM, a {@link ThreadInfo} that holds information about it * is placed in the list. The returned list contains threads created through ! * <code>Thread</code>, all native threads attached to the target * VM through JNI, and system threads created by the target VM. * <p>Thread objects that have not yet been started ! * (through <code>Thread.start()</code>) and thread objects that * have completed their execution are not included in the returned list. * *************** *** 119,122 **** --- 119,125 ---- /* * $Log$ + * Revision 1.2 2001/08/22 13:19:47 stolis + * Full qualification of classes removed where it is not necessary. + * * Revision 1.1.1.1 2000/11/27 17:44:41 stolis * First version of the interface of our architecture. Index: ReferenceType.java =================================================================== RCS file: /cvsroot/javaprofiler/interface/net/sourceforge/javaprofiler/jpi/ReferenceType.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** ReferenceType.java 2000/11/27 17:45:05 1.1.1.1 --- ReferenceType.java 2001/08/22 13:19:47 1.2 *************** *** 89,93 **** * Determines if this type was declared abstract. Return value is undefined * for arrays and for primitive classes (for example, ! * <code>java.lang.Integer.TYPE</code>). * * @return <code>true</code> if this type is abstract; <code>false</code> --- 89,93 ---- * Determines if this type was declared abstract. Return value is undefined * for arrays and for primitive classes (for example, ! * <code>Integer.TYPE</code>). * * @return <code>true</code> if this type is abstract; <code>false</code> *************** *** 98,102 **** /** * Determines if this type was declared final. For arrays and for primitive ! * classes, such as <code>java.lang.Integer.TYPE</code>, the return value * is always true. * --- 98,102 ---- /** * Determines if this type was declared final. For arrays and for primitive ! * classes, such as <code>Integer.TYPE</code>, the return value * is always true. * *************** *** 110,114 **** * declared static, so <code>false</code> is returned for any package-level * type, array type, or primitive class (for example, ! * <code>java.lang.Integer.TYPE</code>). * * @return <code>true</code> if this type is static; <code>false</code> --- 110,114 ---- * declared static, so <code>false</code> is returned for any package-level * type, array type, or primitive class (for example, ! * <code>Integer.TYPE</code>). * * @return <code>true</code> if this type is static; <code>false</code> *************** *** 148,153 **** * to determine visibility. At most one method in the list is a concrete * method and a component of ClassType; any other methods in the list are ! * abstract. Use {@link ClassType#concreteMethodByName(java.lang.String, ! * java.lang.String)} to retrieve only the matching concrete method. * * @parame name - the name of the method to find. --- 148,153 ---- * to determine visibility. At most one method in the list is a concrete * method and a component of ClassType; any other methods in the list are ! * abstract. Use {@link ClassType#concreteMethodByName(String, ! * String)} to retrieve only the matching concrete method. * * @parame name - the name of the method to find. *************** *** 164,168 **** * For primitive classes the returned name is the name of the corresponding * primitive type; for example, "int" is returned as the name of the class ! * represented by <code>java.lang.Integer.TYPE</code>. * * @return a string containing the type name. --- 164,168 ---- * For primitive classes the returned name is the name of the corresponding * primitive type; for example, "int" is returned as the name of the class ! * represented by <code>Integer.TYPE</code>. * * @return a string containing the type name. *************** *** 224,227 **** --- 224,230 ---- /* * $Log$ + * Revision 1.2 2001/08/22 13:19:47 stolis + * Full qualification of classes removed where it is not necessary. + * * Revision 1.1.1.1 2000/11/27 17:45:05 stolis * First version of the interface of our architecture. Index: Snapshot.java =================================================================== RCS file: /cvsroot/javaprofiler/interface/net/sourceforge/javaprofiler/jpi/Snapshot.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Snapshot.java 2001/07/17 21:03:34 1.2 --- Snapshot.java 2001/08/22 13:19:47 1.3 *************** *** 95,103 **** * was made. For each running thread in the target VM, a {@link ThreadInfo} * that holds information about it is placed in the list. The returned list ! * contains threads created through <code>java.lang.Thread</code>, all native * threads attached to the target VM through JNI, and system threads created * by the target VM. * <p>Thread objects that have not yet been started ! * (through <code>java.lang.Thread.start()</code>) and thread objects that * have completed their execution are not included in the returned list. * --- 95,103 ---- * was made. For each running thread in the target VM, a {@link ThreadInfo} * that holds information about it is placed in the list. The returned list ! * contains threads created through <code>Thread</code>, all native * threads attached to the target VM through JNI, and system threads created * by the target VM. * <p>Thread objects that have not yet been started ! * (through <code>Thread.start()</code>) and thread objects that * have completed their execution are not included in the returned list. * *************** *** 152,155 **** --- 152,158 ---- /* * $Log$ + * Revision 1.3 2001/08/22 13:19:47 stolis + * Full qualification of classes removed where it is not necessary. + * * Revision 1.2 2001/07/17 21:03:34 stolis * Javadoc updated. Index: ThreadInfo.java =================================================================== RCS file: /cvsroot/javaprofiler/interface/net/sourceforge/javaprofiler/jpi/ThreadInfo.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** ThreadInfo.java 2000/11/27 17:44:52 1.1.1.1 --- ThreadInfo.java 2001/08/22 13:19:47 1.2 *************** *** 52,56 **** * Suspends this thread. The thread can be resumed through {@link #resume()}. * <p>Suspending single threads with this method has the same dangers as ! * <code>java.lang.Thread.suspend()</code>. If the suspended thread holds * a monitor needed by another running thread, deadlock is possible in * the target VM (at least until the suspended thread is resumed again). --- 52,56 ---- * Suspends this thread. The thread can be resumed through {@link #resume()}. * <p>Suspending single threads with this method has the same dangers as ! * <code>Thread.suspend()</code>. If the suspended thread holds * a monitor needed by another running thread, deadlock is possible in * the target VM (at least until the suspended thread is resumed again). *************** *** 58,62 **** * through <code>resume()</code> method mentioned above; the application * in the target VM cannot resume the suspended thread through ! * <code>java.lang.Thread.resume()</code>. */ public void suspend(); --- 58,62 ---- * through <code>resume()</code> method mentioned above; the application * in the target VM cannot resume the suspended thread through ! * <code>Thread.resume()</code>. */ public void suspend(); *************** *** 185,188 **** --- 185,191 ---- /* * $Log$ + * Revision 1.2 2001/08/22 13:19:47 stolis + * Full qualification of classes removed where it is not necessary. + * * Revision 1.1.1.1 2000/11/27 17:44:52 stolis * First version of the interface of our architecture. |
Update of /cvsroot/javaprofiler/interface/net/sourceforge/javaprofiler/jpi/connect In directory usw-pr-cvs1:/tmp/cvs-serv31535/connect Modified Files: Connector.java IllegalConnectorArgumentsException.java Transport.java VMStartException.java Log Message: Full qualification of classes removed where it is not necessary. Index: Connector.java =================================================================== RCS file: /cvsroot/javaprofiler/interface/net/sourceforge/javaprofiler/jpi/connect/Connector.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** Connector.java 2001/07/17 21:03:39 1.5 --- Connector.java 2001/08/22 13:19:47 1.6 *************** *** 21,24 **** --- 21,26 ---- package net.sourceforge.javaprofiler.jpi.connect; + import java.util.Map; + import java.util.List; import net.sourceforge.javaprofiler.jpi.VirtualMachine; *************** *** 60,64 **** * @return the name of this connector. */ ! public java.lang.String name(); /** --- 62,66 ---- * @return the name of this connector. */ ! public String name(); /** *************** *** 67,71 **** * @return the description of this connector */ ! public java.lang.String description(); /** --- 69,73 ---- * @return the description of this connector */ ! public String description(); /** *************** *** 94,98 **** * and default value. */ ! public java.util.Map defaultArguments(); /** --- 96,100 ---- * and default value. */ ! public Map defaultArguments(); /** *************** *** 101,105 **** * when <code>connect()</code> is called. */ ! public VirtualMachine connect(java.util.Map arguments) throws IllegalConnectorArgumentsException, ConnectingException; --- 103,107 ---- * when <code>connect()</code> is called. */ ! public VirtualMachine connect(Map arguments) throws IllegalConnectorArgumentsException, ConnectingException; *************** *** 110,114 **** * or {@link Connector.SelectedArgument}. */ ! static interface Argument extends java.io.Serializable { /** --- 112,116 ---- * or {@link Connector.SelectedArgument}. */ ! public static interface Argument extends java.io.Serializable { /** *************** *** 118,122 **** * @return the name of this argument. */ ! public java.lang.String name(); /** --- 120,124 ---- * @return the name of this argument. */ ! public String name(); /** *************** *** 125,129 **** * @return a label for this argument */ ! public java.lang.String label(); /** --- 127,131 ---- * @return a label for this argument */ ! public String label(); /** *************** *** 132,136 **** * @return the description of this argument */ ! public java.lang.String description(); /** --- 134,138 ---- * @return the description of this argument */ ! public String description(); /** *************** *** 140,144 **** * @return the current value of the argument. */ ! public java.lang.String value(); /** --- 142,146 ---- * @return the current value of the argument. */ ! public String value(); /** *************** *** 148,152 **** * method is called). */ ! public void setValue(java.lang.String value); /** --- 150,154 ---- * method is called). */ ! public void setValue(String value); /** *************** *** 155,163 **** * @return <code>true</code> if the value is valid to be used in {@link #setValue(String)} */ ! public boolean isValid(java.lang.String value); /** * Indicates whether the argument must be specified. If <code>true</code>, ! * {@link #setValue(java.lang.String)} must be used to set a non-<code>null</code> value * before using this argument in establishing a connection. * --- 157,165 ---- * @return <code>true</code> if the value is valid to be used in {@link #setValue(String)} */ ! public boolean isValid(String value); /** * Indicates whether the argument must be specified. If <code>true</code>, ! * {@link #setValue(String)} must be used to set a non-<code>null</code> value * before using this argument in establishing a connection. * *************** *** 171,175 **** * Boolean. */ ! static interface BooleanArgument extends Argument { /** --- 173,177 ---- * Boolean. */ ! public static interface BooleanArgument extends Argument { /** *************** *** 183,187 **** * @return <code>true</code> if value is a string representation of a boolean value. */ ! public boolean isValid(java.lang.String value); /** --- 185,189 ---- * @return <code>true</code> if value is a string representation of a boolean value. */ ! public boolean isValid(String value); /** *************** *** 200,204 **** * an integer. Integer values are represented by their corresponding strings. */ ! static interface IntegerArgument extends Argument { /** --- 202,206 ---- * an integer. Integer values are represented by their corresponding strings. */ ! public static interface IntegerArgument extends Argument { /** *************** *** 216,220 **** * <code>min() <= value <= max()</code> */ ! public boolean isValid(java.lang.String value); /** --- 218,222 ---- * <code>min() <= value <= max()</code> */ ! public boolean isValid(String value); /** *************** *** 254,258 **** * a String selected from a list of choices. */ ! static interface SelectedArgument extends Argument { /** --- 256,260 ---- * a String selected from a list of choices. */ ! public static interface SelectedArgument extends Argument { /** *************** *** 261,265 **** * @return List of String */ ! public java.util.List choices(); /** --- 263,267 ---- * @return List of String */ ! public List choices(); /** *************** *** 268,272 **** * @return <code>true</code> if value is one of {@link #choices()}. */ ! public boolean isValid(java.lang.String value); } --- 270,274 ---- * @return <code>true</code> if value is one of {@link #choices()}. */ ! public boolean isValid(String value); } *************** *** 276,288 **** * is a String. */ ! static interface StringArgument extends Argument { - /** - * Performs basic sanity check of argument. - * - * @return <code>true</code> always - */ - public boolean isValid(java.lang.String value); - } --- 278,283 ---- * is a String. */ ! public static interface StringArgument extends Argument { } *************** *** 291,294 **** --- 286,292 ---- /* * $Log$ + * Revision 1.6 2001/08/22 13:19:47 stolis + * Full qualification of classes removed where it is not necessary. + * * Revision 1.5 2001/07/17 21:03:39 stolis * Javadoc updated. Index: IllegalConnectorArgumentsException.java =================================================================== RCS file: /cvsroot/javaprofiler/interface/net/sourceforge/javaprofiler/jpi/connect/IllegalConnectorArgumentsException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** IllegalConnectorArgumentsException.java 2001/04/23 18:03:32 1.2 --- IllegalConnectorArgumentsException.java 2001/08/22 13:19:47 1.3 *************** *** 21,24 **** --- 21,27 ---- package net.sourceforge.javaprofiler.jpi.connect; + import java.util.List; + import java.util.ArrayList; + /** * Thrown to indicate an invalid argument or inconsistent passed *************** *** 29,33 **** public class IllegalConnectorArgumentsException extends IllegalArgumentException { /** Names of invalid arguments. */ ! private java.util.List names; /** --- 32,36 ---- public class IllegalConnectorArgumentsException extends IllegalArgumentException { /** Names of invalid arguments. */ ! private List names; /** *************** *** 37,43 **** * @param name name of invalid argument. */ ! public IllegalConnectorArgumentsException(java.lang.String msg, java.lang.String name) { super(msg); ! names=new java.util.ArrayList(1); names.add(name); } --- 40,46 ---- * @param name name of invalid argument. */ ! public IllegalConnectorArgumentsException(String msg, String name) { super(msg); ! names=new ArrayList(1); names.add(name); } *************** *** 49,53 **** * @param names names of invalid arguments. */ ! public IllegalConnectorArgumentsException(java.lang.String msg, java.util.List names) { super(msg); this.names=names; --- 52,56 ---- * @param names names of invalid arguments. */ ! public IllegalConnectorArgumentsException(String msg, List names) { super(msg); this.names=names; *************** *** 59,63 **** * @return list of invalid arguments. */ ! public java.util.List argumentNames() { return names; } --- 62,66 ---- * @return list of invalid arguments. */ ! public List argumentNames() { return names; } *************** *** 67,70 **** --- 70,76 ---- /* * $Log$ + * Revision 1.3 2001/08/22 13:19:47 stolis + * Full qualification of classes removed where it is not necessary. + * * Revision 1.2 2001/04/23 18:03:32 michalpise * Changed to extend IllegalArgumentException instead of Exception. Index: Transport.java =================================================================== RCS file: /cvsroot/javaprofiler/interface/net/sourceforge/javaprofiler/jpi/connect/Transport.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Transport.java 2001/07/07 22:28:04 1.2 --- Transport.java 2001/08/22 13:19:47 1.3 *************** *** 36,40 **** * @return the name of this transport. */ ! public java.lang.String name(); } --- 36,40 ---- * @return the name of this transport. */ ! public String name(); } *************** *** 42,45 **** --- 42,48 ---- /* * $Log$ + * Revision 1.3 2001/08/22 13:19:47 stolis + * Full qualification of classes removed where it is not necessary. + * * Revision 1.2 2001/07/07 22:28:04 stolis * Small change in documentation. Index: VMStartException.java =================================================================== RCS file: /cvsroot/javaprofiler/interface/net/sourceforge/javaprofiler/jpi/connect/VMStartException.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** VMStartException.java 2000/11/27 17:46:46 1.1.1.1 --- VMStartException.java 2001/08/22 13:19:47 1.2 *************** *** 36,40 **** * @param process <code>Process</code> object of the launched target. */ ! public VMStartException(java.lang.Process process) { this.process=process; } --- 36,40 ---- * @param process <code>Process</code> object of the launched target. */ ! public VMStartException(Process process) { this.process=process; } *************** *** 46,50 **** * @param process <code>Process</code> object of the launched target. */ ! public VMStartException(java.lang.String msg, java.lang.Process process) { super(msg); this.process=process; --- 46,50 ---- * @param process <code>Process</code> object of the launched target. */ ! public VMStartException(String msg, Process process) { super(msg); this.process=process; *************** *** 55,58 **** --- 55,61 ---- /* * $Log$ + * Revision 1.2 2001/08/22 13:19:47 stolis + * Full qualification of classes removed where it is not necessary. + * * Revision 1.1.1.1 2000/11/27 17:46:46 stolis * First version of the interface of our architecture. |
From: Jan S. <st...@us...> - 2001-08-22 13:17:02
|
Update of /cvsroot/javaprofiler/interface/net/sourceforge/javaprofiler/jpi In directory usw-pr-cvs1:/tmp/cvs-serv29944 Modified Files: Bootstrap.java Log Message: Bootstrap now points to the implementation of the VirtualMachineManager. Index: Bootstrap.java =================================================================== RCS file: /cvsroot/javaprofiler/interface/net/sourceforge/javaprofiler/jpi/Bootstrap.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Bootstrap.java 2001/07/07 22:20:54 1.2 --- Bootstrap.java 2001/08/22 13:16:59 1.3 *************** *** 21,24 **** --- 21,26 ---- package net.sourceforge.javaprofiler.jpi; + import net.sourceforge.javaprofiler.jpiimpl.VirtualMachineManagerImpl; + /** * Initial class that provides access to the default implementation of JPI *************** *** 36,40 **** */ public static VirtualMachineManager virtualMachineManager() { ! return null; } --- 38,42 ---- */ public static VirtualMachineManager virtualMachineManager() { ! return new VirtualMachineManagerImpl(); } *************** *** 43,46 **** --- 45,51 ---- /* * $Log$ + * Revision 1.3 2001/08/22 13:16:59 stolis + * Bootstrap now points to the implementation of the VirtualMachineManager. + * * Revision 1.2 2001/07/07 22:20:54 stolis * Small change in documentation. |
From: Marek P. <ma...@us...> - 2001-08-12 07:35:35
|
Update of /cvsroot/javaprofiler/library/src/setup In directory usw-pr-cvs1:/tmp/cvs-serv724/src/setup Modified Files: setup.cpp setup.h Log Message: changes in library setups; now, library can run in server or client mode (java part not implemented yet) Index: setup.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/setup/setup.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** setup.cpp 2001/08/09 23:22:55 1.3 --- setup.cpp 2001/08/12 07:35:31 1.4 *************** *** 174,180 **** } ! if( !strcmp( name, "commun_shmem_str")) { ! com.shmemStr = value; return; } --- 174,180 ---- } ! if( !strcmp( name, "commun_shmem_id")) { ! com.shmemId = value; return; } *************** *** 182,187 **** if( !strcmp( name, "connect_mode")) { ! if( !strcmp( value, "normal")) com.listenMode = 0; ! else if( !strcmp( value, "listen")) com.listenMode = 1; return; --- 182,187 ---- if( !strcmp( name, "connect_mode")) { ! if( !strcmp( value, "server")) com.connectMode = 0; ! else if( !strcmp( value, "client")) com.connectMode = 1; return; Index: setup.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/setup/setup.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** setup.h 2001/08/09 23:22:55 1.4 --- setup.h 2001/08/12 07:35:31 1.5 *************** *** 65,72 **** IProf::eCommunType communType; ! /// listening connector mode (1 = on, 0 = off) ! int listenMode; ! /// hostname (if sockets used and connect_mode set to "listen") String hostname; --- 65,72 ---- IProf::eCommunType communType; ! /// connect mode (0 = server, 1 = client) ! int connectMode; ! /// hostname (if sockets used and connect_mode set to "client") String hostname; *************** *** 83,94 **** Com() : ! communType( IProf::COMMUN_SOCKET), ! listenMode( 0), hostname( "127.0.0.1"), port( IProf::COMMUN_PORT), ! shmemSize( IProf::COMMUN_SHMEM_SIZE), ! shmemId( "com") {}; --- 83,94 ---- Com() : ! communType( IProf::COMMUN_SHMEM), ! connectMode( 0), hostname( "127.0.0.1"), port( IProf::COMMUN_PORT), ! shmemSize( IProf::COMMUN_SHMEM_SIZE), ! shmemId( "com") // don't change, used in Java IProf, too {}; |
From: Marek P. <ma...@us...> - 2001-08-12 07:35:35
|
Update of /cvsroot/javaprofiler/library/src2 In directory usw-pr-cvs1:/tmp/cvs-serv724/src2 Modified Files: CommunShMem.java CommunSocket.java IProf.java Added Files: CommunSetup.java CommunSetupShMem.java CommunSetupSocket.java Log Message: changes in library setups; now, library can run in server or client mode (java part not implemented yet) --- NEW FILE: CommunSetup.java --- public abstract class CommunSetup { public static final int COMMUN_SOCKET = 0; public static final int COMMUN_SHMEM = 1; public int communType; public CommunSetup() { this( COMMUN_SOCKET); } public CommunSetup( int communType) { this.communType = communType; } }; --- NEW FILE: CommunSetupShMem.java --- public class CommunSetupShMem extends CommunSetup { public String shmemId = new String( "com"); public int shmemSize = 256*1024; public CommunSetupShMem() { super( COMMUN_SHMEM); } public CommunSetupShMem( String shmemId, int shmemSize) { super( COMMUN_SHMEM); this.shmemId = new String( shmemId); this.shmemSize = shmemSize; } }; --- NEW FILE: CommunSetupSocket.java --- public class CommunSetupSocket extends CommunSetup { public static final int SERVER_MODE = 0; public static final int CLIENT_MODE = 1; public int connectMode = SERVER_MODE; public String hostname = new String( "127.0.0.1"); public int port = 25595; public CommunSetupSocket() { super( COMMUN_SOCKET); } public CommunSetupSocket( int connectMode, String hostname, int port) { super( COMMUN_SOCKET); this.connectMode = connectMode; this.hostname = new String( hostname); this.port = port; } }; Index: CommunShMem.java =================================================================== RCS file: /cvsroot/javaprofiler/library/src2/CommunShMem.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** CommunShMem.java 2001/08/09 23:22:55 1.1 --- CommunShMem.java 2001/08/12 07:35:31 1.2 *************** *** 1,4 **** --- 1,18 ---- public class CommunShMem implements Commun { + private String shmemId; + + private int shmemSize; + + + private long data = 0; + + + public CommunShMem( String shmemId, int shmemSize) { + + this.shmemId = new String( shmemId); + this.shmemSize = shmemSize; + } + public native boolean initialize(); Index: CommunSocket.java =================================================================== RCS file: /cvsroot/javaprofiler/library/src2/CommunSocket.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** CommunSocket.java 2001/08/09 23:22:55 1.2 --- CommunSocket.java 2001/08/12 07:35:31 1.3 *************** *** 5,11 **** --- 5,14 ---- public class CommunSocket implements Commun { + private int _connectMode; + private String _host; private int _port; + private boolean _failed = false; *************** *** 20,27 **** ! public CommunSocket( String host, int port) { ! _host = new String( host); ! _port = port; } --- 23,31 ---- ! public CommunSocket( int connectMode, String host, int port) { ! _connectMode = _connectMode; ! _host = new String( host); ! _port = port; } *************** *** 30,33 **** --- 34,42 ---- try { + if( _connectMode == 0) { // server + + // not implemented yet + } + _sock = new Socket( _host, _port); *************** *** 97,100 **** --- 106,115 ---- try { + + if( _connectMode == 0) { // server + + // not implemented yet + } + _in .close(); _out.close(); Index: IProf.java =================================================================== RCS file: /cvsroot/javaprofiler/library/src2/IProf.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** IProf.java 2001/08/09 23:22:55 1.2 --- IProf.java 2001/08/12 07:35:31 1.3 *************** *** 2,26 **** public class IProf { - - private static final int DEFAULT_PORT = 25595; ! public IProf( String hostname) { ! ! this( hostname, DEFAULT_PORT); } - public IProf( int port) { - - this( "127.0.0.1", port); - } - private Commun _commun; - - public IProf( String hostname, int port) { ! _commun = new CommunSocket( hostname, port); } --- 2,27 ---- public class IProf { + public IProf() { ! this( new CommunSetupShMem()); } private Commun _commun; ! public IProf( CommunSetup setup) { ! ! if( setup.communType == CommunSetup.COMMUN_SOCKET) { ! ! CommunSetupSocket s = (CommunSetupSocket)setup; ! _commun = new CommunSocket( s.connectMode, s.hostname, s.port); ! } ! else { ! ! CommunSetupShMem s = (CommunSetupShMem)setup; ! _commun = new CommunShMem( s.shmemId, s.shmemSize); ! } } *************** *** 43,47 **** } catch( Exception e) { ! _timer.cancel(); } --- 44,48 ---- } catch( Exception e) { ! _timer.cancel(); } |