00001 /* 00002 * Sun Public License Notice 00003 * 00004 * The contents of this file are subject to the Sun Public License 00005 * Version 1.0 (the "License"); you may not use this file except 00006 * in compliance with the License. A copy of the License is available 00007 * at http://www.sun.com/ 00008 * 00009 * The Original Code is the Java Profiler module. The Initial Developers 00010 * of the Original Code are Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, 00011 * Lukas Petru and Marek Przeczek. 00012 * 00013 * Portions created by Jan Stola are Copyright (C) 2000-2001. 00014 * All Rights Reserved. 00015 * 00016 * Portions created by Pavel Vacha are Copyright (C) 2000-2001. 00017 * All Rights Reserved. 00018 * 00019 * Portions created by Michal Pise are Copyright (C) 2000-2001. 00020 * All Rights Reserved. 00021 * 00022 * Portions created by Petr Luner are Copyright (C) 2000-2001. 00023 * All Rights Reserved. 00024 * 00025 * Portions created by Lukas Petru are Copyright (C) 2000-2001. 00026 * All Rights Reserved. 00027 * 00028 * Portions created by Marek Przeczek are Copyright (C) 2000-2001. 00029 * All Rights Reserved. 00030 * 00031 * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, 00032 * Lukas Petru and Marek Przeczek. 00033 */ 00034 00035 #include "../alloc/allocThreadObjectTrace.h" 00036 #include "../prof/prof.h" 00037 #include "../alloc/allocObjectTrace.h" 00038 #include "../alloc/allocThreadTrace.h" 00039 #include "../alloc/allocThreadObjectMethod.h" 00040 #include "../alloc/allocThreadObject.h" 00041 00042 #ifdef USE_ALLOCATOR 00043 Allocator AllocThreadObjectTrace::_allocator; 00044 #endif 00045 00046 void AllocThreadObjectTrace::addMemoryStat( jint size) { 00047 00048 if( !modified()) { 00049 00050 AllocAbstractStatThreadObject::addMemoryStat( size); 00051 00052 objectTrace->addMemoryStat( size); 00053 threadTrace->addMemoryStat( size); 00054 threadObjectMethod->addMemoryStat( size); 00055 } 00056 } 00057 00058 void AllocThreadObjectTrace::subMemoryStat( jint size) { 00059 00060 if( !modified()) { 00061 00062 AllocAbstractStatThreadObject::subMemoryStat( size); 00063 00064 objectTrace->subMemoryStat( size); 00065 threadTrace->subMemoryStat( size); 00066 threadObjectMethod->subMemoryStat( size); 00067 } 00068 } 00069 00070 void AllocThreadObjectTrace::clearFlag() { 00071 00072 AllocAbstractStatThreadObject::clearFlag(); 00073 00074 objectTrace->clearFlag(); 00075 threadObjectMethod->clearFlag(); 00076 } 00077 00078 void AllocThreadObjectTrace::deactivate() { 00079 00080 Prof::prof().activeAllocThreadObjectTraces.removeNoRehash(this); 00081 } 00082 00083 const AllocThreadObjectTraceKey& AllocThreadObjectTrace::getKey(AllocThreadObjectTraceKey& key) { 00084 00085 threadObjectMethod->threadObject->thread->getKey(key.envId); 00086 objectTrace->getKey(key.objectTraceKey); 00087 return key; 00088 } 00089 00090 int AllocThreadObjectTrace::operator==(const AllocThreadObjectTraceKey& key) { 00091 00092 return (*threadObjectMethod->threadObject->thread == key.envId) && (*objectTrace == key.objectTraceKey); 00093 } 00094 00095 int AllocThreadObjectTrace::hashKey(const AllocThreadObjectTraceKey& key) { 00096 00097 return Thread::hashKey(key.envId) ^ AllocObjectTrace::hashKey(key.objectTraceKey); 00098 } 00099 00100 int AllocThreadObjectTrace::isActive() { 00101 00102 return (objectTrace->isActive() && 00103 threadObjectMethod->isActive() && 00104 threadTrace->isActive()); 00105 } 00106 00107 void AllocThreadObjectTrace::setUnchanged() { 00108 00109 IdObject::setUnchanged(); 00110 clearDataChanged(); 00111 }