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/allocThreadObjectMethod.h" 00036 #include "../prof/prof.h" 00037 #include "../alloc/allocThreadMethod.h" 00038 #include "../alloc/allocObjectMethod.h" 00039 #include "../alloc/allocThreadObject.h" 00040 #include "../alloc/allocThreadObjectTrace.h" 00041 00042 #ifdef USE_ALLOCATOR 00043 Allocator AllocThreadObjectMethod::_allocator; 00044 #endif 00045 00046 void AllocThreadObjectMethod::addMemoryStat( jint size) { 00047 00048 if( !modified()) { 00049 00050 AllocAbstractStatThreadObject::addMemoryStat( size); 00051 00052 threadMethod->addMemoryStat( size); 00053 objectMethod->addMemoryStat( size); 00054 threadObject->addMemoryStat( size); 00055 } 00056 } 00057 00058 void AllocThreadObjectMethod::subMemoryStat( jint size) { 00059 00060 if( !modified()) { 00061 00062 AllocAbstractStatThreadObject::subMemoryStat( size); 00063 00064 threadMethod->subMemoryStat( size); 00065 objectMethod->subMemoryStat( size); 00066 threadObject->subMemoryStat( size); 00067 } 00068 } 00069 00070 void AllocThreadObjectMethod::clearFlag() { 00071 00072 AllocAbstractStatThreadObject::clearFlag(); 00073 00074 objectMethod->clearFlag(); 00075 threadObject->clearFlag(); 00076 } 00077 00078 void AllocThreadObjectMethod::deactivate() { 00079 00080 Prof::prof().activeAllocThreadObjectMethods.removeNoRehash(this); 00081 00082 AllocThreadObjectTrace* tot = threadObjectTraces.first(); 00083 while (tot) { 00084 tot->deactivate(); 00085 tot = threadObjectTraces.next(tot); 00086 } 00087 } 00088 00089 const AllocThreadObjectMethodKey& AllocThreadObjectMethod::getKey(AllocThreadObjectMethodKey& key) { 00090 00091 threadObject->thread->getKey(key.envId); 00092 objectMethod->getKey(key.objectMethodKey); 00093 return key; 00094 } 00095 00096 int AllocThreadObjectMethod::operator==(const AllocThreadObjectMethodKey& key) { 00097 00098 return (*threadObject->thread == key.envId) && (*objectMethod == key.objectMethodKey); 00099 } 00100 00101 int AllocThreadObjectMethod::hashKey(const AllocThreadObjectMethodKey& key) { 00102 00103 return Thread::hashKey(key.envId) ^ AllocObjectMethod::hashKey(key.objectMethodKey); 00104 } 00105 00106 int AllocThreadObjectMethod::isActive() { 00107 00108 return (objectMethod->isActive() && 00109 threadObject->isActive() && 00110 threadMethod->isActive()); 00111 } 00112 00113 void AllocThreadObjectMethod::setUnchanged() { 00114 00115 IdObject::setUnchanged(); 00116 clearDataChanged(); 00117 }