Update of /cvsroot/javaprofiler/library/src/alloc In directory usw-pr-cvs1:/tmp/cvs-serv12170/src/alloc Modified Files: Makefile.rules allocAbstractStatThreadObject.h allocArena.cpp allocArena.h allocGlobalRef.cpp allocGlobalRef.h allocInstance.cpp allocInstance.h allocObject.cpp allocObject.h allocObjectMethod.cpp allocObjectMethod.h allocObjectTrace.cpp allocObjectTrace.h allocStatData.cpp allocStatData.h allocThreadMethod.cpp allocThreadMethod.h allocThreadObject.cpp allocThreadObject.h allocThreadObjectMethod.cpp allocThreadObjectMethod.h allocThreadObjectTrace.cpp allocThreadObjectTrace.h allocThreadTrace.cpp allocThreadTrace.h allocTrace.cpp allocTrace.h dir.info Added Files: allocAbstractStatThreadObject.cpp allocObjectKey.h allocObjectMethodKey.h allocObjectTraceKey.h allocThreadMethodKey.h allocThreadObjectKey.h allocThreadObjectMethodKey.h allocThreadObjectTraceKey.h allocThreadTraceKey.h Log Message: some parts completely rewritten; changes in communication interface to make it faster; ported to linux --- NEW FILE: allocAbstractStatThreadObject.cpp --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"); you may not use this file except * in compliance with the License. A copy of the License is available * at http://www.sun.com/ * * The Original Code is the Java Profiler module. The Initial Developers * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. * * Portions created by Jan Stola are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Pavel Vacha are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Michal Pise are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Petr Luner are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Lukas Petru are Copyright (C) 2000-2001. * All Rights Reserved. * * Portions created by Marek Przeczek are Copyright (C) 2000-2001. * All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ #include "../alloc/allocAbstractStatThreadObject.h" void AllocAbstractStatThreadObject::addMemoryStat( jint size) { if( !_flagModified) AllocStatData::addMemoryStat( size); _flagModified = 1; } void AllocAbstractStatThreadObject::subMemoryStat( jint size) { if( !_flagModified) AllocStatData::subMemoryStat( size); _flagModified = 1; } Index: Makefile.rules =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/Makefile.rules,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** Makefile.rules 2001/07/28 04:11:17 1.4 --- Makefile.rules 2001/11/21 22:31:41 1.5 *************** *** 1,51 **** allocObjectMethod.o \ ! allocObjectMethod.obj: allocObjectMethod.cpp ../main/includes.h $(CCC) $(CPPFLAGS) allocObjectMethod.cpp allocThreadObjectTrace.o \ ! allocThreadObjectTrace.obj: allocThreadObjectTrace.cpp ../main/includes.h $(CCC) $(CPPFLAGS) allocThreadObjectTrace.cpp allocThreadTrace.o \ ! allocThreadTrace.obj: allocThreadTrace.cpp ../main/includes.h $(CCC) $(CPPFLAGS) allocThreadTrace.cpp allocStatData.o \ ! allocStatData.obj: allocStatData.cpp ../main/includes.h $(CCC) $(CPPFLAGS) allocStatData.cpp allocObjectTrace.o \ ! allocObjectTrace.obj: allocObjectTrace.cpp ../main/includes.h $(CCC) $(CPPFLAGS) allocObjectTrace.cpp allocThreadMethod.o \ ! allocThreadMethod.obj: allocThreadMethod.cpp ../main/includes.h $(CCC) $(CPPFLAGS) allocThreadMethod.cpp allocThreadObject.o \ ! allocThreadObject.obj: allocThreadObject.cpp ../main/includes.h $(CCC) $(CPPFLAGS) allocThreadObject.cpp allocObject.o \ ! allocObject.obj: allocObject.cpp ../main/includes.h $(CCC) $(CPPFLAGS) allocObject.cpp allocThreadObjectMethod.o \ ! allocThreadObjectMethod.obj: allocThreadObjectMethod.cpp ../main/includes.h $(CCC) $(CPPFLAGS) allocThreadObjectMethod.cpp allocTrace.o \ ! allocTrace.obj: allocTrace.cpp ../main/includes.h $(CCC) $(CPPFLAGS) allocTrace.cpp allocArena.o \ ! allocArena.obj: allocArena.cpp ../main/includes.h $(CCC) $(CPPFLAGS) allocArena.cpp allocGlobalRef.o \ ! allocGlobalRef.obj: $(CCC) $(CPPFLAGS) allocGlobalRef.cpp allocInstance.o \ ! allocInstance.obj: $(CCC) $(CPPFLAGS) allocInstance.cpp --- 1,55 ---- allocObjectMethod.o \ ! allocObjectMethod.obj: allocObjectMethod.cpp $(CCC) $(CPPFLAGS) allocObjectMethod.cpp allocThreadObjectTrace.o \ ! allocThreadObjectTrace.obj: allocThreadObjectTrace.cpp $(CCC) $(CPPFLAGS) allocThreadObjectTrace.cpp allocThreadTrace.o \ ! allocThreadTrace.obj: allocThreadTrace.cpp $(CCC) $(CPPFLAGS) allocThreadTrace.cpp allocStatData.o \ ! allocStatData.obj: allocStatData.cpp $(CCC) $(CPPFLAGS) allocStatData.cpp allocObjectTrace.o \ ! allocObjectTrace.obj: allocObjectTrace.cpp $(CCC) $(CPPFLAGS) allocObjectTrace.cpp allocThreadMethod.o \ ! allocThreadMethod.obj: allocThreadMethod.cpp $(CCC) $(CPPFLAGS) allocThreadMethod.cpp allocThreadObject.o \ ! allocThreadObject.obj: allocThreadObject.cpp $(CCC) $(CPPFLAGS) allocThreadObject.cpp allocObject.o \ ! allocObject.obj: allocObject.cpp $(CCC) $(CPPFLAGS) allocObject.cpp allocThreadObjectMethod.o \ ! allocThreadObjectMethod.obj: allocThreadObjectMethod.cpp $(CCC) $(CPPFLAGS) allocThreadObjectMethod.cpp allocTrace.o \ ! allocTrace.obj: allocTrace.cpp $(CCC) $(CPPFLAGS) allocTrace.cpp allocArena.o \ ! allocArena.obj: allocArena.cpp $(CCC) $(CPPFLAGS) allocArena.cpp allocGlobalRef.o \ ! allocGlobalRef.obj: allocGlobalRef.cpp $(CCC) $(CPPFLAGS) allocGlobalRef.cpp allocInstance.o \ ! allocInstance.obj: allocInstance.cpp $(CCC) $(CPPFLAGS) allocInstance.cpp + + allocAbstractStatThreadObject.o \ + allocAbstractStatThreadObject.obj: allocAbstractStatThreadObject.cpp + $(CCC) $(CPPFLAGS) allocAbstractStatThreadObject.cpp Index: allocAbstractStatThreadObject.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocAbstractStatThreadObject.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** allocAbstractStatThreadObject.h 2001/09/02 20:14:21 1.9 --- allocAbstractStatThreadObject.h 2001/11/21 22:31:41 1.10 *************** *** 36,39 **** --- 36,42 ---- #define _ALLOC_ABSTRACT_STAT_THREAD_OBJECT_H_ + #include "../main/includes.h" + #include "../alloc/allocStatData.h" + /** An abstract statistic class. This class is an ancestor ** of AllocThreadObject, AllocThreadObjectMethod and AllocThreadObjectTrace *************** *** 58,63 **** _flagModified( 0) ! {}; /** Addition of the object's size to statistics. --- 61,69 ---- _flagModified( 0) + + {} ! /// Destructor. ! virtual ~AllocAbstractStatThreadObject() {} /** Addition of the object's size to statistics. *************** *** 68,77 **** ** ** @see subMemoryStat() */ - - virtual void addMemoryStat( jint size) { ! if( !_flagModified) AllocStatData::addMemoryStat( size); ! _flagModified = 1; ! } /** Subtraction of the object's size from statistics. --- 74,79 ---- ** ** @see subMemoryStat() */ ! virtual void addMemoryStat( jint size); /** Subtraction of the object's size from statistics. *************** *** 83,91 **** ** @see addMemoryStat() */ ! virtual void subMemoryStat( jint size) { ! ! if( !_flagModified) AllocStatData::subMemoryStat( size); ! _flagModified = 1; ! } /** Clearing of flag. This method sets --- 85,89 ---- ** @see addMemoryStat() */ ! virtual void subMemoryStat( jint size); /** Clearing of flag. This method sets *************** *** 103,105 **** #endif // _ALLOC_ABSTRACT_STAT_THREAD_OBJECT_H_ - --- 101,102 ---- Index: allocArena.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocArena.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** allocArena.cpp 2001/09/02 20:14:21 1.2 --- allocArena.cpp 2001/11/21 22:31:41 1.3 *************** *** 33,37 **** */ ! #include "../main/includes.h" ! Allocator AllocArena::_allocator( sizeof( AllocArena)); --- 33,46 ---- */ ! #include "../alloc/allocArena.h" ! #ifdef USE_ALLOCATOR ! Allocator AllocArena::_allocator; ! #endif ! ! Buffer& AllocArena::infoToBin( Buffer& b) { ! ! b += arenaName; ! ! return b; ! } Index: allocArena.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocArena.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** allocArena.h 2001/09/02 20:14:21 1.13 --- allocArena.h 2001/11/21 22:31:41 1.14 *************** *** 36,39 **** --- 36,49 ---- #define _ALLOC_ARENA_H_ + #include "../main/includes.h" + #include "../list/listItem.h" + #include "../commun2/idObject.h" + #include "../commun/binaryFormat.h" + #include "../string/string.h" + #include "../list/list.h" + #include "../alloc/allocInstance.h" + #include "../commun/buffer.h" + #include "../allocator/allocator.h" + /** Arena. This class consists of arena data acquired ** by receiving the JVMPI_EVENT_ARENA_NEW event. *************** *** 45,50 **** ** @author Marek Przeczek */ ! class AllocArena: public LI1, public IdObject, ! public InfoBinaryFormat { public: --- 55,61 ---- ** @author Marek Przeczek */ ! class AllocArena: public LI1, ! public IdObject, ! public InfoBinaryFormat { public: *************** *** 68,73 **** arenaId( 0), active( 1) ! {}; /** Convert info to binary. This method converts information --- 79,87 ---- arenaId( 0), active( 1) + + {} ! /// Destructor. ! virtual ~AllocArena() {} /** Convert info to binary. This method converts information *************** *** 78,89 **** ** ** @return reference to same Buffer object as argument 'b' */ - - virtual Buffer& infoToBin( Buffer& b) { - - b += arenaName; ! return b; ! } private: --- 92,99 ---- ** ** @return reference to same Buffer object as argument 'b' */ ! virtual Buffer& infoToBin( Buffer& b); + #ifdef USE_ALLOCATOR private: *************** *** 95,103 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} public: --- 105,114 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif public: *************** *** 105,109 **** /** Class identification. ** ! ** @return unique class type identified */ virtual eClassIdent getClassIdent() { return ALLOC_ARENA;} --- 116,120 ---- /** Class identification. ** ! ** @return unique class type identifier */ virtual eClassIdent getClassIdent() { return ALLOC_ARENA;} Index: allocGlobalRef.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocGlobalRef.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** allocGlobalRef.cpp 2001/09/02 20:14:21 1.2 --- allocGlobalRef.cpp 2001/11/21 22:31:41 1.3 *************** *** 33,37 **** */ ! #include "../main/includes.h" ! Allocator AllocGlobalRef::_allocator( sizeof( AllocGlobalRef)); --- 33,39 ---- */ ! #include "../alloc/allocGlobalRef.h" ! #ifdef USE_ALLOCATOR ! Allocator AllocGlobalRef::_allocator; ! #endif Index: allocGlobalRef.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocGlobalRef.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** allocGlobalRef.h 2001/09/02 20:14:21 1.6 --- allocGlobalRef.h 2001/11/21 22:31:41 1.7 *************** *** 36,39 **** --- 36,43 ---- #define _ALLOC_GLOBAL_REF_H_ + #include "../main/includes.h" + #include "../list/listItem.h" + #include "../allocator/allocator.h" + /** JNI global reference. This class consists of data ** about JNI global reference acquired by receiving *************** *** 59,80 **** instance( NULL), refId( 0) ! {}; /** Retrieves object's key. ** ! ** @param key where to store the key ** @return key ** ** @see Hash */ ! const jobject& getKey(jobject& key) { ! ! return key = refId; ! } /** Compares object with given key. ** ** @param key key ** @return 1 (true); ** 0 (false) --- 63,86 ---- instance( NULL), refId( 0) + + {} ! /// Destructor. ! virtual ~AllocGlobalRef() {} /** Retrieves object's key. ** ! ** @param key where to store the key ! ** ** @return key ** ** @see Hash */ ! const jobject& getKey(jobject& key) { return key = refId;} /** Compares object with given key. ** ** @param key key + ** ** @return 1 (true); ** 0 (false) *************** *** 82,100 **** ** @see Hash */ ! int operator==(const jobject& key) { ! ! return (refId == key); ! } /** Hash function. ** ! ** @param reference to a key ** @return hash value */ - - static int hashKey(const jobject& key) { ! return (int)key; ! } private: --- 88,102 ---- ** @see Hash */ ! int operator==(const jobject& key) { return (refId == key);} /** Hash function. ** ! ** @param key reference to a key ! ** ** @return hash value */ ! static int hashKey(const jobject& key) { return (int)key;} + #ifdef USE_ALLOCATOR private: *************** *** 106,114 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} }; --- 108,117 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif }; Index: allocInstance.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocInstance.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** allocInstance.cpp 2001/09/02 20:14:21 1.2 --- allocInstance.cpp 2001/11/21 22:31:41 1.3 *************** *** 33,37 **** */ ! #include "../main/includes.h" ! Allocator AllocInstance::_allocator( sizeof( AllocInstance)); --- 33,39 ---- */ ! #include "../alloc/allocInstance.h" ! #ifdef USE_ALLOCATOR ! Allocator AllocInstance::_allocator; ! #endif Index: allocInstance.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocInstance.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** allocInstance.h 2001/09/02 20:14:21 1.12 --- allocInstance.h 2001/11/21 22:31:41 1.13 *************** *** 36,39 **** --- 36,43 ---- #define _ALLOC_INSTANCE_H_ + #include "../main/includes.h" + #include "../list/listItem.h" + #include "../allocator/allocator.h" + /** Instance. This class consists of data gained ** by receiving the JVMPI_EVENT_OBJECT_ALLOC event. *************** *** 48,52 **** ** @author Marek Przeczek, Petr Luner */ ! class AllocInstance: public LI1, public LI2 { public: --- 52,57 ---- ** @author Marek Przeczek, Petr Luner */ ! class AllocInstance: public LI1, ! public LI2 { public: *************** *** 74,95 **** arena( NULL), objectMethodTraceThread( NULL) ! {}; /** Retrieves object's key. ** ! ** @param key where to store the key ** @return key ** ** @see Hash */ ! const jobjectID& getKey(jobjectID& key) { ! ! return key = objId; ! } /** Compares object with given key. ** ** @param key key ** @return 1 (true); ** 0 (false) --- 79,102 ---- arena( NULL), objectMethodTraceThread( NULL) + + {} ! /// Destructor. ! virtual ~AllocInstance() {} /** Retrieves object's key. ** ! ** @param key where to store the key ! ** ** @return key ** ** @see Hash */ ! const jobjectID& getKey(jobjectID& key) { return key = objId;} /** Compares object with given key. ** ** @param key key + ** ** @return 1 (true); ** 0 (false) *************** *** 97,115 **** ** @see Hash */ ! int operator==(const jobjectID& key) { ! ! return (objId == key); ! } /** Hash function. ** ! ** @param reference to a key ** @return hash value */ - - static int hashKey(const jobjectID& key) { ! return (int)key; ! } private: --- 104,118 ---- ** @see Hash */ ! int operator==(const jobjectID& key) { return (objId == key);} /** Hash function. ** ! ** @param key reference to a key ! ** ** @return hash value */ ! static int hashKey(const jobjectID& key) { return (int)key;} + #ifdef USE_ALLOCATOR private: *************** *** 121,129 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} }; --- 124,133 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif }; Index: allocObject.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocObject.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** allocObject.cpp 2001/09/18 22:19:28 1.12 --- allocObject.cpp 2001/11/21 22:31:41 1.13 *************** *** 33,40 **** */ ! #include "../main/includes.h" - Allocator AllocObject::_allocator( sizeof( AllocObject)); - Buffer& AllocObject::infoToBin( Buffer& b) { --- 33,44 ---- */ ! #include "../alloc/allocObject.h" ! #include "../prof/prof.h" ! #include "../alloc/allocObjectMethod.h" ! ! #ifdef USE_ALLOCATOR ! Allocator AllocObject::_allocator; ! #endif Buffer& AllocObject::infoToBin( Buffer& b) { *************** *** 73,75 **** --- 77,109 ---- om = objectMethods.next(om); } + } + + const AllocObjectKey& AllocObject::getKey(AllocObjectKey& key) { + + key.classId = classId; + key.isArray = isArray; + return key; + } + + int AllocObject::operator==(const AllocObjectKey& key) { + + if (isArray != key.isArray) return 0; + if (clss) return *clss == key.classId; + else return classId == key.classId; + } + + int AllocObject::hashKey(const AllocObjectKey& key) { + + return Class::hashKey(key.classId); + } + + int AllocObject::isActive() { + + return (clss) ? clss->active : 1; + } + + void AllocObject::setUnchanged() { + + IdObject::setUnchanged(); + clearDataChanged(); } Index: allocObject.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocObject.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** allocObject.h 2001/09/02 20:14:21 1.18 --- allocObject.h 2001/11/21 22:31:41 1.19 *************** *** 36,52 **** #define _ALLOC_OBJECT_H_ ! /** Key for AllocObject class. ! ** Used for searching in hash tables. ! ** ! ** @author Marek Przeczek, Petr Luner */ ! ! struct AllocObjectKey { ! ! /// class ID ! jobjectID classId; ! ! /// is array? ! jint isArray; ! }; /** Type of Java object. This class consists of data --- 36,50 ---- #define _ALLOC_OBJECT_H_ ! #include "../main/includes.h" ! #include "../list/listItem.h" ! #include "../alloc/allocAbstractStatThreadObject.h" ! #include "../commun2/idObject.h" ! #include "../commun/binaryFormat.h" ! #include "../list/list.h" ! #include "../alloc/allocObjectMethod.h" ! #include "../alloc/allocThreadObject.h" ! #include "../alloc/allocObjectKey.h" ! #include "../commun/buffer.h" ! #include "../allocator/allocator.h" /** Type of Java object. This class consists of data *************** *** 61,67 **** ** @author Marek Przeczek, Petr Luner */ ! class AllocObject: public LI1, public LI2, public AllocAbstractStatThreadObject, ! public IdObject, ! public InfoBinaryFormat { public: --- 59,67 ---- ** @author Marek Przeczek, Petr Luner */ ! class AllocObject: public LI1, ! public LI2, ! public AllocAbstractStatThreadObject, ! public IdObject, ! public InfoBinaryFormat { public: *************** *** 98,118 **** {} /** Retrieves object's key. ** - ** @param key where to store the key ** @return key ** ** @see Hash */ ! const AllocObjectKey& getKey(AllocObjectKey& key) { ! ! key.classId = classId; ! key.isArray = isArray; ! return key; ! } /** Compares object with given key. ** ** @param key key ** @return 1 (true); ** 0 (false) --- 98,118 ---- {} + /// Destructor. + virtual ~AllocObject() {} + /** Retrieves object's key. + ** + ** @param key where to store the key ** ** @return key ** ** @see Hash */ ! const AllocObjectKey& getKey(AllocObjectKey& key); /** Compares object with given key. ** ** @param key key + ** ** @return 1 (true); ** 0 (false) *************** *** 120,139 **** ** @see Hash */ ! int operator==(const AllocObjectKey& key) { - if (isArray != key.isArray) return 0; - if (clss) return *clss == key.classId; - else return classId == key.classId; - } - /** Hash function. ** ! ** @param reference to a key ** @return hash value */ - - static int hashKey(const AllocObjectKey& key) { ! return Class::hashKey(key.classId); ! } /** Convert info to binary. This method converts information --- 120,132 ---- ** @see Hash */ ! int operator==(const AllocObjectKey& key); /** Hash function. ** ! ** @param key reference to a key ! ** ** @return hash value */ ! static int hashKey(const AllocObjectKey& key); /** Convert info to binary. This method converts information *************** *** 151,154 **** --- 144,148 ---- void deactivate(); + #ifdef USE_ALLOCATOR private: *************** *** 160,168 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} public: --- 154,163 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif public: *************** *** 170,174 **** /** Class identification. ** ! ** @return unique class type identified */ virtual eClassIdent getClassIdent() { return ALLOC_OBJECT;} --- 165,169 ---- /** Class identification. ** ! ** @return unique class type identifier */ virtual eClassIdent getClassIdent() { return ALLOC_OBJECT;} *************** *** 180,184 **** ** 1 (active) */ ! virtual int isActive() { return (clss) ? clss->active : 1;} /** Indication that object has changed its data. --- 175,179 ---- ** 1 (active) */ ! virtual int isActive(); /** Indication that object has changed its data. *************** *** 191,199 **** /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged() { ! ! IdObject::setUnchanged(); ! clearDataChanged(); ! } }; --- 186,190 ---- /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged(); }; Index: allocObjectMethod.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocObjectMethod.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** allocObjectMethod.cpp 2001/09/18 22:19:28 1.11 --- allocObjectMethod.cpp 2001/11/21 22:31:41 1.12 *************** *** 33,40 **** */ ! #include "../main/includes.h" - Allocator AllocObjectMethod::_allocator( sizeof( AllocObjectMethod)); - void AllocObjectMethod::addMemoryStat( jint size) { --- 33,45 ---- */ ! #include "../alloc/allocObjectMethod.h" ! #include "../prof/prof.h" ! #include "../alloc/allocObject.h" ! #include "../alloc/allocObjectTrace.h" ! ! #ifdef USE_ALLOCATOR ! Allocator AllocObjectMethod::_allocator; ! #endif void AllocObjectMethod::addMemoryStat( jint size) { *************** *** 75,77 **** --- 80,110 ---- ot = objectTraces.next(ot); } + } + + const AllocObjectMethodKey& AllocObjectMethod::getKey(AllocObjectMethodKey& key) { + + object->getKey(key.objectKey); + method->getKey(key.methodId); + return key; + } + + int AllocObjectMethod::operator==(const AllocObjectMethodKey& key) { + + return (*object == key.objectKey) && (*method == key.methodId); + } + + int AllocObjectMethod::hashKey(const AllocObjectMethodKey& key) { + + return AllocObject::hashKey(key.objectKey) ^ Method::hashKey(key.methodId); + } + + int AllocObjectMethod::isActive() { + + return (method->isActive() && object->isActive()); + } + + void AllocObjectMethod::setUnchanged() { + + IdObject::setUnchanged(); + clearDataChanged(); } Index: allocObjectMethod.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocObjectMethod.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** allocObjectMethod.h 2001/09/02 20:14:21 1.17 --- allocObjectMethod.h 2001/11/21 22:31:41 1.18 *************** *** 36,53 **** #define _ALLOC_OBJECT_METHOD_H_ ! /** Key for AllocObjectMethod class. ! ** Used for searching in hash tables. ! ** ! ** @author Marek Przeczek, Petr Luner */ ! ! struct AllocObjectMethodKey { - /// object key - AllocObjectKey objectKey; - - /// method ID - jmethodID methodId; - }; - /** Crossroad of objects and methods. This class defines ** a relation between an object and a method. Each object can --- 36,49 ---- #define _ALLOC_OBJECT_METHOD_H_ ! #include "../main/includes.h" ! #include "../list/listItem.h" ! #include "../alloc/allocAbstractStatThreadObject.h" ! #include "../commun2/idObject.h" ! #include "../list/list.h" ! #include "../alloc/allocObjectTrace.h" ! #include "../alloc/allocThreadObjectMethod.h" ! #include "../alloc/allocObjectMethodKey.h" ! #include "../allocator/allocator.h" /** Crossroad of objects and methods. This class defines ** a relation between an object and a method. Each object can *************** *** 60,66 **** ** @author Marek Przeczek, Petr Luner */ ! class AllocObjectMethod: public LI1, public LI2, public AllocAbstractStatThreadObject, ! public IdObject, ! public LI3 { public: --- 56,64 ---- ** @author Marek Przeczek, Petr Luner */ ! class AllocObjectMethod: public LI1, ! public LI2, ! public LI3, ! public AllocAbstractStatThreadObject, ! public IdObject { public: *************** *** 87,90 **** --- 85,91 ---- {} + /// Destructor. + virtual ~AllocObjectMethod() {} + /** Addition of the object's size to statistics. ** This method adds size of object to the statistic data. *************** *** 114,132 **** /** Retrieves object's key. ** ! ** @param key where to store the key ** @return key ** ** @see Hash */ - - const AllocObjectMethodKey& getKey(AllocObjectMethodKey& key) { ! object->getKey(key.objectKey); ! method->getKey(key.methodId); ! return key; ! } /** Compares object with given key. ** ** @param key key ** @return 1 (true); ** 0 (false) --- 115,130 ---- /** Retrieves object's key. ** ! ** @param key where to store the key ! ** ** @return key ** ** @see Hash */ ! const AllocObjectMethodKey& getKey(AllocObjectMethodKey& key); /** Compares object with given key. ** ** @param key key + ** ** @return 1 (true); ** 0 (false) *************** *** 134,151 **** ** @see Hash */ ! int operator==(const AllocObjectMethodKey& key) { - return (*object == key.objectKey) && (*method == key.methodId); - } - /** Hash function. ** ! ** @param reference to a key ** @return hash value */ - - static int hashKey(const AllocObjectMethodKey& key) { ! return AllocObject::hashKey(key.objectKey) ^ Method::hashKey(key.methodId); ! } /** Performs deactivation. */ --- 132,144 ---- ** @see Hash */ ! int operator==(const AllocObjectMethodKey& key); /** Hash function. ** ! ** @param key reference to a key ! ** ** @return hash value */ ! static int hashKey(const AllocObjectMethodKey& key); /** Performs deactivation. */ *************** *** 153,156 **** --- 146,150 ---- void deactivate(); + #ifdef USE_ALLOCATOR private: *************** *** 162,170 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} public: --- 156,165 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif public: *************** *** 172,176 **** /** Class identification. ** ! ** @return unique class type identified */ virtual eClassIdent getClassIdent() { return ALLOC_OBJECT_METHOD;} --- 167,171 ---- /** Class identification. ** ! ** @return unique class type identifier */ virtual eClassIdent getClassIdent() { return ALLOC_OBJECT_METHOD;} *************** *** 182,186 **** ** 1 (active) */ ! virtual int isActive() { return (method->isActive() && object->isActive());} /** Indication that object has changed its data. --- 177,181 ---- ** 1 (active) */ ! virtual int isActive(); /** Indication that object has changed its data. *************** *** 193,201 **** /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged() { ! ! IdObject::setUnchanged(); ! clearDataChanged(); ! } }; --- 188,192 ---- /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged(); }; Index: allocObjectTrace.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocObjectTrace.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** allocObjectTrace.cpp 2001/09/18 22:19:28 1.11 --- allocObjectTrace.cpp 2001/11/21 22:31:41 1.12 *************** *** 33,44 **** */ ! #include "../main/includes.h" - Allocator AllocObjectTrace::_allocator( sizeof( AllocObjectTrace)); - void AllocObjectTrace::addMemoryStat( jint size) { if( !modified()) { ! AllocAbstractStatThreadObject::addMemoryStat( size); --- 33,50 ---- */ ! #include "../alloc/allocObjectTrace.h" ! #include "../prof/prof.h" ! #include "../alloc/allocTrace.h" ! #include "../alloc/allocObjectMethod.h" ! #include "../alloc/allocObject.h" ! ! #ifdef USE_ALLOCATOR ! Allocator AllocObjectTrace::_allocator; ! #endif void AllocObjectTrace::addMemoryStat( jint size) { if( !modified()) { ! AllocAbstractStatThreadObject::addMemoryStat( size); *************** *** 71,72 **** --- 77,105 ---- } + const AllocObjectTraceKey& AllocObjectTrace::getKey(AllocObjectTraceKey& key) { + + objectMethod->object->getKey(key.objectKey); + trace->getKey(key.traceKey); + return key; + } + + int AllocObjectTrace::operator==(const AllocObjectTraceKey& key) { + + return (*objectMethod->object == key.objectKey) && (*trace == key.traceKey); + } + + int AllocObjectTrace::hashKey(const AllocObjectTraceKey& key) { + + return AllocObject::hashKey(key.objectKey) ^ Trace::hashKey(key.traceKey); + } + + int AllocObjectTrace::isActive() { + + return (trace->isActive() && objectMethod->isActive()); + } + + void AllocObjectTrace::setUnchanged() { + + IdObject::setUnchanged(); + clearDataChanged(); + } Index: allocObjectTrace.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocObjectTrace.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** allocObjectTrace.h 2001/09/02 20:14:21 1.17 --- allocObjectTrace.h 2001/11/21 22:31:41 1.18 *************** *** 36,54 **** #define _ALLOC_OBJECT_TRACE_H_ ! /** Key for AllocObjectTrace class. ! ** Key used for searching in hash tables. ! ** ! ** @author Marek Przeczek, Petr Luner */ ! ! struct AllocObjectTraceKey { ! ! /// object key ! AllocObjectKey objectKey; - /// trace key - TraceKey traceKey; - }; - - /** Crossroad of traces and objects-methods. This class defines ** a relation between traces (specify where an object was allocated) and --- 36,48 ---- #define _ALLOC_OBJECT_TRACE_H_ ! #include "../main/includes.h" ! #include "../list/listItem.h" ! #include "../alloc/allocAbstractStatThreadObject.h" ! #include "../commun2/idObject.h" ! #include "../list/list.h" ! #include "../alloc/allocThreadObjectTrace.h" ! #include "../alloc/allocObjectTraceKey.h" ! #include "../allocator/allocator.h" /** Crossroad of traces and objects-methods. This class defines ** a relation between traces (specify where an object was allocated) and *************** *** 70,76 **** ** @author Marek Przeczek, Petr Luner */ ! class AllocObjectTrace: public LI1, public LI2, public AllocAbstractStatThreadObject, ! public IdObject, ! public LI3 { public: --- 64,72 ---- ** @author Marek Przeczek, Petr Luner */ ! class AllocObjectTrace: public LI1, ! public LI2, ! public LI3, ! public AllocAbstractStatThreadObject, ! public IdObject { public: *************** *** 94,97 **** --- 90,96 ---- {} + /// Destructor. + virtual ~AllocObjectTrace() {} + /** Addition of the object's size to statistics. ** This method adds size of object to the statistic data. *************** *** 121,139 **** /** Retrieves object's key. ** ! ** @param key where to store the key ** @return key ** ** @see Hash */ - - const AllocObjectTraceKey& getKey(AllocObjectTraceKey& key) { ! objectMethod->object->getKey(key.objectKey); ! trace->getKey(key.traceKey); ! return key; ! } /** Compares object with given key. ** ** @param key key ** @return 1 (true); ** 0 (false) --- 120,135 ---- /** Retrieves object's key. ** ! ** @param key where to store the key ! ** ** @return key ** ** @see Hash */ ! const AllocObjectTraceKey& getKey(AllocObjectTraceKey& key); /** Compares object with given key. ** ** @param key key + ** ** @return 1 (true); ** 0 (false) *************** *** 141,158 **** ** @see Hash */ ! int operator==(const AllocObjectTraceKey& key) { - return (*objectMethod->object == key.objectKey) && (*trace == key.traceKey); - } - /** Hash function. ** ! ** @param reference to a key ** @return hash value */ - - static int hashKey(const AllocObjectTraceKey& key) { ! return AllocObject::hashKey(key.objectKey) ^ Trace::hashKey(key.traceKey); ! } /** Performs deactivation. */ --- 137,149 ---- ** @see Hash */ ! int operator==(const AllocObjectTraceKey& key); /** Hash function. ** ! ** @param key reference to a key ! ** ** @return hash value */ ! static int hashKey(const AllocObjectTraceKey& key); /** Performs deactivation. */ *************** *** 160,163 **** --- 151,155 ---- void deactivate(); + #ifdef USE_ALLOCATOR private: *************** *** 169,177 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} public: --- 161,170 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif public: *************** *** 179,183 **** /** Class identification. ** ! ** @return unique class type identified */ virtual eClassIdent getClassIdent() { return ALLOC_OBJECT_TRACE;} --- 172,176 ---- /** Class identification. ** ! ** @return unique class type identifier */ virtual eClassIdent getClassIdent() { return ALLOC_OBJECT_TRACE;} *************** *** 189,193 **** ** 1 (active) */ ! virtual int isActive() { return (trace->isActive() && objectMethod->isActive());} /** Indication that object has changed its data. --- 182,186 ---- ** 1 (active) */ ! virtual int isActive(); /** Indication that object has changed its data. *************** *** 200,208 **** /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged() { ! ! IdObject::setUnchanged(); ! clearDataChanged(); ! } }; --- 193,197 ---- /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged(); }; Index: allocStatData.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocStatData.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** allocStatData.cpp 2001/09/02 20:14:21 1.6 --- allocStatData.cpp 2001/11/21 22:31:41 1.7 *************** *** 33,37 **** */ ! #include "../main/includes.h" void AllocStatData::addMemoryStat( jint size) { --- 33,37 ---- */ ! #include "../alloc/allocStatData.h" void AllocStatData::addMemoryStat( jint size) { Index: allocStatData.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocStatData.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** allocStatData.h 2001/09/02 20:14:21 1.8 --- allocStatData.h 2001/11/21 22:31:41 1.9 *************** *** 36,39 **** --- 36,44 ---- #define _ALLOC_STAT_DATA_H_ + #include "../main/includes.h" + #include "../commun/binaryFormat.h" + #include "../commun/statDataModification.h" + #include "../commun/buffer.h" + /** Statistic data for memory profiling. This class is a base class ** for other classes used in memory profiling; it consists *************** *** 43,47 **** class AllocStatData: public DataBinaryFormat, ! public StatDataModification { public: --- 48,52 ---- class AllocStatData: public DataBinaryFormat, ! public StatDataModification { public: *************** *** 75,80 **** allocSizeInstancesLive( 0), allocSizeInstancesTotal( 0) ! {}; /** Addition of the object's size to statistics. --- 80,88 ---- allocSizeInstancesLive( 0), allocSizeInstancesTotal( 0) + + {} ! /// Destructor. ! virtual ~AllocStatData() {} /** Addition of the object's size to statistics. *************** *** 116,118 **** #endif // _ALLOC_STAT_DATA_H_ - --- 124,125 ---- Index: allocThreadMethod.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocThreadMethod.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** allocThreadMethod.cpp 2001/09/18 22:19:28 1.9 --- allocThreadMethod.cpp 2001/11/21 22:31:41 1.10 *************** *** 33,43 **** */ ! #include "../main/includes.h" ! Allocator AllocThreadMethod::_allocator( sizeof( AllocThreadMethod)); void AllocThreadMethod::deactivate() { ! Prof::prof().activeAllocThreadMethods.removeNoRehash(this); AllocThreadTrace* tt = threadTraces.first(); --- 33,47 ---- */ ! #include "../alloc/allocThreadMethod.h" ! #include "../prof/prof.h" ! #include "../alloc/allocThreadTrace.h" ! #ifdef USE_ALLOCATOR ! Allocator AllocThreadMethod::_allocator; ! #endif void AllocThreadMethod::deactivate() { ! Prof::prof().activeAllocThreadMethods.removeNoRehash(this); AllocThreadTrace* tt = threadTraces.first(); *************** *** 46,48 **** --- 50,80 ---- tt = threadTraces.next(tt); } + } + + const AllocThreadMethodKey& AllocThreadMethod::getKey(AllocThreadMethodKey& key) { + + thread->getKey(key.envId); + method->getKey(key.methodId); + return key; + } + + int AllocThreadMethod::operator==(const AllocThreadMethodKey& key) { + + return (*thread == key.envId) && (*method == key.methodId); + } + + int AllocThreadMethod::hashKey(const AllocThreadMethodKey& key) { + + return Thread::hashKey(key.envId) ^ Method::hashKey(key.methodId); + } + + int AllocThreadMethod::isActive() { + + return (thread->isActive() && method->isActive()); + } + + void AllocThreadMethod::setUnchanged() { + + IdObject::setUnchanged(); + clearDataChanged(); } Index: allocThreadMethod.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocThreadMethod.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** allocThreadMethod.h 2001/09/02 20:14:21 1.15 --- allocThreadMethod.h 2001/11/21 22:31:41 1.16 *************** *** 36,53 **** #define _ALLOC_THREAD_METHOD_H_ ! /** Key for AllocThreadMethod class. ! ** Used for searching in hash tables. ! ** ! ** @author Marek Przeczek, Petr Luner */ ! ! struct AllocThreadMethodKey { - /// thread ID - JNIEnv* envId; - - /// method ID - jmethodID methodId; - }; - /** Crossroad of threads and methods. This class consists ** of statistic information about method while running in the thread. --- 36,49 ---- #define _ALLOC_THREAD_METHOD_H_ ! #include "../main/includes.h" ! #include "../list/listItem.h" ! #include "../alloc/allocStatData.h" ! #include "../commun2/idObject.h" ! #include "../list/list.h" ! #include "../alloc/allocThreadObjectMethod.h" ! #include "../alloc/allocThreadTrace.h" ! #include "../alloc/allocThreadMethodKey.h" ! #include "../allocator/allocator.h" /** Crossroad of threads and methods. This class consists ** of statistic information about method while running in the thread. *************** *** 60,65 **** ** @author Marek Przeczek, Petr Luner */ ! class AllocThreadMethod: public LI1, public AllocStatData, ! public IdObject, public LI2, public LI3 { public: --- 56,64 ---- ** @author Marek Przeczek, Petr Luner */ ! class AllocThreadMethod: public LI1, ! public LI2, ! public LI3, ! public AllocStatData, ! public IdObject { public: *************** *** 86,106 **** {} /** Retrieves object's key. ** ! ** @param key where to store the key ** @return key ** ** @see Hash */ ! const AllocThreadMethodKey& getKey(AllocThreadMethodKey& key) { ! ! thread->getKey(key.envId); ! method->getKey(key.methodId); ! return key; ! } /** Compares object with given key. ** ** @param key key ** @return 1 (true); ** 0 (false) --- 85,105 ---- {} + /// Destructor. + virtual ~AllocThreadMethod() {} + /** Retrieves object's key. ** ! ** @param key where to store the key ! ** ** @return key ** ** @see Hash */ ! const AllocThreadMethodKey& getKey(AllocThreadMethodKey& key); /** Compares object with given key. ** ** @param key key + ** ** @return 1 (true); ** 0 (false) *************** *** 108,125 **** ** @see Hash */ ! int operator==(const AllocThreadMethodKey& key) { ! ! return (*thread == key.envId) && (*method == key.methodId); ! } /** Hash function. ** ! ** @param reference to a key ** @return hash value */ - - static int hashKey(const AllocThreadMethodKey& key) { ! return Thread::hashKey(key.envId) ^ Method::hashKey(key.methodId); ! } /** Performs deactivation. */ --- 107,119 ---- ** @see Hash */ ! int operator==(const AllocThreadMethodKey& key); /** Hash function. ** ! ** @param key reference to a key ! ** ** @return hash value */ ! static int hashKey(const AllocThreadMethodKey& key); /** Performs deactivation. */ *************** *** 127,130 **** --- 121,125 ---- void deactivate(); + #ifdef USE_ALLOCATOR private: *************** *** 136,144 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} public: --- 131,140 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif public: *************** *** 146,150 **** /** Class identification. ** ! ** @return unique class type identified */ virtual eClassIdent getClassIdent() { return ALLOC_THREAD_METHOD;} --- 142,146 ---- /** Class identification. ** ! ** @return unique class type identifier */ virtual eClassIdent getClassIdent() { return ALLOC_THREAD_METHOD;} *************** *** 156,160 **** ** 1 (active) */ ! virtual int isActive() { return (thread->isActive() && method->isActive());} /** Indication that object has changed its data. --- 152,156 ---- ** 1 (active) */ ! virtual int isActive(); /** Indication that object has changed its data. *************** *** 167,175 **** /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged() { ! ! IdObject::setUnchanged(); ! clearDataChanged(); ! } }; --- 163,167 ---- /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged(); }; Index: allocThreadObject.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocThreadObject.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** allocThreadObject.cpp 2001/09/18 22:19:28 1.13 --- allocThreadObject.cpp 2001/11/21 22:31:41 1.14 *************** *** 33,40 **** */ ! #include "../main/includes.h" - Allocator AllocThreadObject::_allocator( sizeof( AllocThreadObject)); - void AllocThreadObject::addMemoryStat( jint size) { --- 33,45 ---- */ ! #include "../alloc/allocThreadObject.h" ! #include "../prof/prof.h" ! #include "../alloc/allocObject.h" ! #include "../alloc/allocThreadObjectMethod.h" ! ! #ifdef USE_ALLOCATOR ! Allocator AllocThreadObject::_allocator; ! #endif void AllocThreadObject::addMemoryStat( jint size) { *************** *** 75,77 **** --- 80,110 ---- tom = threadObjectMethods.next(tom); } + } + + const AllocThreadObjectKey& AllocThreadObject::getKey(AllocThreadObjectKey& key) { + + thread->getKey(key.envId); + object->getKey(key.objectKey); + return key; + } + + int AllocThreadObject::operator==(const AllocThreadObjectKey& key) { + + return (*thread == key.envId) && (*object == key.objectKey); + } + + int AllocThreadObject::hashKey(const AllocThreadObjectKey& key) { + + return Thread::hashKey(key.envId) ^ AllocObject::hashKey(key.objectKey); + } + + int AllocThreadObject::isActive() { + + return (object->isActive() && thread->isActive()); + } + + void AllocThreadObject::setUnchanged() { + + IdObject::setUnchanged(); + clearDataChanged(); } Index: allocThreadObject.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocThreadObject.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** allocThreadObject.h 2001/09/02 20:14:21 1.18 --- allocThreadObject.h 2001/11/21 22:31:41 1.19 *************** *** 36,53 **** #define _ALLOC_THREAD_OBJECT_H_ ! /** Key for AllocThreadObject class. ! ** Used for searching in hash tables. ! ** ! ** @author Marek Przeczek, Petr Luner */ ! ! struct AllocThreadObjectKey { - /// thread ID - JNIEnv* envId; - - /// object key - AllocObjectKey objectKey; - }; - /** Crossroad of objects and threads. This class defines ** a relation between a thread and an object. Each object specified --- 36,48 ---- #define _ALLOC_THREAD_OBJECT_H_ ! #include "../main/includes.h" ! #include "../list/listItem.h" ! #include "../alloc/allocAbstractStatThreadObject.h" ! #include "../commun2/idObject.h" ! #include "../list/list.h" ! #include "../alloc/allocThreadObjectMethod.h" ! #include "../alloc/allocThreadObjectKey.h" ! #include "../allocator/allocator.h" /** Crossroad of objects and threads. This class defines ** a relation between a thread and an object. Each object specified *************** *** 60,66 **** ** @author Marek Przeczek, Petr Luner */ ! class AllocThreadObject: public LI1, public LI2, ! public AllocAbstractStatThreadObject, ! public IdObject, public LI3 { public: --- 55,63 ---- ** @author Marek Przeczek, Petr Luner */ ! class AllocThreadObject: public LI1, ! public LI2, ! public LI3, ! public AllocAbstractStatThreadObject, ! public IdObject { public: *************** *** 81,86 **** thread( NULL), object( NULL) ! {}; /** Addition of the object's size to statistics. --- 78,86 ---- thread( NULL), object( NULL) + + {} ! /// Destructor. ! virtual ~AllocThreadObject() {} /** Addition of the object's size to statistics. *************** *** 111,129 **** /** Retrieves object's key. ** ! ** @param key where to store the key ** @return key ** ** @see Hash */ ! const AllocThreadObjectKey& getKey(AllocThreadObjectKey& key) { ! ! thread->getKey(key.envId); ! object->getKey(key.objectKey); ! return key; ! } /** Compares object with given key. ** ** @param key key ** @return 1 (true); ** 0 (false) --- 111,126 ---- /** Retrieves object's key. ** ! ** @param key where to store the key ! ** ** @return key ** ** @see Hash */ ! const AllocThreadObjectKey& getKey(AllocThreadObjectKey& key); /** Compares object with given key. ** ** @param key key + ** ** @return 1 (true); ** 0 (false) *************** *** 131,148 **** ** @see Hash */ ! int operator==(const AllocThreadObjectKey& key) { ! ! return (*thread == key.envId) && (*object == key.objectKey); ! } /** Hash function. ** ! ** @param reference to a key ** @return hash value */ - - static int hashKey(const AllocThreadObjectKey& key) { ! return Thread::hashKey(key.envId) ^ AllocObject::hashKey(key.objectKey); ! } /** Performs deactivation. */ --- 128,140 ---- ** @see Hash */ ! int operator==(const AllocThreadObjectKey& key); /** Hash function. ** ! ** @param key reference to a key ! ** ** @return hash value */ ! static int hashKey(const AllocThreadObjectKey& key); /** Performs deactivation. */ *************** *** 150,153 **** --- 142,146 ---- void deactivate(); + #ifdef USE_ALLOCATOR private: *************** *** 159,167 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} public: --- 152,161 ---- /** Overloaded new() operator. */ ! void* operator new( size_t sz) { return _allocator.get( sz);} /** Overloaded delete() operator. */ void operator delete( void* unit) { _allocator.put( unit);} + #endif public: *************** *** 169,173 **** /** Class identification. ** ! ** @return unique class type identified */ virtual eClassIdent getClassIdent() { return ALLOC_THREAD_OBJECT;} --- 163,167 ---- /** Class identification. ** ! ** @return unique class type identifier */ virtual eClassIdent getClassIdent() { return ALLOC_THREAD_OBJECT;} *************** *** 179,183 **** ** 1 (active) */ ! virtual int isActive() { return (object->isActive() && thread->isActive());} /** Indication that object has changed its data. --- 173,177 ---- ** 1 (active) */ ! virtual int isActive(); /** Indication that object has changed its data. *************** *** 190,198 **** /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged() { ! ! IdObject::setUnchanged(); ! clearDataChanged(); ! } }; --- 184,188 ---- /** Set the structure is unchanged although it may not be. */ ! virtual void setUnchanged(); }; Index: allocThreadObjectMethod.cpp =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocThreadObjectMethod.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** allocThreadObjectMethod.cpp 2001/09/18 22:19:28 1.13 --- allocThreadObjectMethod.cpp 2001/11/21 22:31:41 1.14 *************** *** 33,40 **** */ ! #include "../main/includes.h" - Allocator AllocThreadObjectMethod::_allocator( sizeof( AllocThreadObjectMethod)); - void AllocThreadObjectMethod::addMemoryStat( jint size) { --- 33,47 ---- */ ! #include "../alloc/allocThreadObjectMethod.h" ! #include "../prof/prof.h" ! #include "../alloc/allocThreadMethod.h" ! #include "../alloc/allocObjectMethod.h" ! #include "../alloc/allocThreadObject.h" ! #include "../alloc/allocThreadObjectTrace.h" ! ! #ifdef USE_ALLOCATOR ! Allocator AllocThreadObjectMethod::_allocator; ! #endif void AllocThreadObjectMethod::addMemoryStat( jint size) { *************** *** 78,80 **** --- 85,117 ---- tot = threadObjectTraces.next(tot); } + } + + const AllocThreadObjectMethodKey& AllocThreadObjectMethod::getKey(AllocThreadObjectMethodKey& key) { + + threadObject->thread->getKey(key.envId); + objectMethod->getKey(key.objectMethodKey); + return key; + } + + int AllocThreadObjectMethod::operator==(const AllocThreadObjectMethodKey& key) { + + return (*threadObject->thread == key.envId) && (*objectMethod == key.objectMethodKey); + } + + int AllocThreadObjectMethod::hashKey(const AllocThreadObjectMethodKey& key) { + + return Thread::hashKey(key.envId) ^ AllocObjectMethod::hashKey(key.objectMethodKey); + } + + int AllocThreadObjectMethod::isActive() { + + return (objectMethod->isActive() && + threadObject->isActive() && + threadMethod->isActive()); + } + + void AllocThreadObjectMethod::setUnchanged() { + + IdObject::setUnchanged(); + clearDataChanged(); } Index: allocThreadObjectMethod.h =================================================================== RCS file: /cvsroot/javaprofiler/library/src/alloc/allocThreadObjectMethod.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** allocThreadObjectMethod.h 2001/09/02 20:14:21 1.18 --- allocThreadObjectMethod.h 2001/11/21 22:31:41 1.19 *************** *** 36,53 **** #define _ALLOC_THREAD_OBJECT_METHOD_H_ ! /** Key for AllocThreadObjectMethod class. ! ** Used for searching in hash tables. ! ** ! ** @author Marek Przeczek, Petr Luner */ ! ! struct AllocThreadObjectMethodKey { - /// thread ID - JNIEnv* envId; - - /// AllocObjectMethod key - AllocObjectMethodKey objectMethodKey; - }; - /** Thread-Object-Method information crossing. This class contains ** statistic information about an object allocated by a method call --- 36,48 ---- #define _ALLOC_THREAD_OBJECT_METHOD_H_ ! #include "../main/includes.h" ! #include "../list/listItem.h" ! #include "../alloc/allocAbstractStatThreadObject.h" ! #include "../commun2/idObject.h" ! #include "../list/list.h" ! #include "../alloc/allocThreadObjectTrace.h" ! #include "../alloc/allocThreadObjectMethodKey.h" ! #include "../allocator/allocator.h" /** Thread-Object-Method information crossing. This class contains ** statistic information about an object allocated by a method call *************** *** 60,66 **** ** @author Marek Przeczek, Petr Luner */ ! class AllocThreadObjectMethod: public LI1, public LI2, public LI3, ! public AllocAbstractStatThreadObject, ! public IdObject, public LI4 { public: --- 55,64 ---- ** @author Marek Przeczek, Petr Luner */ ! class AllocThreadObjectMethod: public LI1, ! public LI2, ! public LI3, ! public LI4, ! public AllocAbstractStatThreadObject, ! public IdObject { public: *************** *** 85,90 **** objectMethod( NULL), threadMethod( NULL) ! {}; /** Addition of the object's size to statistics. --- 83,91 ---- objectMethod( NULL), threadMethod( NULL) + + {} ! /// Destructor. ! virtual ~AllocThreadObjectMethod() {} /** Addition of the object's size to statistics. *************** *** 115,133 **** /** Retrieves object's key. ** ! ** @param key where to store the key ** @return key ** ** @see Hash */ ! const AllocThreadObjectMethodKey& getKey(AllocThreadObjectMethodKey& key) { ! ! threadObject->thread->getKey(key.envId); ! objectMethod->getKey(key.objectMethodKey); ! return key; ! } /** Compares object with given key. ** ** @param key key ** @return 1 (true); ** 0 (false) --- 116,131 ---- /** Retrieves object's key. ** ! ** @param key where to store the key ! ** ** @return key ** ** @see Hash */ ! const AllocThreadObjectMethodKey& getKey(AllocThreadObjectMethodKey& key); /** Compares object with given key. ** ** @param key key + ** ** @return 1 (true); ** 0 (false) *************** *** 135,152 **** ** @see Hash */ ! int operator==(const AllocThreadObjectMethodKey& key) { ! ! return (*threadObject->thread == key.envId) && (*objectMethod == key.objectMethodKey); ! } /** Hash function. ** ! ** @param reference to a key ** @return hash value */ - - static int hashKey(const AllocThreadObjectMethodKey& key) { ! return Thread::hashKey(key.envId) ^ AllocObjectMethod::hashKey(key.objectMethodKey); ! } /** Performs deactivation. */ --- 133,145 ---- ** @see Hash */ ! int operator==(const AllocThreadObjectMethodKey& key); /** Hash function. ** ! ** @param key reference to a key ! ** ** @return hash value */ ! static int hashKey(const AllocThreadObjectMethodKey& key); /** Performs deactivation. */ *************** *** 154,157 **** --- 147,151 ---- void deactivate(); + #ifdef USE_ALLOCATOR private: *************** *** 163,171 **** /** Overloaded new() operator. */ ! void* operator new( size_t) { return _allocator.get();} /** Overloaded delete() operator. */ ... [truncated message content] |